summaryrefslogtreecommitdiffstats
path: root/fs/jbd2/journal.c
diff options
context:
space:
mode:
authorKemeng Shi <shikemeng@huaweicloud.com>2024-08-01 03:38:11 +0200
committerTheodore Ts'o <tytso@mit.edu>2024-08-27 05:49:15 +0200
commitdebbfd991f0116a8e88b77f08d231c57a1207dec (patch)
tree518f5edf7bb5626ae82deff0c3f7e8d6be0e1215 /fs/jbd2/journal.c
parentjbd2: remove unused return value of jbd2_fc_release_bufs (diff)
downloadlinux-debbfd991f0116a8e88b77f08d231c57a1207dec.tar.xz
linux-debbfd991f0116a8e88b77f08d231c57a1207dec.zip
jbd2: remove unneeded kmap for jh_in->b_frozen_data in jbd2_journal_write_metadata_buffer
Remove kmap for page of b_frozen_data from jbd2_alloc() which always provides an address from the direct kernel mapping. Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Zhang Yi <yi.zhang@huawei.com> Link: https://patch.msgid.link/20240801013815.2393869-5-shikemeng@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to '')
-rw-r--r--fs/jbd2/journal.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 51f184ba830c..f7464ac29cd5 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -352,12 +352,13 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
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;
} else {
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);
}
- 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
@@ -373,7 +374,8 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
*/
if (*((__be32 *)mapped_data) == cpu_to_be32(JBD2_MAGIC_NUMBER))
do_escape = 1;
- kunmap_local(mapped_data);
+ if (!jh_in->b_frozen_data)
+ kunmap_local(mapped_data);
/*
* Do we need to do a data copy?