aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-10-29 14:49:05 -0400
committerChris Mason <chris.mason@oracle.com>2008-10-29 14:49:05 -0400
commit84234f3a1f7c532e4afeba03cc8e7e4a8a5277ea (patch)
treec41f249b448f28b648b21c3898d0763b9c67ca6a /fs/btrfs/tree-log.c
parent2517920135b0d29e70453e5b03d70d7b94207df3 (diff)
Btrfs: 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 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 835daed5561f..e0201c3a7dc9 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -117,6 +117,7 @@ int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
117 inode_item->mode = cpu_to_le32(S_IFDIR | 0755); 117 inode_item->mode = cpu_to_le32(S_IFDIR | 0755);
118 118
119 btrfs_set_root_bytenr(&root_item, leaf->start); 119 btrfs_set_root_bytenr(&root_item, leaf->start);
120 btrfs_set_root_generation(&root_item, trans->transid);
120 btrfs_set_root_level(&root_item, 0); 121 btrfs_set_root_level(&root_item, 0);
121 btrfs_set_root_refs(&root_item, 0); 122 btrfs_set_root_refs(&root_item, 0);
122 btrfs_set_root_used(&root_item, 0); 123 btrfs_set_root_used(&root_item, 0);
@@ -2065,6 +2066,7 @@ static int update_log_root(struct btrfs_trans_handle *trans,
2065 return 0; 2066 return 0;
2066 2067
2067 btrfs_set_root_bytenr(&log->root_item, log->node->start); 2068 btrfs_set_root_bytenr(&log->root_item, log->node->start);
2069 btrfs_set_root_generation(&log->root_item, trans->transid);
2068 btrfs_set_root_level(&log->root_item, btrfs_header_level(log->node)); 2070 btrfs_set_root_level(&log->root_item, btrfs_header_level(log->node));
2069 ret = btrfs_update_root(trans, log->fs_info->log_root_tree, 2071 ret = btrfs_update_root(trans, log->fs_info->log_root_tree,
2070 &log->root_key, &log->root_item); 2072 &log->root_key, &log->root_item);