summaryrefslogtreecommitdiff
path: root/fs/buffer.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2023-09-14 16:00:07 +0100
committerAndrew Morton <akpm@linux-foundation.org>2023-10-04 10:32:28 -0700
commit775d9b10530a0a303dc08a9cdb2ed1f8667d9c5f (patch)
tree157362cfc271d97a451dafe0fbee9d3dc1467fb3 /fs/buffer.c
parente509ad4d77e6c8852f082104e388110d16fdfb97 (diff)
buffer: use bdev_getblk() to avoid memory reclaim in readahead path
__getblk() 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. Link: https://lkml.kernel.org/r/20230914150011.843330-5-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Hui Zhu <teawater@antgroup.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'fs/buffer.c')
-rw-r--r--fs/buffer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 80e96c1fcd33..edd118594565 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1465,7 +1465,9 @@ EXPORT_SYMBOL(__getblk_gfp);
*/
void __breadahead(struct block_device *bdev, sector_t block, unsigned size)
{
- struct buffer_head *bh = __getblk(bdev, block, size);
+ struct buffer_head *bh = bdev_getblk(bdev, block, size,
+ GFP_NOWAIT | __GFP_MOVABLE);
+
if (likely(bh)) {
bh_readahead(bh, REQ_RAHEAD);
brelse(bh);