summaryrefslogtreecommitdiff
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@fusionio.com>2013-01-21 20:26:55 -0500
committerChris Mason <chris.mason@fusionio.com>2013-01-21 20:26:55 -0500
commitdaf2c08911522d1739c55baf35f03531a29c87ef (patch)
tree380d89b955baebd90ca5ac1cf6527f963cf7dae7 /fs/btrfs/file.c
parent2cf687039676c2b6e1ee96b0b89090aca94babcd (diff)
parent3972f2603d8570effaf633cea52b12c7c2773c11 (diff)
Merge branch 'for-chris' of git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next into linus
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 20452c110d7d..841cfe3be0e0 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2242,6 +2242,7 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin)
if (lockend <= lockstart)
lockend = lockstart + root->sectorsize;
+ lockend--;
len = lockend - lockstart + 1;
len = max_t(u64, len, root->sectorsize);
@@ -2308,9 +2309,12 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin)
}
}
- *offset = start;
- free_extent_map(em);
- break;
+ if (!test_bit(EXTENT_FLAG_PREALLOC,
+ &em->flags)) {
+ *offset = start;
+ free_extent_map(em);
+ break;
+ }
}
}