Linux RAID subsystem development
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Zi Yan <ziy@nvidia.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-raid@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 1/3] md: Use folio_alloc_buffers()
Date: Mon, 14 Sep 2026 05:18:08 +0100	[thread overview]
Message-ID: <20260914041830.2072626-1-willy@infradead.org> (raw)
In-Reply-To: <20260913-remove-pg_private-v4-0-848550f7574e@nvidia.com>

Remove the last user of alloc_page_buffers().  This isn't _great_,
but prevents new callers of alloc_page_buffers() existing.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 drivers/md/md-bitmap.c      | 5 +++--
 fs/buffer.c                 | 8 --------
 include/linux/buffer_head.h | 1 -
 3 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index b8325cb09a37..5f1637f974c1 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -560,6 +560,7 @@ static int read_file_page(struct file *file, unsigned long index,
 {
 	int ret = 0;
 	struct inode *inode = file_inode(file);
+	struct folio *folio = page_folio(page);
 	struct buffer_head *bh;
 	sector_t block, blk_cur;
 	unsigned long blocksize = i_blocksize(inode);
@@ -567,12 +568,12 @@ static int read_file_page(struct file *file, unsigned long index,
 	pr_debug("read bitmap file (%dB @ %llu)\n", (int)PAGE_SIZE,
 		 (unsigned long long)index << PAGE_SHIFT);
 
-	bh = alloc_page_buffers(page, blocksize);
+	bh = folio_alloc_buffers(folio, blocksize, GFP_NOFS | __GFP_ACCOUNT);
 	if (!bh) {
 		ret = -ENOMEM;
 		goto out;
 	}
-	attach_page_private(page, bh);
+	folio_attach_private(folio, bh);
 	blk_cur = index << (PAGE_SHIFT - inode->i_blkbits);
 	while (bh) {
 		block = blk_cur;
diff --git a/fs/buffer.c b/fs/buffer.c
index c9342aeb8cdf..367be053d07b 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -781,14 +781,6 @@ struct buffer_head *folio_alloc_buffers(struct folio *folio, unsigned long size,
 }
 EXPORT_SYMBOL_GPL(folio_alloc_buffers);
 
-struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size)
-{
-	gfp_t gfp = GFP_NOFS | __GFP_ACCOUNT;
-
-	return folio_alloc_buffers(page_folio(page), size, gfp);
-}
-EXPORT_SYMBOL_GPL(alloc_page_buffers);
-
 static inline void link_dev_buffers(struct folio *folio,
 		struct buffer_head *head)
 {
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 1d55f7770cad..c9918176adaa 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -197,7 +197,6 @@ void folio_set_bh(struct buffer_head *bh, struct folio *folio,
 		  unsigned long offset);
 struct buffer_head *folio_alloc_buffers(struct folio *folio, unsigned long size,
 					gfp_t gfp);
-struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size);
 struct buffer_head *create_empty_buffers(struct folio *folio,
 		unsigned long blocksize, unsigned long b_state);
 void end_buffer_read_sync(struct buffer_head *bh, int uptodate);
-- 
2.47.3


  parent reply	other threads:[~2026-09-14  4:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14  2:23 [PATCH v4 00/16] Remove PG_private by using page/folio->private checks instead Zi Yan
2026-09-14  2:24 ` [PATCH v4 13/16] md/md-bitmap: replace PagePrivate() with page_private() Zi Yan
2026-09-14  2:24 ` [PATCH v4 14/16] buffer: replace page_buffer() with page_private() and delete it Zi Yan
2026-09-14  3:39 ` [PATCH v4 00/16] Remove PG_private by using page/folio->private checks instead Andrew Morton
2026-09-15 17:16   ` Zi Yan
2026-09-14  4:18 ` Matthew Wilcox (Oracle) [this message]
2026-09-14  4:27   ` [PATCH 1/3] md: Use folio_alloc_buffers() sashiko-bot
2026-09-14 13:12   ` David Hildenbrand (Arm)
2026-09-14 13:17     ` Matthew Wilcox
2026-09-14 13:20       ` David Hildenbrand (Arm)
2026-09-14 14:36         ` Zi Yan
2026-09-14  4:18 ` [PATCH 2/3] md: Use folio APIs in free_page() Matthew Wilcox (Oracle)
2026-09-14  4:31   ` sashiko-bot
2026-09-14 16:21     ` Matthew Wilcox
2026-09-14 16:25       ` Zi Yan
2026-09-14 13:13   ` David Hildenbrand (Arm)
2026-09-14  4:18 ` [PATCH 3/3] md: Remove the last use of page_buffers() Matthew Wilcox (Oracle)
2026-09-14  4:29   ` sashiko-bot
2026-09-14 13:14   ` David Hildenbrand (Arm)
2026-09-14  4:21 ` [PATCH v4 00/16] Remove PG_private by using page/folio->private checks instead Matthew Wilcox
2026-09-14 13:10   ` David Hildenbrand (Arm)
2026-09-14 15:30 ` [f2fs-dev] " patchwork-bot+f2fs

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=20260914041830.2072626-1-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=ziy@nvidia.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