mirror of
https://github.com/kdave/btrfs-progs
synced 2025-05-04 08:57:55 +00:00
btrfs-progs: Refactor sectorsize in convert/source-fs.c
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
This commit is contained in:
parent
caf9c18f66
commit
2b50d3b82a
@ -68,9 +68,10 @@ int block_iterate_proc(u64 disk_block, u64 file_block,
|
|||||||
int do_barrier;
|
int do_barrier;
|
||||||
struct btrfs_root *root = idata->root;
|
struct btrfs_root *root = idata->root;
|
||||||
struct btrfs_block_group_cache *cache;
|
struct btrfs_block_group_cache *cache;
|
||||||
u64 bytenr = disk_block * root->sectorsize;
|
u32 sectorsize = root->fs_info->sectorsize;
|
||||||
|
u64 bytenr = disk_block * sectorsize;
|
||||||
|
|
||||||
sb_region = intersect_with_sb(bytenr, root->sectorsize);
|
sb_region = intersect_with_sb(bytenr, sectorsize);
|
||||||
do_barrier = sb_region || disk_block >= idata->boundary;
|
do_barrier = sb_region || disk_block >= idata->boundary;
|
||||||
if ((idata->num_blocks > 0 && do_barrier) ||
|
if ((idata->num_blocks > 0 && do_barrier) ||
|
||||||
(file_block > idata->first_block + idata->num_blocks) ||
|
(file_block > idata->first_block + idata->num_blocks) ||
|
||||||
@ -102,7 +103,7 @@ int block_iterate_proc(u64 disk_block, u64 file_block,
|
|||||||
|
|
||||||
idata->first_block = file_block;
|
idata->first_block = file_block;
|
||||||
idata->disk_block = disk_block;
|
idata->disk_block = disk_block;
|
||||||
idata->boundary = bytenr / root->sectorsize;
|
idata->boundary = bytenr / sectorsize;
|
||||||
}
|
}
|
||||||
idata->num_blocks++;
|
idata->num_blocks++;
|
||||||
fail:
|
fail:
|
||||||
@ -195,9 +196,10 @@ int record_file_blocks(struct blk_iterate_data *data,
|
|||||||
struct btrfs_root *root = data->root;
|
struct btrfs_root *root = data->root;
|
||||||
struct btrfs_root *convert_root = data->convert_root;
|
struct btrfs_root *convert_root = data->convert_root;
|
||||||
struct btrfs_path path;
|
struct btrfs_path path;
|
||||||
u64 file_pos = file_block * root->sectorsize;
|
u32 sectorsize = root->fs_info->sectorsize;
|
||||||
u64 old_disk_bytenr = disk_block * root->sectorsize;
|
u64 file_pos = file_block * sectorsize;
|
||||||
u64 num_bytes = num_blocks * root->sectorsize;
|
u64 old_disk_bytenr = disk_block * sectorsize;
|
||||||
|
u64 num_bytes = num_blocks * sectorsize;
|
||||||
u64 cur_off = old_disk_bytenr;
|
u64 cur_off = old_disk_bytenr;
|
||||||
|
|
||||||
/* Hole, pass it to record_file_extent directly */
|
/* Hole, pass it to record_file_extent directly */
|
||||||
|
Loading…
Reference in New Issue
Block a user