diff options
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index eb3c12e7beaf..9b37ce6e5168 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -1242,13 +1242,22 @@ again: | |||
1242 | delalloc_end = 0; | 1242 | delalloc_end = 0; |
1243 | found = find_delalloc_range(tree, &delalloc_start, &delalloc_end, | 1243 | found = find_delalloc_range(tree, &delalloc_start, &delalloc_end, |
1244 | max_bytes); | 1244 | max_bytes); |
1245 | if (!found) { | 1245 | if (!found || delalloc_end <= *start) { |
1246 | *start = delalloc_start; | 1246 | *start = delalloc_start; |
1247 | *end = delalloc_end; | 1247 | *end = delalloc_end; |
1248 | return found; | 1248 | return found; |
1249 | } | 1249 | } |
1250 | 1250 | ||
1251 | /* | 1251 | /* |
1252 | * start comes from the offset of locked_page. We have to lock | ||
1253 | * pages in order, so we can't process delalloc bytes before | ||
1254 | * locked_page | ||
1255 | */ | ||
1256 | if (delalloc_start < *start) { | ||
1257 | delalloc_start = *start; | ||
1258 | } | ||
1259 | |||
1260 | /* | ||
1252 | * make sure to limit the number of pages we try to lock down | 1261 | * make sure to limit the number of pages we try to lock down |
1253 | * if we're looping. | 1262 | * if we're looping. |
1254 | */ | 1263 | */ |