From: Stefan Roesch <shr@fb.com>
To: <io-uring@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
<linux-block@vger.kernel.org>, <kernel-team@fb.com>
Cc: <shr@fb.com>
Subject: [PATCH v2 05/13] fs: split off __create_empty_buffers function
Date: Fri, 18 Feb 2022 11:57:31 -0800 [thread overview]
Message-ID: <20220218195739.585044-6-shr@fb.com> (raw)
In-Reply-To: <20220218195739.585044-1-shr@fb.com>
This splits off the function __create_empty_buffers() from the function
create_empty_buffers. The __create_empty_buffers has an additional gfp
parameter. This allows the caller to specify the allocation properties.
Signed-off-by: Stefan Roesch <shr@fb.com>
---
fs/buffer.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index 2858eaf433c8..648e1cba6da3 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1554,17 +1554,12 @@ void block_invalidatepage(struct page *page, unsigned int offset,
EXPORT_SYMBOL(block_invalidatepage);
-/*
- * We attach and possibly dirty the buffers atomically wrt
- * __set_page_dirty_buffers() via private_lock. try_to_free_buffers
- * is already excluded via the page lock.
- */
-void create_empty_buffers(struct page *page,
- unsigned long blocksize, unsigned long b_state)
+static void __create_empty_buffers(struct page *page, unsigned long blocksize,
+ unsigned long b_state, gfp_t gfp)
{
struct buffer_head *bh, *head, *tail;
- head = alloc_page_buffers(page, blocksize, true);
+ head = __alloc_page_buffers(page, blocksize, gfp);
bh = head;
do {
bh->b_state |= b_state;
@@ -1587,6 +1582,17 @@ void create_empty_buffers(struct page *page,
attach_page_private(page, head);
spin_unlock(&page->mapping->private_lock);
}
+/*
+ * We attach and possibly dirty the buffers atomically wrt
+ * __set_page_dirty_buffers() via private_lock. try_to_free_buffers
+ * is already excluded via the page lock.
+ */
+void create_empty_buffers(struct page *page,
+ unsigned long blocksize, unsigned long b_state)
+{
+ return __create_empty_buffers(page, blocksize, b_state,
+ GFP_NOFS | __GFP_ACCOUNT | __GFP_NOFAIL);
+}
EXPORT_SYMBOL(create_empty_buffers);
/**
--
2.30.2
next prev parent reply other threads:[~2022-02-18 19:58 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 19:57 [PATCH v2 00/13] Support sync buffered writes for io-uring Stefan Roesch
2022-02-18 19:57 ` [PATCH v2 01/13] fs: Add flags parameter to __block_write_begin_int Stefan Roesch
2022-02-18 19:59 ` Matthew Wilcox
2022-02-18 20:08 ` Stefan Roesch
2022-02-18 20:13 ` Matthew Wilcox
2022-02-18 20:14 ` Stefan Roesch
2022-02-18 20:22 ` Matthew Wilcox
2022-02-18 20:25 ` Stefan Roesch
2022-02-18 20:35 ` Matthew Wilcox
2022-02-18 20:39 ` Stefan Roesch
2022-02-18 19:57 ` [PATCH v2 02/13] mm: Introduce do_generic_perform_write Stefan Roesch
2022-02-18 19:57 ` [PATCH v2 03/13] mm: Add support for async buffered writes Stefan Roesch
2022-02-18 19:57 ` [PATCH v2 04/13] fs: split off __alloc_page_buffers function Stefan Roesch
2022-02-18 20:42 ` Matthew Wilcox
2022-02-18 20:50 ` Stefan Roesch
2022-02-19 7:35 ` Christoph Hellwig
2022-02-20 4:23 ` Matthew Wilcox
2022-02-20 4:38 ` Jens Axboe
2022-02-20 4:51 ` Jens Axboe
2022-02-22 8:18 ` Christoph Hellwig
2022-02-22 23:19 ` Jens Axboe
2022-02-18 19:57 ` Stefan Roesch [this message]
2022-02-18 19:57 ` [PATCH v2 06/13] fs: Add gfp_t parameter to create_page_buffers() Stefan Roesch
2022-02-21 0:18 ` kernel test robot
2022-02-18 19:57 ` [PATCH v2 07/13] fs: add support for async buffered writes Stefan Roesch
2022-02-18 19:57 ` [PATCH v2 08/13] io_uring: " Stefan Roesch
2022-02-18 19:57 ` [PATCH v2 09/13] io_uring: Add tracepoint for short writes Stefan Roesch
2022-02-18 19:57 ` [PATCH v2 10/13] sched: add new fields to task_struct Stefan Roesch
2022-02-18 19:57 ` [PATCH v2 11/13] mm: support write throttling for async buffered writes Stefan Roesch
2022-02-18 19:57 ` [PATCH v2 12/13] io_uring: " Stefan Roesch
2022-02-18 19:57 ` [PATCH v2 13/13] block: enable async buffered writes for block devices Stefan Roesch
2022-02-20 22:38 ` [PATCH v2 00/13] Support sync buffered writes for io-uring Dave Chinner
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=20220218195739.585044-6-shr@fb.com \
--to=shr@fb.com \
--cc=io-uring@vger.kernel.org \
--cc=kernel-team@fb.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
/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