Message ID | 20240506141801.1165315-5-shikemeng@huaweicloud.com |
---|---|
State | Superseded |
Headers | show |
Series | A fix and some cleanups to jbd2 | expand |
On 2024/5/6 22:17, Kemeng Shi wrote: > We make sure b_frozen_data is not NULL before jump to "repeat" tag, move > "repeat" tag around to remove repeat check of b_frozen_data. > > Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> > --- > fs/jbd2/journal.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c > index 9a35d0c5b38c..77fcdc76fdfd 100644 > --- a/fs/jbd2/journal.c > +++ b/fs/jbd2/journal.c > @@ -353,12 +353,12 @@ 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. > */ > if (jh_in->b_frozen_data) { > +repeat: > 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); > I suppose we could drop the repeat tag entirely, just set the new_folio and new_offset, and then goto handle do_escape. We don't need to call jbd2_buffer_frozen_trigger() and check for escaping again, is that right? Thanks, Yi.
on 5/7/2024 8:41 PM, Zhang Yi wrote: > On 2024/5/6 22:17, Kemeng Shi wrote: >> We make sure b_frozen_data is not NULL before jump to "repeat" tag, move >> "repeat" tag around to remove repeat check of b_frozen_data. >> >> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> >> --- >> fs/jbd2/journal.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c >> index 9a35d0c5b38c..77fcdc76fdfd 100644 >> --- a/fs/jbd2/journal.c >> +++ b/fs/jbd2/journal.c >> @@ -353,12 +353,12 @@ 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. >> */ >> if (jh_in->b_frozen_data) { >> +repeat: >> 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); >> > > I suppose we could drop the repeat tag entirely, just set the new_folio and > new_offset, and then goto handle do_escape. We don't need to call > jbd2_buffer_frozen_trigger() and check for escaping again, is that right? Sure, sounds reasonable to me. Will do it in next version. Thanks > > Thanks, > Yi. >
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 9a35d0c5b38c..77fcdc76fdfd 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -353,12 +353,12 @@ 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. */ if (jh_in->b_frozen_data) { +repeat: 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);
We make sure b_frozen_data is not NULL before jump to "repeat" tag, move "repeat" tag around to remove repeat check of b_frozen_data. Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> --- fs/jbd2/journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)