summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-07-30 09:26:11 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:05 -0400
commitf321e4910398cf7922265d269fb17fd26f312571 (patch)
tree8430f004991351e48a4b3f9441fe0cbbcf70eddb /fs/btrfs/inode.c
parent3bf10418675cb424724b5cb9d7725b234defe1fd (diff)
downloadop-kernel-dev-f321e4910398cf7922265d269fb17fd26f312571.zip
op-kernel-dev-f321e4910398cf7922265d269fb17fd26f312571.tar.gz
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/inode.c')
-rw-r--r--fs/btrfs/inode.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 7c87f86..3aa82ce 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -249,11 +249,8 @@ again:
if (bytenr == 0)
goto not_found;
- if (btrfs_count_snapshots_in_path(root, path, inode->i_ino,
- bytenr) != 1) {
+ if (btrfs_cross_ref_exists(root, &found_key, bytenr))
goto not_found;
- }
-
/*
* we may be called by the resizer, make sure we're inside
* the limits of the FS
@@ -277,6 +274,7 @@ loop:
goto again;
not_found:
+ btrfs_release_path(root, path);
cow_file_range(inode, start, end);
start = end + 1;
goto loop;
OpenPOWER on IntegriCloud