From: Jan Kara <jack@suse.cz>
To: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: tytso@mit.edu, jack@suse.com, yi.zhang@huaweicloud.com,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/9] jbd2: jump to new copy_done tag when b_frozen_data is created concurrently
Date: Wed, 15 May 2024 01:42:46 +0200 [thread overview]
Message-ID: <20240514234246.3kspcjji4pjrwsnc@quack3> (raw)
In-Reply-To: <20240514112438.1269037-5-shikemeng@huaweicloud.com>
On Tue 14-05-24 19:24:33, Kemeng Shi wrote:
> If b_frozen_data is created concurrently, we can update new_folio and
> new_offset with b_frozen_data and then move forward
>
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/jbd2/journal.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index 714e2ef0115a..5fb5062cf7ae 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -351,7 +351,6 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
> atomic_set(&new_bh->b_count, 1);
>
> spin_lock(&jh_in->b_state_lock);
> -repeat:
> /*
> * If a new transaction has already done a buffer copy-out, then
> * we use that version of the data for the commit.
> @@ -399,22 +398,22 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
> spin_lock(&jh_in->b_state_lock);
> if (jh_in->b_frozen_data) {
> jbd2_free(tmp, bh_in->b_size);
> - goto repeat;
> + goto copy_done;
> }
>
> jh_in->b_frozen_data = tmp;
> memcpy_from_folio(tmp, new_folio, new_offset, bh_in->b_size);
> -
> - new_folio = virt_to_folio(tmp);
> - new_offset = offset_in_folio(new_folio, tmp);
> - done_copy_out = 1;
> -
> /*
> * This isn't strictly necessary, as we're using frozen
> * data for the escaping, but it keeps consistency with
> * b_frozen_data usage.
> */
> jh_in->b_frozen_triggers = jh_in->b_triggers;
> +
> +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;
> }
>
> /*
> --
> 2.30.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2024-05-14 23:42 UTC|newest]
Thread overview: 15+ 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 ` [PATCH v2 3/9] jbd2: remove unnedded "need_copy_out" in jbd2_journal_write_metadata_buffer Kemeng Shi
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 [this message]
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
2024-06-28 17:17 ` [PATCH v2 0/9] A fix and some cleanups to jbd2 Theodore Ts'o
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=20240514234246.3kspcjji4pjrwsnc@quack3 \
--to=jack@suse.cz \
--cc=jack@suse.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shikemeng@huaweicloud.com \
--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 NNTP newsgroup(s).