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 77061bf43edb..f76b1fd160d4 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2241,6 +2241,7 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int whence)
2241 if (lockend <= lockstart) 2241 if (lockend <= lockstart)
2242 lockend = lockstart + root->sectorsize; 2242 lockend = lockstart + root->sectorsize;
2243 2243
2244 lockend--;
2244 len = lockend - lockstart + 1; 2245 len = lockend - lockstart + 1;
2245 2246
2246 len = max_t(u64, len, root->sectorsize); 2247 len = max_t(u64, len, root->sectorsize);
@@ -2307,9 +2308,12 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int whence)
2307 } 2308 }
2308 } 2309 }
2309 2310
2310 *offset = start; 2311 if (!test_bit(EXTENT_FLAG_PREALLOC,
2311 free_extent_map(em); 2312 &em->flags)) {
2312 break; 2313 *offset = start;
2314 free_extent_map(em);
2315 break;
2316 }
2313 } 2317 }
2314 } 2318 }
2315 2319