public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 09/12] btrfs: Make btrfs_find_ordered_sum take btrfs_inode
Date: Mon, 31 Aug 2020 14:42:46 +0300	[thread overview]
Message-ID: <20200831114249.8360-10-nborisov@suse.com> (raw)
In-Reply-To: <20200831114249.8360-1-nborisov@suse.com>

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/file-item.c    |  4 ++--
 fs/btrfs/ordered-data.c | 19 +++++++++----------
 fs/btrfs/ordered-data.h |  4 ++--
 3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 7d5ec71615b8..8f4f2bd6d9b9 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -318,8 +318,8 @@ blk_status_t btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio,
 
 		if (page_offsets)
 			offset = page_offset(bvec.bv_page) + bvec.bv_offset;
-		count = btrfs_find_ordered_sum(inode, offset, disk_bytenr,
-					       csum, nblocks);
+		count = btrfs_find_ordered_sum(BTRFS_I(inode), offset,
+					       disk_bytenr, csum, nblocks);
 		if (count)
 			goto found;
 
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index d39a0fe4c463..c8a13d143877 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -861,20 +861,21 @@ btrfs_lookup_first_ordered_extent(struct btrfs_inode *inode, u64 file_offset)
  * try to find a checksum.  This is used because we allow pages to
  * be reclaimed before their checksum is actually put into the btree
  */
-int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr,
-			   u8 *sum, int len)
+int btrfs_find_ordered_sum(struct btrfs_inode *inode, u64 offset,
+			   u64 disk_bytenr, u8 *sum, int len)
 {
-	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+	struct btrfs_fs_info *fs_info = inode->root->fs_info;
 	struct btrfs_ordered_sum *ordered_sum;
 	struct btrfs_ordered_extent *ordered;
-	struct btrfs_ordered_inode_tree *tree = &BTRFS_I(inode)->ordered_tree;
+	struct btrfs_ordered_inode_tree *tree = &inode->ordered_tree;
 	unsigned long num_sectors;
 	unsigned long i;
-	u32 sectorsize = btrfs_inode_sectorsize(BTRFS_I(inode));
+	u32 sectorsize = btrfs_inode_sectorsize(inode);
+	const u8 blocksize_bits = inode->vfs_inode.i_sb->s_blocksize_bits;
 	const u16 csum_size = btrfs_super_csum_size(fs_info->super_copy);
 	int index = 0;
 
-	ordered = btrfs_lookup_ordered_extent(BTRFS_I(inode), offset);
+	ordered = btrfs_lookup_ordered_extent(inode, offset);
 	if (!ordered)
 		return 0;
 
@@ -882,10 +883,8 @@ int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr,
 	list_for_each_entry_reverse(ordered_sum, &ordered->list, list) {
 		if (disk_bytenr >= ordered_sum->bytenr &&
 		    disk_bytenr < ordered_sum->bytenr + ordered_sum->len) {
-			i = (disk_bytenr - ordered_sum->bytenr) >>
-			    inode->i_sb->s_blocksize_bits;
-			num_sectors = ordered_sum->len >>
-				      inode->i_sb->s_blocksize_bits;
+			i = (disk_bytenr - ordered_sum->bytenr) >> blocksize_bits;
+			num_sectors = ordered_sum->len >> blocksize_bits;
 			num_sectors = min_t(int, len - index, num_sectors - i);
 			memcpy(sum + index, ordered_sum->sums + i * csum_size,
 			       num_sectors * csum_size);
diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h
index 1610195c6097..6a1d5bf5aee3 100644
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -185,8 +185,8 @@ struct btrfs_ordered_extent *btrfs_lookup_ordered_range(
 		u64 len);
 void btrfs_get_ordered_extents_for_logging(struct btrfs_inode *inode,
 					   struct list_head *list);
-int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr,
-			   u8 *sum, int len);
+int btrfs_find_ordered_sum(struct btrfs_inode *inode, u64 offset,
+			   u64 disk_bytenr, u8 *sum, int len);
 u64 btrfs_wait_ordered_extents(struct btrfs_root *root, u64 nr,
 			       const u64 range_start, const u64 range_len);
 void btrfs_wait_ordered_roots(struct btrfs_fs_info *fs_info, u64 nr,
-- 
2.17.1


  parent reply	other threads:[~2020-08-31 11:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31 11:42 [PATCH 00/12] Another batch of inode vs btrfs_inode cleanups Nikolay Borisov
2020-08-31 11:42 ` [PATCH 01/12] btrfs: Make inode_tree_del take btrfs_inode Nikolay Borisov
2020-08-31 12:03   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 02/12] btrfs: Make btrfs_lookup_first_ordered_extent " Nikolay Borisov
2020-08-31 12:09   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 03/12] btrfs: Make ordered extent tracepoint " Nikolay Borisov
2020-08-31 12:14   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 04/12] btrfs: Make btrfs_dec_test_ordered_pending " Nikolay Borisov
2020-08-31 12:19   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 05/12] btrfs: Convert btrfs_inode_sectorsize to " Nikolay Borisov
2020-08-31 12:20   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 06/12] btrfs: Make btrfs_invalidatepage work on btrfs_inode Nikolay Borisov
2020-08-31 13:24   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 07/12] btrfs: Make btrfs_writepage_endio_finish_ordered btrfs_inode-centric Nikolay Borisov
2020-08-31 12:23   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 08/12] btrfs: Make get_extent_skip_holes take btrfs_inode Nikolay Borisov
2020-08-31 12:26   ` Johannes Thumshirn
2020-08-31 11:42 ` Nikolay Borisov [this message]
2020-08-31 13:14   ` [PATCH 09/12] btrfs: Make btrfs_find_ordered_sum " Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 10/12] btrfs: Make copy_inline_to_page " Nikolay Borisov
2020-08-31 13:18   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 11/12] btrfs: Make btrfs_zero_range_check_range_boundary " Nikolay Borisov
2020-08-31 13:20   ` Johannes Thumshirn
2020-08-31 11:42 ` [PATCH 12/12] btrfs: Make extent_fiemap take btrfs_iode Nikolay Borisov
2020-08-31 13:21   ` Johannes Thumshirn
2020-08-31 15:43 ` [PATCH 00/12] Another batch of inode vs btrfs_inode cleanups Josef Bacik
2020-09-01 14:13 ` 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=20200831114249.8360-10-nborisov@suse.com \
    --to=nborisov@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