Skip to content

Commit 8a83ac5

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
ext4: call bdev_getblk() from sb_getblk_gfp()
Most of the callers of sb_getblk_gfp() already assumed that they were passing the entire GFP flags to use. Fix up the two callers that didn't, and remove the __GFP_NOFAIL from them since they both appear to correctly handle failure. Link: https://lkml.kernel.org/r/20230914150011.843330-8-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>
1 parent 4b9c8b1 commit 8a83ac5

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

fs/ext4/super.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,19 @@ static struct buffer_head *__ext4_sb_bread_gfp(struct super_block *sb,
244244
struct buffer_head *ext4_sb_bread(struct super_block *sb, sector_t block,
245245
blk_opf_t op_flags)
246246
{
247-
return __ext4_sb_bread_gfp(sb, block, op_flags, __GFP_MOVABLE);
247+
gfp_t gfp = mapping_gfp_constraint(sb->s_bdev->bd_inode->i_mapping,
248+
~__GFP_FS) | __GFP_MOVABLE;
249+
250+
return __ext4_sb_bread_gfp(sb, block, op_flags, gfp);
248251
}
249252

250253
struct buffer_head *ext4_sb_bread_unmovable(struct super_block *sb,
251254
sector_t block)
252255
{
253-
return __ext4_sb_bread_gfp(sb, block, 0, 0);
256+
gfp_t gfp = mapping_gfp_constraint(sb->s_bdev->bd_inode->i_mapping,
257+
~__GFP_FS);
258+
259+
return __ext4_sb_bread_gfp(sb, block, 0, gfp);
254260
}
255261

256262
void ext4_sb_breadahead_unmovable(struct super_block *sb, sector_t block)

include/linux/buffer_head.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,10 @@ static inline struct buffer_head *sb_getblk(struct super_block *sb,
368368
return __getblk(sb->s_bdev, block, sb->s_blocksize);
369369
}
370370

371-
static inline struct buffer_head *
372-
sb_getblk_gfp(struct super_block *sb, sector_t block, gfp_t gfp)
371+
static inline struct buffer_head *sb_getblk_gfp(struct super_block *sb,
372+
sector_t block, gfp_t gfp)
373373
{
374-
return __getblk_gfp(sb->s_bdev, block, sb->s_blocksize, gfp);
374+
return bdev_getblk(sb->s_bdev, block, sb->s_blocksize, gfp);
375375
}
376376

377377
static inline struct buffer_head *

0 commit comments

Comments
 (0)