diff options
author | Chris Mason <chris.mason@oracle.com> | 2011-09-18 10:31:44 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-09-18 10:31:44 -0400 |
commit | 2cf4ce7c2a07782c3f4d899b380a78522bca3238 (patch) | |
tree | 46ef48fd4ee47753d6539b65c8a90a2f64e9f8a5 /fs/btrfs | |
parent | b6fd41e29dea9c6753b1843a77e50433e6123bcb (diff) | |
parent | dde820fbf7176b64daddc1856597d9c61dac19e2 (diff) |
Merge branch 'btrfs-3.0' into for-linus
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode.c | 5 | ||||
-rw-r--r-- | fs/btrfs/ioctl.c | 14 |
2 files changed, 12 insertions, 7 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 4d14de6d121b..377e9bb0974f 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4125,7 +4125,8 @@ static int btrfs_real_readdir(struct file *filp, void *dirent, | |||
4125 | 4125 | ||
4126 | /* special case for "." */ | 4126 | /* special case for "." */ |
4127 | if (filp->f_pos == 0) { | 4127 | if (filp->f_pos == 0) { |
4128 | over = filldir(dirent, ".", 1, 1, btrfs_ino(inode), DT_DIR); | 4128 | over = filldir(dirent, ".", 1, |
4129 | filp->f_pos, btrfs_ino(inode), DT_DIR); | ||
4129 | if (over) | 4130 | if (over) |
4130 | return 0; | 4131 | return 0; |
4131 | filp->f_pos = 1; | 4132 | filp->f_pos = 1; |
@@ -4134,7 +4135,7 @@ static int btrfs_real_readdir(struct file *filp, void *dirent, | |||
4134 | if (filp->f_pos == 1) { | 4135 | if (filp->f_pos == 1) { |
4135 | u64 pino = parent_ino(filp->f_path.dentry); | 4136 | u64 pino = parent_ino(filp->f_path.dentry); |
4136 | over = filldir(dirent, "..", 2, | 4137 | over = filldir(dirent, "..", 2, |
4137 | 2, pino, DT_DIR); | 4138 | filp->f_pos, pino, DT_DIR); |
4138 | if (over) | 4139 | if (over) |
4139 | return 0; | 4140 | return 0; |
4140 | filp->f_pos = 2; | 4141 | filp->f_pos = 2; |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 3351b1b24574..d11fd28efa6a 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -2177,6 +2177,11 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
2177 | if (!(src_file->f_mode & FMODE_READ)) | 2177 | if (!(src_file->f_mode & FMODE_READ)) |
2178 | goto out_fput; | 2178 | goto out_fput; |
2179 | 2179 | ||
2180 | /* don't make the dst file partly checksummed */ | ||
2181 | if ((BTRFS_I(src)->flags & BTRFS_INODE_NODATASUM) != | ||
2182 | (BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)) | ||
2183 | goto out_fput; | ||
2184 | |||
2180 | ret = -EISDIR; | 2185 | ret = -EISDIR; |
2181 | if (S_ISDIR(src->i_mode) || S_ISDIR(inode->i_mode)) | 2186 | if (S_ISDIR(src->i_mode) || S_ISDIR(inode->i_mode)) |
2182 | goto out_fput; | 2187 | goto out_fput; |
@@ -2226,6 +2231,10 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
2226 | goto out_unlock; | 2231 | goto out_unlock; |
2227 | } | 2232 | } |
2228 | 2233 | ||
2234 | /* truncate page cache pages from target inode range */ | ||
2235 | truncate_inode_pages_range(&inode->i_data, destoff, | ||
2236 | PAGE_CACHE_ALIGN(destoff + len) - 1); | ||
2237 | |||
2229 | /* do any pending delalloc/csum calc on src, one way or | 2238 | /* do any pending delalloc/csum calc on src, one way or |
2230 | another, and lock file content */ | 2239 | another, and lock file content */ |
2231 | while (1) { | 2240 | while (1) { |
@@ -2242,10 +2251,6 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
2242 | btrfs_wait_ordered_range(src, off, len); | 2251 | btrfs_wait_ordered_range(src, off, len); |
2243 | } | 2252 | } |
2244 | 2253 | ||
2245 | /* truncate page cache pages from target inode range */ | ||
2246 | truncate_inode_pages_range(&inode->i_data, off, | ||
2247 | ALIGN(off + len, PAGE_CACHE_SIZE) - 1); | ||
2248 | |||
2249 | /* clone data */ | 2254 | /* clone data */ |
2250 | key.objectid = btrfs_ino(src); | 2255 | key.objectid = btrfs_ino(src); |
2251 | key.type = BTRFS_EXTENT_DATA_KEY; | 2256 | key.type = BTRFS_EXTENT_DATA_KEY; |
@@ -2442,7 +2447,6 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, | |||
2442 | if (endoff > inode->i_size) | 2447 | if (endoff > inode->i_size) |
2443 | btrfs_i_size_write(inode, endoff); | 2448 | btrfs_i_size_write(inode, endoff); |
2444 | 2449 | ||
2445 | BTRFS_I(inode)->flags = BTRFS_I(src)->flags; | ||
2446 | ret = btrfs_update_inode(trans, root, inode); | 2450 | ret = btrfs_update_inode(trans, root, inode); |
2447 | BUG_ON(ret); | 2451 | BUG_ON(ret); |
2448 | btrfs_end_transaction(trans, root); | 2452 | btrfs_end_transaction(trans, root); |