Skip to content

Commit 8e8660d

Browse files
Matthew Wilcox (Oracle)opsiff
authored andcommitted
buffer: remove __getblk_gfp()
mainline inclusion from mainline-v6.7-rc1 category: bugfix Inline it into __bread_gfp(). Link: https://lkml.kernel.org/r/20230914150011.843330-9-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> (cherry picked from commit 93b13ec) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent 4bc980f commit 8e8660d

2 files changed

Lines changed: 11 additions & 27 deletions

File tree

fs/buffer.c

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,9 +1421,6 @@ EXPORT_SYMBOL(__find_get_block);
14211421
* @size: The size of buffer_heads for this @bdev.
14221422
* @gfp: The memory allocation flags to use.
14231423
*
1424-
* In contrast to __getblk_gfp(), the @gfp flags must be all of the flags;
1425-
* they are not augmented with the mapping's GFP flags.
1426-
*
14271424
* Return: The buffer head, or NULL if memory could not be allocated.
14281425
*/
14291426
struct buffer_head *bdev_getblk(struct block_device *bdev, sector_t block,
@@ -1439,27 +1436,6 @@ struct buffer_head *bdev_getblk(struct block_device *bdev, sector_t block,
14391436
}
14401437
EXPORT_SYMBOL(bdev_getblk);
14411438

1442-
/*
1443-
* __getblk_gfp() will locate (and, if necessary, create) the buffer_head
1444-
* which corresponds to the passed block_device, block and size. The
1445-
* returned buffer has its reference count incremented.
1446-
*/
1447-
struct buffer_head *
1448-
__getblk_gfp(struct block_device *bdev, sector_t block,
1449-
unsigned size, gfp_t gfp)
1450-
{
1451-
gfp |= mapping_gfp_constraint(bdev->bd_inode->i_mapping, ~__GFP_FS);
1452-
1453-
/*
1454-
* Prefer looping in the allocator rather than here, at least that
1455-
* code knows what it's doing.
1456-
*/
1457-
gfp |= __GFP_NOFAIL;
1458-
1459-
return bdev_getblk(bdev, block, size, gfp);
1460-
}
1461-
EXPORT_SYMBOL(__getblk_gfp);
1462-
14631439
/*
14641440
* Do async read-ahead on a buffer..
14651441
*/
@@ -1491,7 +1467,17 @@ struct buffer_head *
14911467
__bread_gfp(struct block_device *bdev, sector_t block,
14921468
unsigned size, gfp_t gfp)
14931469
{
1494-
struct buffer_head *bh = __getblk_gfp(bdev, block, size, gfp);
1470+
struct buffer_head *bh;
1471+
1472+
gfp |= mapping_gfp_constraint(bdev->bd_inode->i_mapping, ~__GFP_FS);
1473+
1474+
/*
1475+
* Prefer looping in the allocator rather than here, at least that
1476+
* code knows what it's doing.
1477+
*/
1478+
gfp |= __GFP_NOFAIL;
1479+
1480+
bh = bdev_getblk(bdev, block, size, gfp);
14951481

14961482
if (likely(bh) && !buffer_uptodate(bh))
14971483
bh = __bread_slow(bh);

include/linux/buffer_head.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,6 @@ struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block,
229229
unsigned size);
230230
struct buffer_head *bdev_getblk(struct block_device *bdev, sector_t block,
231231
unsigned size, gfp_t gfp);
232-
struct buffer_head *__getblk_gfp(struct block_device *bdev, sector_t block,
233-
unsigned size, gfp_t gfp);
234232
void __brelse(struct buffer_head *);
235233
void __bforget(struct buffer_head *);
236234
void __breadahead(struct block_device *, sector_t block, unsigned int size);

0 commit comments

Comments
 (0)