aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
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/ctree.h
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/ctree.h')
-rw-r--r--fs/btrfs/ctree.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index fdba4f1b634e..0621ab90b1a5 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -297,6 +297,7 @@ struct btrfs_super_block {
297 __le32 leafsize; 297 __le32 leafsize;
298 __le32 stripesize; 298 __le32 stripesize;
299 __le32 sys_chunk_array_size; 299 __le32 sys_chunk_array_size;
300 __le64 chunk_root_generation;
300 u8 root_level; 301 u8 root_level;
301 u8 chunk_root_level; 302 u8 chunk_root_level;
302 u8 log_root_level; 303 u8 log_root_level;
@@ -448,6 +449,7 @@ struct btrfs_dir_item {
448 449
449struct btrfs_root_item { 450struct btrfs_root_item {
450 struct btrfs_inode_item inode; 451 struct btrfs_inode_item inode;
452 __le64 generation;
451 __le64 root_dirid; 453 __le64 root_dirid;
452 __le64 bytenr; 454 __le64 bytenr;
453 __le64 byte_limit; 455 __le64 byte_limit;
@@ -1396,10 +1398,14 @@ static inline int btrfs_is_leaf(struct extent_buffer *eb)
1396} 1398}
1397 1399
1398/* struct btrfs_root_item */ 1400/* struct btrfs_root_item */
1401BTRFS_SETGET_FUNCS(disk_root_generation, struct btrfs_root_item,
1402 generation, 64);
1399BTRFS_SETGET_FUNCS(disk_root_refs, struct btrfs_root_item, refs, 32); 1403BTRFS_SETGET_FUNCS(disk_root_refs, struct btrfs_root_item, refs, 32);
1400BTRFS_SETGET_FUNCS(disk_root_bytenr, struct btrfs_root_item, bytenr, 64); 1404BTRFS_SETGET_FUNCS(disk_root_bytenr, struct btrfs_root_item, bytenr, 64);
1401BTRFS_SETGET_FUNCS(disk_root_level, struct btrfs_root_item, level, 8); 1405BTRFS_SETGET_FUNCS(disk_root_level, struct btrfs_root_item, level, 8);
1402 1406
1407BTRFS_SETGET_STACK_FUNCS(root_generation, struct btrfs_root_item,
1408 generation, 64);
1403BTRFS_SETGET_STACK_FUNCS(root_bytenr, struct btrfs_root_item, bytenr, 64); 1409BTRFS_SETGET_STACK_FUNCS(root_bytenr, struct btrfs_root_item, bytenr, 64);
1404BTRFS_SETGET_STACK_FUNCS(root_level, struct btrfs_root_item, level, 8); 1410BTRFS_SETGET_STACK_FUNCS(root_level, struct btrfs_root_item, level, 8);
1405BTRFS_SETGET_STACK_FUNCS(root_dirid, struct btrfs_root_item, root_dirid, 64); 1411BTRFS_SETGET_STACK_FUNCS(root_dirid, struct btrfs_root_item, root_dirid, 64);
@@ -1416,6 +1422,8 @@ BTRFS_SETGET_STACK_FUNCS(super_generation, struct btrfs_super_block,
1416BTRFS_SETGET_STACK_FUNCS(super_root, struct btrfs_super_block, root, 64); 1422BTRFS_SETGET_STACK_FUNCS(super_root, struct btrfs_super_block, root, 64);
1417BTRFS_SETGET_STACK_FUNCS(super_sys_array_size, 1423BTRFS_SETGET_STACK_FUNCS(super_sys_array_size,
1418 struct btrfs_super_block, sys_chunk_array_size, 32); 1424 struct btrfs_super_block, sys_chunk_array_size, 32);
1425BTRFS_SETGET_STACK_FUNCS(super_chunk_root_generation,
1426 struct btrfs_super_block, chunk_root_generation, 64);
1419BTRFS_SETGET_STACK_FUNCS(super_root_level, struct btrfs_super_block, 1427BTRFS_SETGET_STACK_FUNCS(super_root_level, struct btrfs_super_block,
1420 root_level, 8); 1428 root_level, 8);
1421BTRFS_SETGET_STACK_FUNCS(super_chunk_root, struct btrfs_super_block, 1429BTRFS_SETGET_STACK_FUNCS(super_chunk_root, struct btrfs_super_block,