summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-10-09 11:55:26 -0400
committerChris Mason <chris.mason@oracle.com>2008-10-09 11:55:26 -0400
commit9559e0b09ed75239a4c595bedb2c5bf363fa00e9 (patch)
treefb915870af956ed818079ab1b04f6670955f459a
parent5986faaf479a38b0ebd2872e880d0bd81481d95b (diff)
downloadbtrfs-progs-9559e0b09ed75239a4c595bedb2c5bf363fa00e9.tar.gz
Count space allocated to file in bytes
This patch updates btrfs-progs for counting space allocated to file in bytes. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
-rw-r--r--ctree.h8
-rw-r--r--utils.c4
2 files changed, 6 insertions, 6 deletions
diff --git a/ctree.h b/ctree.h
index 90bd9407..7dc00e87 100644
--- a/ctree.h
+++ b/ctree.h
@@ -387,7 +387,7 @@ struct btrfs_inode_item {
/* transid that last touched this inode */
__le64 transid;
__le64 size;
- __le64 nblocks;
+ __le64 nbytes;
__le64 block_group;
__le32 nlink;
__le32 uid;
@@ -828,7 +828,7 @@ BTRFS_SETGET_FUNCS(inode_ref_index, struct btrfs_inode_ref, index, 64);
BTRFS_SETGET_FUNCS(inode_generation, struct btrfs_inode_item, generation, 64);
BTRFS_SETGET_FUNCS(inode_transid, struct btrfs_inode_item, transid, 64);
BTRFS_SETGET_FUNCS(inode_size, struct btrfs_inode_item, size, 64);
-BTRFS_SETGET_FUNCS(inode_nblocks, struct btrfs_inode_item, nblocks, 64);
+BTRFS_SETGET_FUNCS(inode_nbytes, struct btrfs_inode_item, nbytes, 64);
BTRFS_SETGET_FUNCS(inode_block_group, struct btrfs_inode_item, block_group, 64);
BTRFS_SETGET_FUNCS(inode_nlink, struct btrfs_inode_item, nlink, 32);
BTRFS_SETGET_FUNCS(inode_uid, struct btrfs_inode_item, uid, 32);
@@ -843,8 +843,8 @@ BTRFS_SETGET_STACK_FUNCS(stack_inode_generation,
struct btrfs_inode_item, generation, 64);
BTRFS_SETGET_STACK_FUNCS(stack_inode_size,
struct btrfs_inode_item, size, 64);
-BTRFS_SETGET_STACK_FUNCS(stack_inode_nblocks,
- struct btrfs_inode_item, nblocks, 64);
+BTRFS_SETGET_STACK_FUNCS(stack_inode_nbytes,
+ struct btrfs_inode_item, nbytes, 64);
BTRFS_SETGET_STACK_FUNCS(stack_inode_block_group,
struct btrfs_inode_item, block_group, 64);
BTRFS_SETGET_STACK_FUNCS(stack_inode_nlink,
diff --git a/utils.c b/utils.c
index d2cbebc1..6b76dd3c 100644
--- a/utils.c
+++ b/utils.c
@@ -126,7 +126,7 @@ int make_btrfs(int fd, const char *device, const char *label,
btrfs_set_stack_inode_generation(inode_item, 1);
btrfs_set_stack_inode_size(inode_item, 3);
btrfs_set_stack_inode_nlink(inode_item, 1);
- btrfs_set_stack_inode_nblocks(inode_item, 1);
+ btrfs_set_stack_inode_nbytes(inode_item, leafsize);
btrfs_set_stack_inode_mode(inode_item, S_IFDIR | 0755);
btrfs_set_root_refs(&root_item, 1);
btrfs_set_root_used(&root_item, leafsize);
@@ -543,7 +543,7 @@ int btrfs_make_root_dir(struct btrfs_trans_handle *trans,
btrfs_set_stack_inode_generation(&inode_item, trans->transid);
btrfs_set_stack_inode_size(&inode_item, 0);
btrfs_set_stack_inode_nlink(&inode_item, 1);
- btrfs_set_stack_inode_nblocks(&inode_item, 1);
+ btrfs_set_stack_inode_nbytes(&inode_item, root->leafsize);
btrfs_set_stack_inode_mode(&inode_item, S_IFDIR | 0555);
if (root->fs_info->tree_root == root)