From: Zhen Ni <zhen.ni@easystack.cn>
To: clm@fb.com, dsterba@suse.com, Johannes.Thumshirn@wdc.com
Cc: linux-btrfs@vger.kernel.org, Zhen Ni <zhen.ni@easystack.cn>
Subject: [PATCH v2] btrfs: replace is_data_bbio() with is_data_inode() for direct usage
Date: Mon, 22 Dec 2025 11:59:42 +0800 [thread overview]
Message-ID: <20251222035942.1482587-1-zhen.ni@easystack.cn> (raw)
After commit 81cea6cd7041 ("btrfs: remove btrfs_bio::fs_info by
extracting it from btrfs_bio::inode"), the btrfs_bio::inode field is
mandatory for all btrfs_bio allocations. The NULL check is redundant and
can be removed.
Replace all calls to is_data_bbio() in bio.c
Link: https://lore.kernel.org/linux-btrfs/20251219084316.1164580-1-zhen.ni@easystack.cn
Suggested-by: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
---
Changes in v2:
- Replace all calls to is_data_bbio() in bio.c
---
fs/btrfs/bio.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
index fa1d321a2fb8..f48911a1b6d5 100644
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -26,15 +26,10 @@ struct btrfs_failed_bio {
atomic_t repair_count;
};
-/* Is this a data path I/O that needs storage layer checksum and repair? */
-static inline bool is_data_bbio(const struct btrfs_bio *bbio)
-{
- return bbio->inode && is_data_inode(bbio->inode);
-}
-
static bool bbio_has_ordered_extent(const struct btrfs_bio *bbio)
{
- return is_data_bbio(bbio) && btrfs_op(&bbio->bio) == BTRFS_MAP_WRITE;
+ return is_data_inode(bbio->inode) &&
+ btrfs_op(&bbio->bio) == BTRFS_MAP_WRITE;
}
/*
@@ -372,7 +367,7 @@ static void simple_end_io_work(struct work_struct *work)
if (bio_op(bio) == REQ_OP_READ) {
/* Metadata reads are checked and repaired by the submitter. */
- if (is_data_bbio(bbio))
+ if (is_data_inode(bbio->inode))
return btrfs_check_read_bio(bbio, bbio->bio.bi_private);
return btrfs_bio_end_io(bbio, bbio->bio.bi_status);
}
@@ -406,7 +401,7 @@ static void btrfs_raid56_end_io(struct bio *bio)
btrfs_bio_counter_dec(bioc->fs_info);
bbio->mirror_num = bioc->mirror_num;
- if (bio_op(bio) == REQ_OP_READ && is_data_bbio(bbio))
+ if (bio_op(bio) == REQ_OP_READ && is_data_inode(bbio->inode))
btrfs_check_read_bio(bbio, NULL);
else
btrfs_bio_end_io(bbio, bbio->bio.bi_status);
@@ -772,7 +767,7 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
* our bio to the physical disk location, so we need to save the
* original bytenr so we know what we're checksumming.
*/
- if (bio_op(bio) == REQ_OP_WRITE && is_data_bbio(bbio))
+ if (bio_op(bio) == REQ_OP_WRITE && is_data_inode(bbio->inode))
bbio->orig_logical = logical;
map_length = min(map_length, length);
@@ -796,7 +791,7 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
* Save the iter for the end_io handler and preload the checksums for
* data reads.
*/
- if (bio_op(bio) == REQ_OP_READ && is_data_bbio(bbio)) {
+ if (bio_op(bio) == REQ_OP_READ && is_data_inode(bbio->inode)) {
bbio->saved_iter = bio->bi_iter;
ret = btrfs_lookup_bio_sums(bbio);
status = errno_to_blk_status(ret);
@@ -810,7 +805,7 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
bio->bi_opf |= REQ_OP_ZONE_APPEND;
}
- if (is_data_bbio(bbio) && bioc && bioc->use_rst) {
+ if (is_data_inode(bbio->inode) && bioc && bioc->use_rst) {
/*
* No locking for the list update, as we only add to
* the list in the I/O submission path, and list
--
2.20.1
next reply other threads:[~2025-12-22 5:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-22 3:59 Zhen Ni [this message]
2026-09-07 17:41 ` [PATCH v2] btrfs: replace is_data_bbio() with is_data_inode() for direct usage 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=20251222035942.1482587-1-zhen.ni@easystack.cn \
--to=zhen.ni@easystack.cn \
--cc=Johannes.Thumshirn@wdc.com \
--cc=clm@fb.com \
--cc=dsterba@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