summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-04-10 13:51:41 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-04-10 13:51:41 -0400
commit79b2cb1fa6430501907cb1384abbddf074833e45 (patch)
tree495f4481f83b97a9b25eb16cdbeb0f699f424fee /fs
parent48ddc6f44b5a167c00573b6012727d674e9c667a (diff)
downloadop-kernel-dev-79b2cb1fa6430501907cb1384abbddf074833e45.zip
op-kernel-dev-79b2cb1fa6430501907cb1384abbddf074833e45.tar.gz
Btrfs: only cow in get_block when create==1
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/super.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 91aa1b4..a318397 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1020,7 +1020,7 @@ static int btrfs_get_block_lock(struct inode *inode, sector_t iblock,
ret = btrfs_lookup_file_extent(trans, root, path,
inode->i_ino,
- iblock << inode->i_blkbits, 1);
+ iblock << inode->i_blkbits, create);
if (ret < 0) {
err = ret;
goto out;
@@ -1046,7 +1046,8 @@ static int btrfs_get_block_lock(struct inode *inode, sector_t iblock,
if (ret == 0) {
err = 0;
BUG_ON(btrfs_file_extent_disk_num_blocks(item) != 1);
- if (btrfs_file_extent_generation(item) != trans->transid) {
+ if (create &&
+ btrfs_file_extent_generation(item) != trans->transid) {
struct btrfs_key ins;
ret = btrfs_alloc_extent(trans, root, 1,
blocknr, (u64)-1, &ins);
OpenPOWER on IntegriCloud