From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Davidlohr Bueso <dave@stgolabs.net>, Jan Kara <jack@suse.cz>,
kdevops@lists.linux.dev, Luis Chamberlain <mcgrof@kernel.org>,
Christian Brauner <brauner@kernel.org>,
Sasha Levin <sashal@kernel.org>,
viro@zeniv.linux.org.uk, willy@infradead.org,
akpm@linux-foundation.org, josef@toxicpanda.com, mhocko@suse.com,
linux-fsdevel@vger.kernel.org
Subject: [PATCH AUTOSEL 6.12 26/37] fs/buffer: introduce sleeping flavors for pagecache lookups
Date: Tue, 29 Apr 2025 19:51:11 -0400 [thread overview]
Message-ID: <20250429235122.537321-26-sashal@kernel.org> (raw)
In-Reply-To: <20250429235122.537321-1-sashal@kernel.org>
From: Davidlohr Bueso <dave@stgolabs.net>
[ Upstream commit 2814a7d3d2ff5d2cdd22936f641f758fdb971fa0 ]
Add __find_get_block_nonatomic() and sb_find_get_block_nonatomic()
calls for which users will be converted where safe. These versions
will take the folio lock instead of the mapping's private_lock.
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-3-dave@stgolabs.net
Tested-by: kdevops@lists.linux.dev
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 | 9 +++++++++
include/linux/buffer_head.h | 8 ++++++++
2 files changed, 17 insertions(+)
diff --git a/fs/buffer.c b/fs/buffer.c
index ba464c2002061..b04705eb6cc57 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1420,6 +1420,15 @@ __find_get_block(struct block_device *bdev, sector_t block, unsigned size)
}
EXPORT_SYMBOL(__find_get_block);
+/* same as __find_get_block() but allows sleeping contexts */
+struct buffer_head *
+__find_get_block_nonatomic(struct block_device *bdev, sector_t block,
+ unsigned size)
+{
+ return find_get_block_common(bdev, block, size, false);
+}
+EXPORT_SYMBOL(__find_get_block_nonatomic);
+
/**
* bdev_getblk - Get a buffer_head in a block device's buffer cache.
* @bdev: The block device.
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 932139c5d46f5..ffcd76d977703 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -223,6 +223,8 @@ void __wait_on_buffer(struct buffer_head *);
wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block,
unsigned size);
+struct buffer_head *__find_get_block_nonatomic(struct block_device *bdev,
+ sector_t block, unsigned size);
struct buffer_head *bdev_getblk(struct block_device *bdev, sector_t block,
unsigned size, gfp_t gfp);
void __brelse(struct buffer_head *);
@@ -398,6 +400,12 @@ sb_find_get_block(struct super_block *sb, sector_t block)
return __find_get_block(sb->s_bdev, block, sb->s_blocksize);
}
+static inline struct buffer_head *
+sb_find_get_block_nonatomic(struct super_block *sb, sector_t block)
+{
+ return __find_get_block_nonatomic(sb->s_bdev, block, sb->s_blocksize);
+}
+
static inline void
map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block)
{
--
2.39.5
next prev parent reply other threads:[~2025-04-29 23:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250429235122.537321-1-sashal@kernel.org>
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 25/37] fs/buffer: split locking for pagecache lookups Sasha Levin
2025-04-30 0:48 ` Luis Chamberlain
2025-04-29 23:51 ` Sasha Levin [this message]
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 27/37] fs/buffer: use sleeping version of __find_get_block() Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 28/37] fs/ocfs2: " Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 29/37] fs/jbd2: " Sasha Levin
2025-04-29 23:51 ` [PATCH AUTOSEL 6.12 30/37] fs/ext4: use sleeping version of sb_find_get_block() Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250429235122.537321-26-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=dave@stgolabs.net \
--cc=jack@suse.cz \
--cc=josef@toxicpanda.com \
--cc=kdevops@lists.linux.dev \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=mhocko@suse.com \
--cc=stable@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox