diff options
author | Yan Zheng <zheng.yan@oracle.com> | 2008-10-29 14:49:05 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-10-29 14:49:05 -0400 |
commit | 84234f3a1f7c532e4afeba03cc8e7e4a8a5277ea (patch) | |
tree | c41f249b448f28b648b21c3898d0763b9c67ca6a /fs/btrfs/ctree.h | |
parent | 2517920135b0d29e70453e5b03d70d7b94207df3 (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.h | 8 |
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 | ||
449 | struct btrfs_root_item { | 450 | struct 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 */ |
1401 | BTRFS_SETGET_FUNCS(disk_root_generation, struct btrfs_root_item, | ||
1402 | generation, 64); | ||
1399 | BTRFS_SETGET_FUNCS(disk_root_refs, struct btrfs_root_item, refs, 32); | 1403 | BTRFS_SETGET_FUNCS(disk_root_refs, struct btrfs_root_item, refs, 32); |
1400 | BTRFS_SETGET_FUNCS(disk_root_bytenr, struct btrfs_root_item, bytenr, 64); | 1404 | BTRFS_SETGET_FUNCS(disk_root_bytenr, struct btrfs_root_item, bytenr, 64); |
1401 | BTRFS_SETGET_FUNCS(disk_root_level, struct btrfs_root_item, level, 8); | 1405 | BTRFS_SETGET_FUNCS(disk_root_level, struct btrfs_root_item, level, 8); |
1402 | 1406 | ||
1407 | BTRFS_SETGET_STACK_FUNCS(root_generation, struct btrfs_root_item, | ||
1408 | generation, 64); | ||
1403 | BTRFS_SETGET_STACK_FUNCS(root_bytenr, struct btrfs_root_item, bytenr, 64); | 1409 | BTRFS_SETGET_STACK_FUNCS(root_bytenr, struct btrfs_root_item, bytenr, 64); |
1404 | BTRFS_SETGET_STACK_FUNCS(root_level, struct btrfs_root_item, level, 8); | 1410 | BTRFS_SETGET_STACK_FUNCS(root_level, struct btrfs_root_item, level, 8); |
1405 | BTRFS_SETGET_STACK_FUNCS(root_dirid, struct btrfs_root_item, root_dirid, 64); | 1411 | BTRFS_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, | |||
1416 | BTRFS_SETGET_STACK_FUNCS(super_root, struct btrfs_super_block, root, 64); | 1422 | BTRFS_SETGET_STACK_FUNCS(super_root, struct btrfs_super_block, root, 64); |
1417 | BTRFS_SETGET_STACK_FUNCS(super_sys_array_size, | 1423 | BTRFS_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); |
1425 | BTRFS_SETGET_STACK_FUNCS(super_chunk_root_generation, | ||
1426 | struct btrfs_super_block, chunk_root_generation, 64); | ||
1419 | BTRFS_SETGET_STACK_FUNCS(super_root_level, struct btrfs_super_block, | 1427 | BTRFS_SETGET_STACK_FUNCS(super_root_level, struct btrfs_super_block, |
1420 | root_level, 8); | 1428 | root_level, 8); |
1421 | BTRFS_SETGET_STACK_FUNCS(super_chunk_root, struct btrfs_super_block, | 1429 | BTRFS_SETGET_STACK_FUNCS(super_chunk_root, struct btrfs_super_block, |