Convert root->sectorsize/nodesize users in btrfs-corrupt-block.
This provides the basis to further refactor incorrect btrfs_root
parameter to btrfs_fs_info parameter.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
{
struct extent_buffer *eb;
{
struct extent_buffer *eb;
- eb = read_tree_block(root, bytenr, root->nodesize, 0);
+ eb = read_tree_block(root, bytenr, root->fs_info->nodesize, 0);
if (!extent_buffer_uptodate(eb))
return -EIO;;
if (!extent_buffer_uptodate(eb))
return -EIO;;
struct extent_buffer *next;
next = read_tree_block(root, btrfs_node_blockptr(eb, i),
struct extent_buffer *next;
next = read_tree_block(root, btrfs_node_blockptr(eb, i),
+ root->fs_info->nodesize,
btrfs_node_ptr_generation(eb, i));
if (!extent_buffer_uptodate(next))
continue;
btrfs_node_ptr_generation(eb, i));
if (!extent_buffer_uptodate(next))
continue;
- eb = read_tree_block(root, block, root->nodesize, 0);
+ eb = read_tree_block(root, block, root->fs_info->nodesize, 0);
if (!extent_buffer_uptodate(eb)) {
fprintf(stderr, "Couldn't read in tree block %s\n", field);
return -EINVAL;
if (!extent_buffer_uptodate(eb)) {
fprintf(stderr, "Couldn't read in tree block %s\n", field);
return -EINVAL;
print_usage(1);
if (bytes == 0)
print_usage(1);
if (bytes == 0)
- bytes = root->sectorsize;
+ bytes = root->fs_info->sectorsize;
- bytes = (bytes + root->sectorsize - 1) / root->sectorsize;
- bytes *= root->sectorsize;
+ bytes = round_up(bytes, root->fs_info->sectorsize);
while (bytes > 0) {
if (corrupt_block_keys) {
while (bytes > 0) {
if (corrupt_block_keys) {
struct extent_buffer *eb;
eb = btrfs_find_create_tree_block(root->fs_info,
struct extent_buffer *eb;
eb = btrfs_find_create_tree_block(root->fs_info,
- logical, root->sectorsize);
+ logical, root->fs_info->sectorsize);
if (!eb) {
error(
"not enough memory to allocate extent buffer for bytenr %llu",
if (!eb) {
error(
"not enough memory to allocate extent buffer for bytenr %llu",
- debug_corrupt_block(eb, root, logical, root->sectorsize,
- copy);
+ debug_corrupt_block(eb, root, logical,
+ root->fs_info->sectorsize, copy);
free_extent_buffer(eb);
}
free_extent_buffer(eb);
}
- logical += root->sectorsize;
- bytes -= root->sectorsize;
+ logical += root->fs_info->sectorsize;
+ bytes -= root->fs_info->sectorsize;