]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
jbd2: remove unneeded done_copy_out variable in jbd2_journal_write_metadata_buffer
authorKemeng Shi <shikemeng@huaweicloud.com>
Thu, 1 Aug 2024 01:38:12 +0000 (09:38 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 27 Aug 2024 03:49:15 +0000 (23:49 -0400)
It's more intuitive to use jh_in->b_frozen_data directly instead of
done_copy_out variable. Simply remove unneeded done_copy_out variable
and use b_frozen_data instead.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20240801013815.2393869-6-shikemeng@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/jbd2/journal.c

index f7464ac29cd5c21245a3d34ccc286febd3550bd6..225a9a12333559c6ceaf137e80b05eb4ab704151 100644 (file)
@@ -318,7 +318,6 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
                                  struct buffer_head **bh_out,
                                  sector_t blocknr)
 {
-       int done_copy_out = 0;
        int do_escape = 0;
        char *mapped_data;
        struct buffer_head *new_bh;
@@ -349,7 +348,6 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
         * we use that version of the data for the commit.
         */
        if (jh_in->b_frozen_data) {
-               done_copy_out = 1;
                new_folio = virt_to_folio(jh_in->b_frozen_data);
                new_offset = offset_in_folio(new_folio, jh_in->b_frozen_data);
                mapped_data = jh_in->b_frozen_data;
@@ -357,17 +355,15 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
                new_folio = bh_in->b_folio;
                new_offset = offset_in_folio(new_folio, bh_in->b_data);
                mapped_data = kmap_local_folio(new_folio, new_offset);
-       }
-
-       /*
-        * Fire data frozen trigger if data already wasn't frozen.  Do this
-        * before checking for escaping, as the trigger may modify the magic
-        * offset.  If a copy-out happens afterwards, it will have the correct
-        * data in the buffer.
-        */
-       if (!done_copy_out)
+               /*
+                * Fire data frozen trigger if data already wasn't frozen. Do
+                * this before checking for escaping, as the trigger may modify
+                * the magic offset.  If a copy-out happens afterwards, it will
+                * have the correct data in the buffer.
+                */
                jbd2_buffer_frozen_trigger(jh_in, mapped_data,
                                           jh_in->b_triggers);
+       }
 
        /*
         * Check for escaping
@@ -380,7 +376,7 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
        /*
         * Do we need to do a data copy?
         */
-       if (do_escape && !done_copy_out) {
+       if (do_escape && !jh_in->b_frozen_data) {
                char *tmp;
 
                spin_unlock(&jh_in->b_state_lock);
@@ -408,7 +404,6 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
 copy_done:
                new_folio = virt_to_folio(jh_in->b_frozen_data);
                new_offset = offset_in_folio(new_folio, jh_in->b_frozen_data);
-               done_copy_out = 1;
        }
 
        /*