From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 2/2] btrfs: move the mapping_set_error() out of the loop in end_bbio_data_write()
Date: Tue, 3 Mar 2026 18:45:10 +1030 [thread overview]
Message-ID: <3908171012ed88b5d1bff3c9d5c77a0a77965bd4.1772525669.git.wqu@suse.com> (raw)
In-Reply-To: <cover.1772525669.git.wqu@suse.com>
Previously we have to call mapping_set_error() inside the
for_each_folio_all() loop, because we do not have a better way to grab
an inode, other than through folio->mapping.
But nowadays every btrfs_bio has its inode member populated, thus we can
easily grab the inode and its i_mapping easily, without the help from a
folio.
Now we can move that mapping_set_error() out of the loop, and use
bbio->inode to grab the i_mapping.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
fs/btrfs/extent_io.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index de6e25475ce1..f972c1580374 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -529,14 +529,14 @@ static void end_bbio_data_write(struct btrfs_bio *bbio)
u32 len = fi.length;
bio_size += len;
- if (error)
- mapping_set_error(folio->mapping, error);
-
ASSERT(btrfs_folio_test_ordered(fs_info, folio, start, len));
btrfs_folio_clear_ordered(fs_info, folio, start, len);
btrfs_folio_clear_writeback(fs_info, folio, start, len);
}
+ if (error)
+ mapping_set_error(bbio->inode->vfs_inode.i_mapping, error);
+
btrfs_finish_ordered_extent(bbio->ordered, bbio->file_offset, bio_size, !error);
bio_put(bio);
}
--
2.53.0
next prev parent reply other threads:[~2026-03-03 8:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-03 8:15 [PATCH 0/2] btrfs: trivial cleanups in end_bbio_data_write() Qu Wenruo
2026-03-03 8:15 ` [PATCH 1/2] btrfs: remove the alignment check " Qu Wenruo
2026-03-04 3:20 ` David Sterba
2026-03-03 8:15 ` Qu Wenruo [this message]
2026-03-04 3:29 ` [PATCH 0/2] btrfs: trivial cleanups " David Sterba
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=3908171012ed88b5d1bff3c9d5c77a0a77965bd4.1772525669.git.wqu@suse.com \
--to=wqu@suse.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