summaryrefslogtreecommitdiff
path: root/volumes.c
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2017-05-18 10:09:10 +0800
committerDavid Sterba <dsterba@suse.com>2017-07-03 13:35:10 +0200
commitaca37c79153123f39359cdd494f1065a103ed33b (patch)
tree0db3874e283a5a25b2174a9ab3d00a1cf89fcc9a /volumes.c
parenta124232f5d05446a03f7861451968eafe878c66d (diff)
btrfs-progs: Refactor sectorsize users in volumes.c
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Diffstat (limited to 'volumes.c')
-rw-r--r--volumes.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/volumes.c b/volumes.c
index 62e23ae..8fc2955 100644
--- a/volumes.c
+++ b/volumes.c
@@ -1060,9 +1060,9 @@ again:
btrfs_set_stack_chunk_num_stripes(chunk, num_stripes);
btrfs_set_stack_chunk_io_align(chunk, stripe_len);
btrfs_set_stack_chunk_io_width(chunk, stripe_len);
- btrfs_set_stack_chunk_sector_size(chunk, extent_root->sectorsize);
+ btrfs_set_stack_chunk_sector_size(chunk, info->sectorsize);
btrfs_set_stack_chunk_sub_stripes(chunk, sub_stripes);
- map->sector_size = extent_root->sectorsize;
+ map->sector_size = info->sectorsize;
map->stripe_len = stripe_len;
map->io_align = stripe_len;
map->io_width = stripe_len;
@@ -1123,7 +1123,7 @@ int btrfs_alloc_data_chunk(struct btrfs_trans_handle *trans,
key.objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
key.type = BTRFS_CHUNK_ITEM_KEY;
if (convert) {
- if (*start != round_down(*start, extent_root->sectorsize)) {
+ if (*start != round_down(*start, info->sectorsize)) {
error("DATA chunk start not sectorsize aligned: %llu",
(unsigned long long)*start);
return -EINVAL;
@@ -1188,9 +1188,9 @@ int btrfs_alloc_data_chunk(struct btrfs_trans_handle *trans,
btrfs_set_stack_chunk_num_stripes(chunk, num_stripes);
btrfs_set_stack_chunk_io_align(chunk, stripe_len);
btrfs_set_stack_chunk_io_width(chunk, stripe_len);
- btrfs_set_stack_chunk_sector_size(chunk, extent_root->sectorsize);
+ btrfs_set_stack_chunk_sector_size(chunk, info->sectorsize);
btrfs_set_stack_chunk_sub_stripes(chunk, sub_stripes);
- map->sector_size = extent_root->sectorsize;
+ map->sector_size = info->sectorsize;
map->stripe_len = stripe_len;
map->io_align = stripe_len;
map->io_width = stripe_len;
@@ -1686,6 +1686,7 @@ int btrfs_check_chunk_valid(struct btrfs_root *root,
u16 sub_stripes;
u64 type;
u32 chunk_ondisk_size;
+ u32 sectorsize = root->fs_info->sectorsize;
length = btrfs_chunk_length(leaf, chunk);
stripe_len = btrfs_chunk_stripe_len(leaf, chunk);
@@ -1696,16 +1697,16 @@ int btrfs_check_chunk_valid(struct btrfs_root *root,
/*
* These valid checks may be insufficient to cover every corner cases.
*/
- if (!IS_ALIGNED(logical, root->sectorsize)) {
+ if (!IS_ALIGNED(logical, sectorsize)) {
error("invalid chunk logical %llu", logical);
return -EIO;
}
- if (btrfs_chunk_sector_size(leaf, chunk) != root->sectorsize) {
+ if (btrfs_chunk_sector_size(leaf, chunk) != sectorsize) {
error("invalid chunk sectorsize %llu",
(unsigned long long)btrfs_chunk_sector_size(leaf, chunk));
return -EIO;
}
- if (!length || !IS_ALIGNED(length, root->sectorsize)) {
+ if (!length || !IS_ALIGNED(length, sectorsize)) {
error("invalid chunk length %llu", length);
return -EIO;
}