u16 csum_size;
u32 sectorsize;
- u32 leafsize;
+ u32 nodesize;
u64 generation;
u64 chunk_root_generation;
generation);
/*
* According to the current kernel code, the following
- * case is impossble, or there is something wrong in
+ * case is impossible, or there is something wrong in
* the kernel code.
*/
if (memcmp(((void *)exist) + offset,
printf("DEVICE SCAN RESULT:\n");
printf("Filesystem Information:\n");
printf("\tsectorsize: %d\n", rc->sectorsize);
- printf("\tleafsize: %d\n", rc->leafsize);
+ printf("\tnodesize: %d\n", rc->nodesize);
printf("\ttree root generation: %llu\n", rc->generation);
printf("\tchunk root generation: %llu\n", rc->chunk_root_generation);
printf("\n");
btrfs_dev_extent_chunk_offset(l, dev_extent)) {
if (rc->verbose)
fprintf(stderr,
- "Device tree unmatch with chunks dev_extent[%llu, %llu], chunk[%llu, %llu]\n",
+ "Device tree mismatch with chunks dev_extent[%llu, %llu], chunk[%llu, %llu]\n",
btrfs_dev_extent_chunk_offset(l,
dev_extent),
btrfs_dev_extent_length(l, dev_extent),
if (chunk->type_flags != btrfs_disk_block_group_flags(l, bg_ptr)) {
if (rc->verbose)
fprintf(stderr,
- "Chunk[%llu, %llu]'s type(%llu) is differemt with Block Group's type(%llu)\n",
+ "Chunk[%llu, %llu]'s type(%llu) is different with Block Group's type(%llu)\n",
chunk->offset, chunk->length, chunk->type_flags,
btrfs_disk_block_group_flags(l, bg_ptr));
btrfs_release_path(&path);
if (ret)
return 1;
- buf = malloc(sizeof(*buf) + rc->leafsize);
+ buf = malloc(sizeof(*buf) + rc->nodesize);
if (!buf)
return -ENOMEM;
- buf->len = rc->leafsize;
+ buf->len = rc->nodesize;
bytenr = 0;
while (1) {
if (is_super_block_address(bytenr))
bytenr += rc->sectorsize;
- if (pread64(fd, buf->data, rc->leafsize, bytenr) <
- rc->leafsize)
+ if (pread64(fd, buf->data, rc->nodesize, bytenr) <
+ rc->nodesize)
break;
if (memcmp_extent_buffer(buf, rc->fs_devices->fsid,
break;
}
next_node:
- bytenr += rc->leafsize;
+ bytenr += rc->nodesize;
}
out:
close(fd);
key.type == BTRFS_METADATA_ITEM_KEY) {
old_val = btrfs_super_bytes_used(fs_info->super_copy);
if (key.type == BTRFS_METADATA_ITEM_KEY)
- old_val += root->leafsize;
+ old_val += root->nodesize;
else
old_val += key.offset;
btrfs_set_super_bytes_used(fs_info->super_copy,
if (min_devid > dev->devid)
min_devid = dev->devid;
}
- disk_key.objectid = BTRFS_DEV_ITEMS_OBJECTID;
- disk_key.type = BTRFS_DEV_ITEM_KEY;
- disk_key.offset = min_devid;
+ btrfs_set_disk_key_objectid(&disk_key, BTRFS_DEV_ITEMS_OBJECTID);
+ btrfs_set_disk_key_type(&disk_key, BTRFS_DEV_ITEM_KEY);
+ btrfs_set_disk_key_offset(&disk_key, min_devid);
cow = btrfs_alloc_free_block(trans, root, root->nodesize,
BTRFS_CHUNK_TREE_OBJECTID,
key.offset = chunk_rec->offset;
ret = btrfs_insert_item(trans, chunk_root, &key, chunk,
- btrfs_chunk_item_size(chunk->num_stripes));
+ btrfs_chunk_item_size(chunk_rec->num_stripes));
free(chunk);
return ret;
}
}
rc->sectorsize = btrfs_super_sectorsize(sb);
- rc->leafsize = btrfs_super_leafsize(sb);
+ rc->nodesize = btrfs_super_nodesize(sb);
rc->generation = btrfs_super_generation(sb);
rc->chunk_root_generation = btrfs_super_chunk_root_generation(sb);
rc->csum_size = btrfs_super_csum_size(sb);