diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/inode.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5792816d4fca..9b43a6f303b8 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -360,6 +360,19 @@ again: | |||
360 | nr_pages = (end >> PAGE_CACHE_SHIFT) - (start >> PAGE_CACHE_SHIFT) + 1; | 360 | nr_pages = (end >> PAGE_CACHE_SHIFT) - (start >> PAGE_CACHE_SHIFT) + 1; |
361 | nr_pages = min(nr_pages, (128 * 1024UL) / PAGE_CACHE_SIZE); | 361 | nr_pages = min(nr_pages, (128 * 1024UL) / PAGE_CACHE_SIZE); |
362 | 362 | ||
363 | /* | ||
364 | * we don't want to send crud past the end of i_size through | ||
365 | * compression, that's just a waste of CPU time. So, if the | ||
366 | * end of the file is before the start of our current | ||
367 | * requested range of bytes, we bail out to the uncompressed | ||
368 | * cleanup code that can deal with all of this. | ||
369 | * | ||
370 | * It isn't really the fastest way to fix things, but this is a | ||
371 | * very uncommon corner. | ||
372 | */ | ||
373 | if (actual_end <= start) | ||
374 | goto cleanup_and_bail_uncompressed; | ||
375 | |||
363 | total_compressed = actual_end - start; | 376 | total_compressed = actual_end - start; |
364 | 377 | ||
365 | /* we want to make sure that amount of ram required to uncompress | 378 | /* we want to make sure that amount of ram required to uncompress |
@@ -504,6 +517,7 @@ again: | |||
504 | goto again; | 517 | goto again; |
505 | } | 518 | } |
506 | } else { | 519 | } else { |
520 | cleanup_and_bail_uncompressed: | ||
507 | /* | 521 | /* |
508 | * No compression, but we still need to write the pages in | 522 | * No compression, but we still need to write the pages in |
509 | * the file we've been given so far. redirty the locked | 523 | * the file we've been given so far. redirty the locked |