summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorChris Mason2010-01-28 22:18:15 +0100
committerChris Mason2010-01-28 22:18:15 +0100
commita555f810af6d63ea5960abaed88e150ad95c3011 (patch)
tree643fd3e94c352dc0006ff9333de8b7b4dc2b8785 /fs/btrfs/inode.c
parentBtrfs: fix possible panic on unmount (diff)
downloadkernel-qcow2-linux-a555f810af6d63ea5960abaed88e150ad95c3011.tar.gz
kernel-qcow2-linux-a555f810af6d63ea5960abaed88e150ad95c3011.tar.xz
kernel-qcow2-linux-a555f810af6d63ea5960abaed88e150ad95c3011.zip
Btrfs: Add mount -o compress-force
The default btrfs mount -o compress mode will quickly back off compressing a file if it notices that compression does not reduce the size of the data being written. This can save considerable CPU because all future writes to the file go through uncompressed. But some files are both very large and have mixed data stored in them. In that case, we want to add the ability to always try compressing data before writing it. This commit adds mount -o compress-force. A later commit will add a new inode flag that does the same thing. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index b330e27c2d8b..f46c57276844 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -483,7 +483,8 @@ again:
nr_pages_ret = 0;
/* flag the file so we don't compress in the future */
- BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS;
+ if (!btrfs_test_opt(root, FORCE_COMPRESS))
+ BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS;
}
if (will_compress) {
*num_added += 1;