Skip to content

Commit 5b67d43

Browse files
Davidlohr Buesobrauner
authored andcommitted
fs/buffer: 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. Convert write_boundary_block() which already takes the buffer lock as well as bdev_getblk() depending on the respective gpf flags. There are no changes in semantics. 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-4-dave@stgolabs.net Tested-by: kdevops@lists.linux.dev # [0] [1] Reviewed-by: Luis Chamberlain <mcgrof@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 2814a7d commit 5b67d43

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

fs/buffer.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,9 @@ EXPORT_SYMBOL(generic_buffers_fsync);
658658
void write_boundary_block(struct block_device *bdev,
659659
sector_t bblock, unsigned blocksize)
660660
{
661-
struct buffer_head *bh = __find_get_block(bdev, bblock + 1, blocksize);
661+
struct buffer_head *bh;
662+
663+
bh = __find_get_block_nonatomic(bdev, bblock + 1, blocksize);
662664
if (bh) {
663665
if (buffer_dirty(bh))
664666
write_dirty_buffer(bh, 0);
@@ -1440,7 +1442,12 @@ EXPORT_SYMBOL(__find_get_block_nonatomic);
14401442
struct buffer_head *bdev_getblk(struct block_device *bdev, sector_t block,
14411443
unsigned size, gfp_t gfp)
14421444
{
1443-
struct buffer_head *bh = __find_get_block(bdev, block, size);
1445+
struct buffer_head *bh;
1446+
1447+
if (gfpflags_allow_blocking(gfp))
1448+
bh = __find_get_block_nonatomic(bdev, block, size);
1449+
else
1450+
bh = __find_get_block(bdev, block, size);
14441451

14451452
might_alloc(gfp);
14461453
if (bh)

0 commit comments

Comments
 (0)