Skip to content

Commit 4c15129

Browse files
Kemeng Shitytso
authored andcommitted
jbd2: jump to new copy_done tag when b_frozen_data is created concurrently
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 <[email protected]> Reviewed-by: Zhang Yi <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 5dd3e8c commit 4c15129

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

fs/jbd2/journal.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,6 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
351351
atomic_set(&new_bh->b_count, 1);
352352

353353
spin_lock(&jh_in->b_state_lock);
354-
repeat:
355354
/*
356355
* If a new transaction has already done a buffer copy-out, then
357356
* we use that version of the data for the commit.
@@ -399,22 +398,22 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
399398
spin_lock(&jh_in->b_state_lock);
400399
if (jh_in->b_frozen_data) {
401400
jbd2_free(tmp, bh_in->b_size);
402-
goto repeat;
401+
goto copy_done;
403402
}
404403

405404
jh_in->b_frozen_data = tmp;
406405
memcpy_from_folio(tmp, new_folio, new_offset, bh_in->b_size);
407-
408-
new_folio = virt_to_folio(tmp);
409-
new_offset = offset_in_folio(new_folio, tmp);
410-
done_copy_out = 1;
411-
412406
/*
413407
* This isn't strictly necessary, as we're using frozen
414408
* data for the escaping, but it keeps consistency with
415409
* b_frozen_data usage.
416410
*/
417411
jh_in->b_frozen_triggers = jh_in->b_triggers;
412+
413+
copy_done:
414+
new_folio = virt_to_folio(jh_in->b_frozen_data);
415+
new_offset = offset_in_folio(new_folio, jh_in->b_frozen_data);
416+
done_copy_out = 1;
418417
}
419418

420419
/*

0 commit comments

Comments
 (0)