2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00

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>
This commit is contained in:
Davidlohr Bueso 2025-04-17 18:59:19 -07:00 committed by Christian Brauner
parent a0b5ff0749
commit f76d4c28a4
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -345,7 +345,8 @@ int jbd2_journal_revoke(handle_t *handle, unsigned long long blocknr,
bh = bh_in; bh = bh_in;
if (!bh) { if (!bh) {
bh = __find_get_block(bdev, blocknr, journal->j_blocksize); bh = __find_get_block_nonatomic(bdev, blocknr,
journal->j_blocksize);
if (bh) if (bh)
BUFFER_TRACE(bh, "found on hash"); BUFFER_TRACE(bh, "found on hash");
} }
@ -355,7 +356,8 @@ int jbd2_journal_revoke(handle_t *handle, unsigned long long blocknr,
/* If there is a different buffer_head lying around in /* If there is a different buffer_head lying around in
* memory anywhere... */ * memory anywhere... */
bh2 = __find_get_block(bdev, blocknr, journal->j_blocksize); bh2 = __find_get_block_nonatomic(bdev, blocknr,
journal->j_blocksize);
if (bh2) { if (bh2) {
/* ... and it has RevokeValid status... */ /* ... and it has RevokeValid status... */
if (bh2 != bh && buffer_revokevalid(bh2)) if (bh2 != bh && buffer_revokevalid(bh2))
@ -464,7 +466,8 @@ void jbd2_journal_cancel_revoke(handle_t *handle, struct journal_head *jh)
* state machine will get very upset later on. */ * state machine will get very upset later on. */
if (need_cancel) { if (need_cancel) {
struct buffer_head *bh2; struct buffer_head *bh2;
bh2 = __find_get_block(bh->b_bdev, bh->b_blocknr, bh->b_size); bh2 = __find_get_block_nonatomic(bh->b_bdev, bh->b_blocknr,
bh->b_size);
if (bh2) { if (bh2) {
if (bh2 != bh) if (bh2 != bh)
clear_buffer_revoked(bh2); clear_buffer_revoked(bh2);
@ -492,9 +495,9 @@ void jbd2_clear_buffer_revoked_flags(journal_t *journal)
struct jbd2_revoke_record_s *record; struct jbd2_revoke_record_s *record;
struct buffer_head *bh; struct buffer_head *bh;
record = (struct jbd2_revoke_record_s *)list_entry; record = (struct jbd2_revoke_record_s *)list_entry;
bh = __find_get_block(journal->j_fs_dev, bh = __find_get_block_nonatomic(journal->j_fs_dev,
record->blocknr, record->blocknr,
journal->j_blocksize); journal->j_blocksize);
if (bh) { if (bh) {
clear_buffer_revoked(bh); clear_buffer_revoked(bh);
__brelse(bh); __brelse(bh);