aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
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)
2242 if (lockend <= lockstart) 2242 if (lockend <= lockstart)
2243 lockend = lockstart + root->sectorsize; 2243 lockend = lockstart + root->sectorsize;
2244 2244
2245 lockend--;
2245 len = lockend - lockstart + 1; 2246 len = lockend - lockstart + 1;
2246 2247
2247 len = max_t(u64, len, root->sectorsize); 2248 len = max_t(u64, len, root->sectorsize);
@@ -2308,9 +2309,12 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin)
2308 } 2309 }
2309 } 2310 }
2310 2311
2311 *offset = start; 2312 if (!test_bit(EXTENT_FLAG_PREALLOC,
2312 free_extent_map(em); 2313 &em->flags)) {
2313 break; 2314 *offset = start;
2315 free_extent_map(em);
2316 break;
2317 }
2314 } 2318 }
2315 } 2319 }
2316 2320