From: Christoph Hellwig <hch@lst.de>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: [PATCH 3/6] btrfs: directly wait for buffer writeback completion in btrfs_wait_buffers
Date: Mon, 15 May 2023 21:22:53 +0200 [thread overview]
Message-ID: <20230515192256.29006-4-hch@lst.de> (raw)
In-Reply-To: <20230515192256.29006-1-hch@lst.de>
Don't bother to got to filemap_fdatawait_range to look up each page in an
extent_buffer and then wait for writeback completion on each page, but
instead just call wait_on_extent_buffer_writeback on the buffer. All
write errors are propagated through the EXTENT_BUFFER_WRITE_ERR bit on
the extent_buffer itself, so there is no need to check for per-page
errors either.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/btrfs/extent_buffer.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/extent_buffer.c b/fs/btrfs/extent_buffer.c
index d20fc0d113968f..70a6a5f2e0e0a8 100644
--- a/fs/btrfs/extent_buffer.c
+++ b/fs/btrfs/extent_buffer.c
@@ -63,19 +63,15 @@ int btrfs_write_buffers(struct btrfs_fs_info *fs_info, struct list_head *list)
int btrfs_wait_buffers(struct btrfs_fs_info *fs_info, struct list_head *list)
{
- struct address_space *mapping = fs_info->btree_inode->i_mapping;
struct dirty_buffer *db;
- int werr = 0, err;
+ int werr = 0;
while ((db = list_first_entry_or_null(list, struct dirty_buffer,
wb_entry))) {
list_del_init(&db->wb_entry);
- err = filemap_fdatawait_range(mapping, db->eb->start,
- db->eb->start + db->eb->len - 1);
- if (err)
- werr = err;
- if (!werr && test_bit(EXTENT_BUFFER_WRITE_ERR, &db->eb->bflags))
+ wait_on_extent_buffer_writeback(db->eb);
+ if (test_bit(EXTENT_BUFFER_WRITE_ERR, &db->eb->bflags))
werr = -EIO;
free_extent_buffer(db->eb);
kfree(db);
--
2.39.2
next prev parent reply other threads:[~2023-05-15 19:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-15 19:22 simplify dirty buffer tracking Christoph Hellwig
2023-05-15 19:22 ` [PATCH 1/6] btrfs: use a linked list for tracking per-transaction/log dirty buffers Christoph Hellwig
2023-05-17 10:40 ` Filipe Manana
2023-05-17 12:21 ` Christoph Hellwig
2023-05-17 16:24 ` Filipe Manana
2023-05-17 16:37 ` Christoph Hellwig
2023-05-15 19:22 ` [PATCH 2/6] btrfs: remove convert_extent_bit Christoph Hellwig
2023-05-15 19:22 ` Christoph Hellwig [this message]
2023-05-15 19:22 ` [PATCH 4/6] btrfs: move dropping the bg reference out of submit_eb_page Christoph Hellwig
2023-05-15 19:22 ` [PATCH 5/6] btrfs: move locking and write pointer checking into write_one_eb Christoph Hellwig
2023-05-15 19:22 ` [PATCH 6/6] btrfs: bypass filemap_fdatawrite_range in btrfs_write_buffers Christoph Hellwig
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=20230515192256.29006-4-hch@lst.de \
--to=hch@lst.de \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@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