summaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-10-29 14:07:47 -0400
committerChris Mason <chris.mason@oracle.com>2008-10-29 14:07:47 -0400
commit38702ea7c6456019702658a1524807439febbed3 (patch)
treeebc90212fda77d047b5bc2105a85c424626d2397 /utils.c
parentc830821ddf963037cee381fa004b3df0a5296a1b (diff)
Add root tree pointer transaction ids
This patch adds transaction IDs to root tree pointers. Transaction IDs in tree pointers are compared with the generation numbers in block headers when reading root blocks of trees. This can detect some types of IO errors. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/utils.c b/utils.c
index 6b76dd3c..fa3cef46 100644
--- a/utils.c
+++ b/utils.c
@@ -101,6 +101,7 @@ int make_btrfs(int fd, const char *device, const char *label,
btrfs_set_super_leafsize(&super, leafsize);
btrfs_set_super_nodesize(&super, nodesize);
btrfs_set_super_stripesize(&super, stripesize);
+ btrfs_set_super_chunk_root_generation(&super, 1);
if (label)
strcpy(super.label, label);
@@ -130,6 +131,7 @@ int make_btrfs(int fd, const char *device, const char *label,
btrfs_set_stack_inode_mode(inode_item, S_IFDIR | 0755);
btrfs_set_root_refs(&root_item, 1);
btrfs_set_root_used(&root_item, leafsize);
+ btrfs_set_root_generation(&root_item, 1);
memset(&disk_key, 0, sizeof(disk_key));
btrfs_set_disk_key_type(&disk_key, BTRFS_ROOT_ITEM_KEY);