All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>, <dsterba@suse.cz>
Subject: [PATCH 20/32] btrfs-progs: Refactor sectorsizes users in file-item.c
Date: Thu, 18 May 2017 11:38:45 +0800	[thread overview]
Message-ID: <20170518033857.15002-21-quwenruo@cn.fujitsu.com> (raw)
In-Reply-To: <20170518033857.15002-1-quwenruo@cn.fujitsu.com>

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 file-item.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/file-item.c b/file-item.c
index 333fa339..6877a1a9 100644
--- a/file-item.c
+++ b/file-item.c
@@ -162,7 +162,8 @@ btrfs_lookup_csum(struct btrfs_trans_handle *trans,
 		if (found_key.type != BTRFS_EXTENT_CSUM_KEY)
 			goto fail;
 
-		csum_offset = (bytenr - found_key.offset) / root->sectorsize;
+		csum_offset = (bytenr - found_key.offset) /
+				root->fs_info->sectorsize;
 		csums_in_item = btrfs_item_size_nr(leaf, path->slots[0]);
 		csums_in_item /= csum_size;
 
@@ -195,6 +196,7 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans,
 	struct extent_buffer *leaf = NULL;
 	u64 csum_offset;
 	u32 csum_result = ~(u32)0;
+	u32 sectorsize = root->fs_info->sectorsize;
 	u32 nritems;
 	u32 ins_size;
 	u16 csum_size =
@@ -265,7 +267,7 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans,
 	path->slots[0]--;
 	leaf = path->nodes[0];
 	btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
-	csum_offset = (file_key.offset - found_key.offset) / root->sectorsize;
+	csum_offset = (file_key.offset - found_key.offset) / sectorsize;
 	if (found_key.objectid != BTRFS_EXTENT_CSUM_OBJECTID ||
 	    found_key.type != BTRFS_EXTENT_CSUM_KEY ||
 	    csum_offset >= MAX_CSUM_ITEMS(root, csum_size)) {
@@ -288,7 +290,7 @@ insert:
 	if (found_next) {
 		u64 tmp = min(alloc_end, next_offset);
 		tmp -= file_key.offset;
-		tmp /= root->sectorsize;
+		tmp /= sectorsize;
 		tmp = max((u64)1, tmp);
 		tmp = min(tmp, (u64)MAX_CSUM_ITEMS(root, csum_size));
 		ins_size = csum_size * tmp;
@@ -346,12 +348,12 @@ static noinline int truncate_one_csum(struct btrfs_root *root,
 		btrfs_super_csum_size(root->fs_info->super_copy);
 	u64 csum_end;
 	u64 end_byte = bytenr + len;
-	u32 blocksize = root->sectorsize;
+	u32 blocksize = root->fs_info->sectorsize;
 	int ret;
 
 	leaf = path->nodes[0];
 	csum_end = btrfs_item_size_nr(leaf, path->slots[0]) / csum_size;
-	csum_end *= root->sectorsize;
+	csum_end *= root->fs_info->sectorsize;
 	csum_end += key->offset;
 
 	if (key->offset < bytenr && csum_end <= end_byte) {
@@ -403,7 +405,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
 	int ret;
 	u16 csum_size =
 		btrfs_super_csum_size(root->fs_info->super_copy);
-	int blocksize = root->sectorsize;
+	int blocksize = root->fs_info->sectorsize;
 
 	root = root->fs_info->csum_root;
 
-- 
2.13.0




  parent reply	other threads:[~2017-05-18  3:39 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18  3:38 [PATCH 00/32] btrfs_fs_info refactoring Qu Wenruo
2017-05-18  3:38 ` [PATCH 01/32] btrfs-progs: Remove deprecated leafsize usage Qu Wenruo
2017-05-18  3:38 ` [PATCH 02/32] btrfs-progs: Introduce sectorsize nodesize and stripesize members for btrfs_fs_info Qu Wenruo
2017-05-18  3:38 ` [PATCH 03/32] btrfs-progs: Refactor block sizes users in disk-io.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 04/32] btrfs-progs: Refactor block sizes users in btrfs-corrupt-block.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 05/32] btrfs-progs: Refactor block sizes users in ctree.c and ctree.h Qu Wenruo
2017-05-18  3:38 ` [PATCH 06/32] btrfs-progs: Refactor block sizes users in btrfs-map-logical.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 07/32] btrfs-progs: Refactor block sizes users in chunk-recover.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 08/32] btrfs-progs: Refactor block sizes users in backref.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 09/32] btrfs-progs: Refactor block sizes users in cmds-restore.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 10/32] btrfs-progs: Refactor nodesize user in extent_io.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 11/32] btrfs-progs: Refactor nodesize users in image/main.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 12/32] btrfs-progs: Refactor block sizes users in cmds-check.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 13/32] btrfs-progs: Refactor nodesize user in btrfstune.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 14/32] btrfs-progs: Refactor nodesize users in utils.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 15/32] btrfs-progs: Refactor block sizes users in extent-tree.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 16/32] btrfs-progs: Refactor nodesize user in print-tree.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 17/32] btrfs-progs: Refactor nodesize users in qgroup-verify.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 18/32] btrfs-progs: Refactor nodesize users in cmds-inspect-tree-stats.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 19/32] btrfs-progs: Refactor sectorsize users in mkfs/main.c Qu Wenruo
2017-05-18  3:38 ` Qu Wenruo [this message]
2017-05-18  3:38 ` [PATCH 21/32] btrfs-progs: Refactor sectorsize users in free-space-cache.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 22/32] btrfs-progs: Refactor sectorsize users in file.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 23/32] btrfs-progs: Refactor sectorsize users in volumes.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 24/32] btrfs-progs: Refactor sectorsize users in free-space-tree.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 25/32] btrfs-progs: Refactor sectorsize in convert/source-fs.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 26/32] btrfs-progs: Refactor sectorsize users in convert/main.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 27/32] btrfs-progs: Refactor sectorsize users in convert/source-ext2.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 28/32] btrfs-progs: Refactor sectorsize users in cmds-inspect-dump-tree.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 29/32] btrfs-progs: Remove block size members in btrfs_root Qu Wenruo
2017-05-18  3:38 ` [PATCH 30/32] btrfs-progs: Refactor btrfs_root paramters in btrfs-corrupt-block.c Qu Wenruo
2017-05-18  3:38 ` [PATCH 31/32] btrfs-progs: Refactor read_tree_block to get rid of btrfs_root Qu Wenruo
2017-05-18  3:38 ` [PATCH 32/32] btrfs-progs: Refactor read_node_slot function to get rid of btrfs_root parameter Qu Wenruo
2017-05-29 18:07 ` [PATCH 00/32] btrfs_fs_info refactoring 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=20170518033857.15002-21-quwenruo@cn.fujitsu.com \
    --to=quwenruo@cn.fujitsu.com \
    --cc=dsterba@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.