aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavidlohr Bueso <[email protected]>2025-04-18 01:59:17 +0000
committerChristian Brauner <[email protected]>2025-04-22 16:16:08 +0000
commit5b67d43976828dea2394eae2556b369bb7a61f64 (patch)
tree6e3503bd0443d04bfcba3fa212e67ca27f9419a4
parentfs/buffer: introduce sleeping flavors for pagecache lookups (diff)
downloadkernel-5b67d43976828dea2394eae2556b369bb7a61f64.tar.gz
kernel-5b67d43976828dea2394eae2556b369bb7a61f64.zip
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 <[email protected]> Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Davidlohr Bueso <[email protected]> Link: https://kdevops.org/ext4/v6.15-rc2.html # [0] Link: https://lore.kernel.org/all/[email protected]/ # [1] Link: https://lore.kernel.org/[email protected] Tested-by: [email protected] # [0] [1] Reviewed-by: Luis Chamberlain <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
-rw-r--r--fs/buffer.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 5b1d74c818e9..f8c9e5eb4685 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -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)