From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: akpm@linux-foundation.org
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
Hui Zhu <teawater@antgroup.com>,
linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: [PATCH 3/3] ext4: Use bdev_getblk() to avoid memory reclaim in readahead path
Date: Fri, 11 Aug 2023 17:15:28 +0100 [thread overview]
Message-ID: <20230811161528.506437-4-willy@infradead.org> (raw)
In-Reply-To: <20230811161528.506437-1-willy@infradead.org>
sb_getblk_gfp adds __GFP_NOFAIL, which is unnecessary for readahead;
we're quite comfortable with the possibility that we may not get a bh
back. Switch to bdev_getblk() which does not include __GFP_NOFAIL.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reported-by: Hui Zhu <teawater@antgroup.com>
Link: https://lore.kernel.org/linux-fsdevel/20230811035705.3296-1-teawaterz@linux.alibaba.com/
---
fs/ext4/super.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index c94ebf704616..48524314be97 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -254,7 +254,8 @@ struct buffer_head *ext4_sb_bread_unmovable(struct super_block *sb,
void ext4_sb_breadahead_unmovable(struct super_block *sb, sector_t block)
{
- struct buffer_head *bh = sb_getblk_gfp(sb, block, 0);
+ struct buffer_head *bh = bdev_getblk(sb->s_bdev, block,
+ sb->s_blocksize, GFP_NOWAIT);
if (likely(bh)) {
if (trylock_buffer(bh))
--
2.40.1
next prev parent reply other threads:[~2023-08-11 16:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 16:15 [PATCH 0/3] Add and use bdev_getblk() Matthew Wilcox (Oracle)
2023-08-11 16:15 ` [PATCH 1/3] buffer: Pass GFP flags to folio_alloc_buffers() Matthew Wilcox (Oracle)
2023-08-11 16:15 ` [PATCH 2/3] buffer: Hoist GFP flags from grow_dev_page() to __getblk_gfp() Matthew Wilcox (Oracle)
2023-09-14 9:16 ` Jan Kara
2023-09-14 17:25 ` Matthew Wilcox
2023-08-11 16:15 ` Matthew Wilcox (Oracle) [this message]
2023-08-11 16:17 ` [PATCH 3/3] ext4: Use bdev_getblk() to avoid memory reclaim in readahead path Matthew Wilcox
2023-08-11 19:23 ` [PATCH 4/3] buffer: Use bdev_getblk() in __breadahead() Matthew Wilcox
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=20230811161528.506437-4-willy@infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=teawater@antgroup.com \
/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;
as well as URLs for NNTP newsgroup(s).