|
@@ -411,14 +411,6 @@ static noinline int compress_file_range(struct inode *inode,
|
|
|
(start > 0 || end + 1 < BTRFS_I(inode)->disk_i_size))
|
|
|
btrfs_add_inode_defrag(NULL, inode);
|
|
|
|
|
|
- /*
|
|
|
- * skip compression for a small file range(<=blocksize) that
|
|
|
- * isn't an inline extent, since it dosen't save disk space at all.
|
|
|
- */
|
|
|
- if ((end - start + 1) <= blocksize &&
|
|
|
- (start > 0 || end + 1 < BTRFS_I(inode)->disk_i_size))
|
|
|
- goto cleanup_and_bail_uncompressed;
|
|
|
-
|
|
|
actual_end = min_t(u64, isize, end + 1);
|
|
|
again:
|
|
|
will_compress = 0;
|
|
@@ -440,6 +432,14 @@ again:
|
|
|
|
|
|
total_compressed = actual_end - start;
|
|
|
|
|
|
+ /*
|
|
|
+ * skip compression for a small file range(<=blocksize) that
|
|
|
+ * isn't an inline extent, since it dosen't save disk space at all.
|
|
|
+ */
|
|
|
+ if (total_compressed <= blocksize &&
|
|
|
+ (start > 0 || end + 1 < BTRFS_I(inode)->disk_i_size))
|
|
|
+ goto cleanup_and_bail_uncompressed;
|
|
|
+
|
|
|
/* we want to make sure that amount of ram required to uncompress
|
|
|
* an extent is reasonable, so we limit the total size in ram
|
|
|
* of a compressed extent to 128k. This is a crucial number
|