diff options
author | Yan Zheng <zheng.yan@oracle.com> | 2008-07-30 09:26:11 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:05 -0400 |
commit | f321e4910398cf7922265d269fb17fd26f312571 (patch) | |
tree | 8430f004991351e48a4b3f9441fe0cbbcf70eddb /fs/btrfs/ctree.h | |
parent | 3bf10418675cb424724b5cb9d7725b234defe1fd (diff) |
Btrfs: Update and fix mount -o nodatacow
To check whether a given file extent is referenced by multiple snapshots, the
checker walks down the fs tree through dead root and checks all tree blocks in
the path.
We can easily detect whether a given tree block is directly referenced by other
snapshot. We can also detect any indirect reference from other snapshot by
checking reference's generation. The checker can always detect multiple
references, but can't reliably detect cases of single reference. So btrfs may
do file data cow even there is only one reference.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 5517dfc6f71c..83422088c629 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -617,7 +617,7 @@ struct btrfs_leaf_ref_tree { | |||
617 | * in ram representation of the tree. extent_root is used for all allocations | 617 | * in ram representation of the tree. extent_root is used for all allocations |
618 | * and for the extent tree extent_root root. | 618 | * and for the extent tree extent_root root. |
619 | */ | 619 | */ |
620 | struct dirty_root; | 620 | struct btrfs_dirty_root; |
621 | struct btrfs_root { | 621 | struct btrfs_root { |
622 | struct extent_buffer *node; | 622 | struct extent_buffer *node; |
623 | 623 | ||
@@ -627,7 +627,7 @@ struct btrfs_root { | |||
627 | struct extent_buffer *commit_root; | 627 | struct extent_buffer *commit_root; |
628 | struct btrfs_leaf_ref_tree *ref_tree; | 628 | struct btrfs_leaf_ref_tree *ref_tree; |
629 | struct btrfs_leaf_ref_tree ref_tree_struct; | 629 | struct btrfs_leaf_ref_tree ref_tree_struct; |
630 | struct dirty_root *dirty_root; | 630 | struct btrfs_dirty_root *dirty_root; |
631 | 631 | ||
632 | struct btrfs_root_item root_item; | 632 | struct btrfs_root_item root_item; |
633 | struct btrfs_key root_key; | 633 | struct btrfs_key root_key; |
@@ -1399,9 +1399,8 @@ static inline struct dentry *fdentry(struct file *file) { | |||
1399 | } | 1399 | } |
1400 | 1400 | ||
1401 | /* extent-tree.c */ | 1401 | /* extent-tree.c */ |
1402 | u32 btrfs_count_snapshots_in_path(struct btrfs_root *root, | 1402 | int btrfs_cross_ref_exists(struct btrfs_root *root, |
1403 | struct btrfs_path *count_path, | 1403 | struct btrfs_key *key, u64 bytenr); |
1404 | u64 expected_owner, u64 first_extent); | ||
1405 | int btrfs_extent_post_op(struct btrfs_trans_handle *trans, | 1404 | int btrfs_extent_post_op(struct btrfs_trans_handle *trans, |
1406 | struct btrfs_root *root); | 1405 | struct btrfs_root *root); |
1407 | int btrfs_copy_pinned(struct btrfs_root *root, struct extent_io_tree *copy); | 1406 | int btrfs_copy_pinned(struct btrfs_root *root, struct extent_io_tree *copy); |