Skip to content

Commit f76d4c2

Browse files
Davidlohr Buesobrauner
authored andcommitted
fs/jbd2: use sleeping version of __find_get_block()
Convert to the new nonatomic flavor to benefit from potential performance benefits and adapt in the future vs migration such that semantics are kept. - jbd2_journal_revoke(): can sleep (has might_sleep() in the beginning) - jbd2_journal_cancel_revoke(): only used from do_get_write_access() and do_get_create_access() which do sleep. So can sleep. - jbd2_clear_buffer_revoked_flags() - only called from journal commit code which sleeps. So can sleep. Suggested-by: Jan Kara <jack@suse.cz> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net> Link: https://kdevops.org/ext4/v6.15-rc2.html # [0] Link: https://lore.kernel.org/all/aAAEvcrmREWa1SKF@bombadil.infradead.org/ # [1] Link: https://lore.kernel.org/20250418015921.132400-6-dave@stgolabs.net Tested-by: kdevops@lists.linux.dev Reviewed-by: Luis Chamberlain <mcgrof@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent a0b5ff0 commit f76d4c2

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

fs/jbd2/revoke.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,8 @@ int jbd2_journal_revoke(handle_t *handle, unsigned long long blocknr,
345345
bh = bh_in;
346346

347347
if (!bh) {
348-
bh = __find_get_block(bdev, blocknr, journal->j_blocksize);
348+
bh = __find_get_block_nonatomic(bdev, blocknr,
349+
journal->j_blocksize);
349350
if (bh)
350351
BUFFER_TRACE(bh, "found on hash");
351352
}
@@ -355,7 +356,8 @@ int jbd2_journal_revoke(handle_t *handle, unsigned long long blocknr,
355356

356357
/* If there is a different buffer_head lying around in
357358
* memory anywhere... */
358-
bh2 = __find_get_block(bdev, blocknr, journal->j_blocksize);
359+
bh2 = __find_get_block_nonatomic(bdev, blocknr,
360+
journal->j_blocksize);
359361
if (bh2) {
360362
/* ... and it has RevokeValid status... */
361363
if (bh2 != bh && buffer_revokevalid(bh2))
@@ -464,7 +466,8 @@ void jbd2_journal_cancel_revoke(handle_t *handle, struct journal_head *jh)
464466
* state machine will get very upset later on. */
465467
if (need_cancel) {
466468
struct buffer_head *bh2;
467-
bh2 = __find_get_block(bh->b_bdev, bh->b_blocknr, bh->b_size);
469+
bh2 = __find_get_block_nonatomic(bh->b_bdev, bh->b_blocknr,
470+
bh->b_size);
468471
if (bh2) {
469472
if (bh2 != bh)
470473
clear_buffer_revoked(bh2);
@@ -492,9 +495,9 @@ void jbd2_clear_buffer_revoked_flags(journal_t *journal)
492495
struct jbd2_revoke_record_s *record;
493496
struct buffer_head *bh;
494497
record = (struct jbd2_revoke_record_s *)list_entry;
495-
bh = __find_get_block(journal->j_fs_dev,
496-
record->blocknr,
497-
journal->j_blocksize);
498+
bh = __find_get_block_nonatomic(journal->j_fs_dev,
499+
record->blocknr,
500+
journal->j_blocksize);
498501
if (bh) {
499502
clear_buffer_revoked(bh);
500503
__brelse(bh);

0 commit comments

Comments
 (0)