summaryrefslogtreecommitdiff
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-05-08 22:11:56 +0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 19:04:02 +0400
commita68d5933a0e409592860229b35230c8e87155472 (patch)
treef58e963b03034935429b42be735ee59cd06110e1 /fs/btrfs/inode.c
parentbf4ef67924d87b0addb32f084e83a9283496350e (diff)
downloadlinux-a68d5933a0e409592860229b35230c8e87155472.tar.xz
Btrfs: Update nodatacow mode to support cloned single files and resizing
Before, nodatacow only checked to make sure multiple roots didn't have references on a single extent. This check makes sure that multiple inodes don't have references. nodatacow needed an extra check to see if the block group was currently readonly. This way cows forced by the chunk relocation code are honored. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index b437d3bdf95e..1bf37d15b174 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -172,6 +172,7 @@ static int run_delalloc_nocow(struct inode *inode, u64 start, u64 end)
u64 loops = 0;
u64 total_fs_bytes;
struct btrfs_root *root = BTRFS_I(inode)->root;
+ struct btrfs_block_group_cache *block_group;
struct extent_buffer *leaf;
int found_type;
struct btrfs_path *path;
@@ -230,16 +231,20 @@ again:
if (bytenr == 0)
goto not_found;
+ if (btrfs_count_snapshots_in_path(root, path, inode->i_ino,
+ bytenr) != 1) {
+ goto not_found;
+ }
+
/*
* we may be called by the resizer, make sure we're inside
* the limits of the FS
*/
- if (bytenr + extent_num_bytes > total_fs_bytes)
+ block_group = btrfs_lookup_block_group(root->fs_info,
+ bytenr);
+ if (!block_group || block_group->ro)
goto not_found;
- if (btrfs_count_snapshots_in_path(root, path, bytenr) != 1) {
- goto not_found;
- }
start = extent_end;
} else {