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 v2 8/8] buffer: Remove __getblk_gfp()
Date: Thu, 14 Sep 2023 16:00:11 +0100 [thread overview]
Message-ID: <20230914150011.843330-9-willy@infradead.org> (raw)
In-Reply-To: <20230914150011.843330-1-willy@infradead.org>
Inline it into __bread_gfp().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/buffer.c | 36 +++++++++++-------------------------
include/linux/buffer_head.h | 2 --
2 files changed, 11 insertions(+), 27 deletions(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index 58546bfd8903..ad2526dd7cb4 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1420,9 +1420,6 @@ EXPORT_SYMBOL(__find_get_block);
* @size: The size of buffer_heads for this @bdev.
* @gfp: The memory allocation flags to use.
*
- * In contrast to __getblk_gfp(), the @gfp flags must be all of the flags;
- * they are not augmented with the mapping's GFP flags.
- *
* Return: The buffer head, or NULL if memory could not be allocated.
*/
struct buffer_head *bdev_getblk(struct block_device *bdev, sector_t block,
@@ -1438,27 +1435,6 @@ struct buffer_head *bdev_getblk(struct block_device *bdev, sector_t block,
}
EXPORT_SYMBOL(bdev_getblk);
-/*
- * __getblk_gfp() will locate (and, if necessary, create) the buffer_head
- * which corresponds to the passed block_device, block and size. The
- * returned buffer has its reference count incremented.
- */
-struct buffer_head *
-__getblk_gfp(struct block_device *bdev, sector_t block,
- unsigned size, gfp_t gfp)
-{
- gfp |= mapping_gfp_constraint(bdev->bd_inode->i_mapping, ~__GFP_FS);
-
- /*
- * Prefer looping in the allocator rather than here, at least that
- * code knows what it's doing.
- */
- gfp |= __GFP_NOFAIL;
-
- return bdev_getblk(bdev, block, size, gfp);
-}
-EXPORT_SYMBOL(__getblk_gfp);
-
/*
* Do async read-ahead on a buffer..
*/
@@ -1490,7 +1466,17 @@ struct buffer_head *
__bread_gfp(struct block_device *bdev, sector_t block,
unsigned size, gfp_t gfp)
{
- struct buffer_head *bh = __getblk_gfp(bdev, block, size, gfp);
+ struct buffer_head *bh;
+
+ gfp |= mapping_gfp_constraint(bdev->bd_inode->i_mapping, ~__GFP_FS);
+
+ /*
+ * Prefer looping in the allocator rather than here, at least that
+ * code knows what it's doing.
+ */
+ gfp |= __GFP_NOFAIL;
+
+ bh = bdev_getblk(bdev, block, size, gfp);
if (likely(bh) && !buffer_uptodate(bh))
bh = __bread_slow(bh);
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 5372deef732e..5f9208c3fa73 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -226,8 +226,6 @@ struct buffer_head *__find_get_block(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);
-struct buffer_head *__getblk_gfp(struct block_device *bdev, sector_t block,
- unsigned size, gfp_t gfp);
void __brelse(struct buffer_head *);
void __bforget(struct buffer_head *);
void __breadahead(struct block_device *, sector_t block, unsigned int size);
--
2.40.1
prev parent reply other threads:[~2023-09-14 15:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 15:00 [PATCH v2 0/8] Add and use bdev_getblk() Matthew Wilcox (Oracle)
2023-09-14 15:00 ` [PATCH v2 1/8] buffer: Pass GFP flags to folio_alloc_buffers() Matthew Wilcox (Oracle)
2023-09-14 15:00 ` [PATCH v2 2/8] buffer: Hoist GFP flags from grow_dev_page() to __getblk_gfp() Matthew Wilcox (Oracle)
2023-09-14 15:00 ` [PATCH v2 3/8] ext4: Use bdev_getblk() to avoid memory reclaim in readahead path Matthew Wilcox (Oracle)
2023-09-14 15:00 ` [PATCH v2 4/8] buffer: " Matthew Wilcox (Oracle)
2023-09-14 15:00 ` [PATCH v2 5/8] buffer: Convert getblk_unmovable() and __getblk() to use bdev_getblk() Matthew Wilcox (Oracle)
2023-09-14 15:00 ` [PATCH v2 6/8] buffer: Convert sb_getblk() to call __getblk() Matthew Wilcox (Oracle)
2023-09-14 15:00 ` [PATCH v2 7/8] ext4: Call bdev_getblk() from sb_getblk_gfp() Matthew Wilcox (Oracle)
2023-09-14 15:00 ` Matthew Wilcox (Oracle) [this message]
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=20230914150011.843330-9-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).