static u64 total_csum_bytes = 0;
static u64 total_btree_blocks = 0;
static u64 btree_space_waste = 0;
+static u64 data_blocks_allocated = 0;
+static u64 data_blocks_referenced = 0;
struct extent_record {
struct btrfs_disk_key parent_key;
continue;
if (btrfs_file_extent_disk_blocknr(fi) == 0)
continue;
+
+ data_blocks_allocated +=
+ btrfs_file_extent_disk_num_blocks(fi);
+ data_blocks_referenced +=
+ btrfs_file_extent_num_blocks(fi);
ret = add_extent_rec(extent_radix, NULL, blocknr,
btrfs_file_extent_disk_blocknr(fi),
btrfs_file_extent_disk_num_blocks(fi),
(unsigned long long)total_btree_blocks);
printf("btree space waste bytes: %llu\n",
(unsigned long long)btree_space_waste);
+ printf("file data blocks allocated: %llu\n referenced %llu\n",
+ (unsigned long long)data_blocks_allocated,
+ (unsigned long long)data_blocks_referenced);
return ret;
}
switch (type) {
case BTRFS_INODE_ITEM_KEY:
ii = btrfs_item_ptr(l, i, struct btrfs_inode_item);
- printf("\t\tinode generation %llu size %llu block group %llu mode %o\n",
+ printf("\t\tinode generation %llu size %llu block group %llu mode %o links %u\n",
(unsigned long long)btrfs_inode_generation(ii),
(unsigned long long)btrfs_inode_size(ii),
(unsigned long long)btrfs_inode_block_group(ii),
- btrfs_inode_mode(ii));
+ btrfs_inode_mode(ii),
+ btrfs_inode_nlink(ii));
break;
case BTRFS_DIR_ITEM_KEY:
di = btrfs_item_ptr(l, i, struct btrfs_dir_item);