summaryrefslogtreecommitdiff
path: root/convert
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2017-05-18 10:13:27 +0800
committerDavid Sterba <dsterba@suse.com>2017-07-03 13:35:10 +0200
commitdf4ad8281069e3c2faf4771a04f94b9d01ff8ca2 (patch)
treee3429ebdec3bb28fe0e9e9b4f045086073258046 /convert
parent2b50d3b82ab8f776a00a62a6c9ca5bc61541163b (diff)
btrfs-progs: Refactor sectorsize users in convert/main.c
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Diffstat (limited to 'convert')
-rw-r--r--convert/main.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/convert/main.c b/convert/main.c
index c56382e9..bf050132 100644
--- a/convert/main.c
+++ b/convert/main.c
@@ -159,7 +159,7 @@ static int csum_disk_extent(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
u64 disk_bytenr, u64 num_bytes)
{
- u32 blocksize = root->sectorsize;
+ u32 blocksize = root->fs_info->sectorsize;
u64 offset;
char *buffer;
int ret = 0;
@@ -199,12 +199,12 @@ static int create_image_file_range(struct btrfs_trans_handle *trans,
int ret;
u32 datacsum = convert_flags & CONVERT_FLAG_DATACSUM;
- if (bytenr != round_down(bytenr, root->sectorsize)) {
+ if (bytenr != round_down(bytenr, root->fs_info->sectorsize)) {
error("bytenr not sectorsize aligned: %llu",
(unsigned long long)bytenr);
return -EINVAL;
}
- if (len != round_down(len, root->sectorsize)) {
+ if (len != round_down(len, root->fs_info->sectorsize)) {
error("length not sectorsize aligned: %llu",
(unsigned long long)len);
return -EINVAL;
@@ -293,7 +293,7 @@ static int create_image_file_range(struct btrfs_trans_handle *trans,
bg_cache->key.offset - bytenr);
}
- if (len != round_down(len, root->sectorsize)) {
+ if (len != round_down(len, root->fs_info->sectorsize)) {
error("remaining length not sectorsize aligned: %llu",
(unsigned long long)len);
return -EINVAL;
@@ -346,7 +346,7 @@ static int migrate_one_reserved_range(struct btrfs_trans_handle *trans,
cur_off = max(cache->start, cur_off);
cur_len = min(cache->start + cache->size, range_end(range)) -
cur_off;
- BUG_ON(cur_len < root->sectorsize);
+ BUG_ON(cur_len < root->fs_info->sectorsize);
/* reserve extent for the data */
ret = btrfs_reserve_extent(trans, root, cur_len, 0, 0, (u64)-1,
@@ -1011,7 +1011,8 @@ static int make_convert_data_block_groups(struct btrfs_trans_handle *trans,
*/
max_chunk_size = cfg->num_bytes / 10;
max_chunk_size = min((u64)(1024 * 1024 * 1024), max_chunk_size);
- max_chunk_size = round_down(max_chunk_size, extent_root->sectorsize);
+ max_chunk_size = round_down(max_chunk_size,
+ extent_root->fs_info->sectorsize);
for (cache = first_cache_extent(data_chunks); cache;
cache = next_cache_extent(cache)) {