]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
fs/buffer: use sleeping version of __find_get_block()
authorDavidlohr Bueso <dave@stgolabs.net>
Fri, 18 Apr 2025 01:59:17 +0000 (18:59 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:12:20 +0000 (11:12 +0200)
[ Upstream commit 5b67d43976828dea2394eae2556b369bb7a61f64 ]

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
Link: https://lore.kernel.org/all/aAAEvcrmREWa1SKF@bombadil.infradead.org/
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/buffer.c

index 7981097c846d4e2235ab188109b7eda60450aa3b..2494fe3a5e69ee51eecb2d40100102dcfa688687 100644 (file)
@@ -658,7 +658,9 @@ EXPORT_SYMBOL(generic_buffers_fsync);
 void write_boundary_block(struct block_device *bdev,
                        sector_t bblock, unsigned blocksize)
 {
-       struct buffer_head *bh = __find_get_block(bdev, bblock + 1, blocksize);
+       struct buffer_head *bh;
+
+       bh = __find_get_block_nonatomic(bdev, bblock + 1, blocksize);
        if (bh) {
                if (buffer_dirty(bh))
                        write_dirty_buffer(bh, 0);
@@ -1440,7 +1442,12 @@ EXPORT_SYMBOL(__find_get_block_nonatomic);
 struct buffer_head *bdev_getblk(struct block_device *bdev, sector_t block,
                unsigned size, gfp_t gfp)
 {
-       struct buffer_head *bh = __find_get_block(bdev, block, size);
+       struct buffer_head *bh;
+
+       if (gfpflags_allow_blocking(gfp))
+               bh = __find_get_block_nonatomic(bdev, block, size);
+       else
+               bh = __find_get_block(bdev, block, size);
 
        might_alloc(gfp);
        if (bh)