Linux-ext4 Archive mirror
 help / color / mirror / Atom feed
From: Kemeng Shi <shikemeng@huaweicloud.com>
To: tytso@mit.edu, jack@suse.com, yi.zhang@huaweicloud.com
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/9] jbd2: remove unnedded "need_copy_out" in jbd2_journal_write_metadata_buffer
Date: Tue, 14 May 2024 19:24:32 +0800	[thread overview]
Message-ID: <20240514112438.1269037-4-shikemeng@huaweicloud.com> (raw)
In-Reply-To: <20240514112438.1269037-1-shikemeng@huaweicloud.com>

As we only need to copy out when we should do escape, need_copy_out
could be simply replaced by "do_escape".

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
---
 fs/jbd2/journal.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 2dca2f613a8e..714e2ef0115a 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -325,7 +325,6 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
 				  struct buffer_head **bh_out,
 				  sector_t blocknr)
 {
-	int need_copy_out = 0;
 	int done_copy_out = 0;
 	int do_escape = 0;
 	char *mapped_data;
@@ -380,16 +379,14 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
 	/*
 	 * Check for escaping
 	 */
-	if (*((__be32 *)mapped_data) == cpu_to_be32(JBD2_MAGIC_NUMBER)) {
-		need_copy_out = 1;
+	if (*((__be32 *)mapped_data) == cpu_to_be32(JBD2_MAGIC_NUMBER))
 		do_escape = 1;
-	}
 	kunmap_local(mapped_data);
 
 	/*
 	 * Do we need to do a data copy?
 	 */
-	if (need_copy_out && !done_copy_out) {
+	if (do_escape && !done_copy_out) {
 		char *tmp;
 
 		spin_unlock(&jh_in->b_state_lock);
-- 
2.30.0


  parent reply	other threads:[~2024-05-14 11:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14 11:24 [PATCH v2 0/9] A fix and some cleanups to jbd2 Kemeng Shi
2024-05-14 11:24 ` [PATCH v2 1/9] jbd2: avoid memleak in jbd2_journal_write_metadata_buffer Kemeng Shi
2024-05-14 11:24 ` [PATCH v2 2/9] jbd2: remove unused return info from jbd2_journal_write_metadata_buffer Kemeng Shi
2024-05-14 13:53   ` Zhang Yi
2024-05-14 23:41   ` Jan Kara
2024-05-14 11:24 ` Kemeng Shi [this message]
2024-05-14 11:24 ` [PATCH v2 4/9] jbd2: jump to new copy_done tag when b_frozen_data is created concurrently Kemeng Shi
2024-05-14 14:11   ` Zhang Yi
2024-05-14 23:42   ` Jan Kara
2024-05-14 11:24 ` [PATCH v2 5/9] jbd2: remove unneeded kmap to do escape in jbd2_journal_write_metadata_buffer Kemeng Shi
2024-05-14 11:24 ` [PATCH v2 6/9] jbd2: use bh_in instead of jh2bh(jh_in) to simplify code Kemeng Shi
2024-05-14 11:24 ` [PATCH v2 7/9] jbd2: remove dead equality check of j_commit_[sequence/request] in kjournald2 Kemeng Shi
2024-05-14 11:24 ` [PATCH v2 8/9] jbd2: remove dead check of JBD2_UNMOUNT " Kemeng Shi
2024-05-14 11:24 ` [PATCH v2 9/9] jbd2: remove unnecessary "should_sleep" " Kemeng Shi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240514112438.1269037-4-shikemeng@huaweicloud.com \
    --to=shikemeng@huaweicloud.com \
    --cc=jack@suse.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@huaweicloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).