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 1/2] btrfs: factor out a btrfs_inode_is_nodatasum helper
Date: Mon, 5 Jun 2023 10:45:18 +0200 [thread overview]
Message-ID: <20230605084519.580346-2-hch@lst.de> (raw)
In-Reply-To: <20230605084519.580346-1-hch@lst.de>
Split out a helper to check if an inode needs nodatasum treatment.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/btrfs/bio.c | 3 +--
fs/btrfs/btrfs_inode.h | 7 +++++++
fs/btrfs/file-item.c | 3 +--
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
index c9b4aa339b4b07..627d06fbb4c425 100644
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -659,8 +659,7 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
* Csum items for reloc roots have already been cloned at this
* point, so they are handled as part of the no-checksum case.
*/
- if (inode && !(inode->flags & BTRFS_INODE_NODATASUM) &&
- !test_bit(BTRFS_FS_STATE_NO_CSUMS, &fs_info->fs_state) &&
+ if (inode && !btrfs_inode_is_nodatasum(inode) &&
!btrfs_is_data_reloc_root(inode->root)) {
if (should_async_write(bbio) &&
btrfs_wq_submit_bio(bbio, bioc, &smap, mirror_num))
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index 8abf96cfea8fae..713439d62adda3 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -535,4 +535,11 @@ void btrfs_update_inode_bytes(struct btrfs_inode *inode, const u64 add_bytes,
const u64 del_bytes);
void btrfs_assert_inode_range_clean(struct btrfs_inode *inode, u64 start, u64 end);
+static inline bool btrfs_inode_is_nodatasum(struct btrfs_inode *inode)
+{
+ return (inode->flags & BTRFS_INODE_NODATASUM) ||
+ test_bit(BTRFS_FS_STATE_NO_CSUMS,
+ &inode->root->fs_info->fs_state);
+}
+
#endif
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 2e7d5ec6c9a68c..5e6603e76e5ac0 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -355,8 +355,7 @@ blk_status_t btrfs_lookup_bio_sums(struct btrfs_bio *bbio)
blk_status_t ret = BLK_STS_OK;
u32 bio_offset = 0;
- if ((inode->flags & BTRFS_INODE_NODATASUM) ||
- test_bit(BTRFS_FS_STATE_NO_CSUMS, &fs_info->fs_state))
+ if (btrfs_inode_is_nodatasum(inode))
return BLK_STS_OK;
/*
--
2.39.2
next prev parent reply other threads:[~2023-06-05 8:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 8:45 fix nodatasum I/O for zone devices Christoph Hellwig
2023-06-05 8:45 ` Christoph Hellwig [this message]
2023-06-06 17:08 ` [PATCH 1/2] btrfs: factor out a btrfs_inode_is_nodatasum helper David Sterba
2023-06-05 8:45 ` [PATCH 2/2] btrfs: allocate dummy ordereded_sums objects for nocsum I/O on zoned file systems Christoph Hellwig
2023-06-06 17:11 ` David Sterba
2023-06-07 5:30 ` Christoph Hellwig
2023-06-05 10:05 ` fix nodatasum I/O for zone devices Johannes Thumshirn
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=20230605084519.580346-2-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;
as well as URLs for NNTP newsgroup(s).