Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 131062
b: refs/heads/master
c: f03d930
h: refs/heads/master
v: v3
  • Loading branch information
Chris Mason committed Feb 4, 2009
1 parent 42498d5 commit 7d54599
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 811449496b3e3caa9a8cf43feacbade0153324f2
refs/heads/master: f03d9301f15fb69cdf1eb59d53c9fb72f68ecccc
14 changes: 14 additions & 0 deletions trunk/fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,19 @@ static noinline int compress_file_range(struct inode *inode,
nr_pages = (end >> PAGE_CACHE_SHIFT) - (start >> PAGE_CACHE_SHIFT) + 1;
nr_pages = min(nr_pages, (128 * 1024UL) / PAGE_CACHE_SIZE);

/*
* we don't want to send crud past the end of i_size through
* compression, that's just a waste of CPU time. So, if the
* end of the file is before the start of our current
* requested range of bytes, we bail out to the uncompressed
* cleanup code that can deal with all of this.
*
* It isn't really the fastest way to fix things, but this is a
* very uncommon corner.
*/
if (actual_end <= start)
goto cleanup_and_bail_uncompressed;

total_compressed = actual_end - start;

/* we want to make sure that amount of ram required to uncompress
Expand Down Expand Up @@ -504,6 +517,7 @@ static noinline int compress_file_range(struct inode *inode,
goto again;
}
} else {
cleanup_and_bail_uncompressed:
/*
* No compression, but we still need to write the pages in
* the file we've been given so far. redirty the locked
Expand Down

0 comments on commit 7d54599

Please sign in to comment.