]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: don't compress for a small write
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>
Tue, 1 Apr 2014 10:01:42 +0000 (18:01 +0800)
committerChris Mason <clm@fb.com>
Mon, 7 Apr 2014 16:08:48 +0000 (09:08 -0700)
commit47ae92c044d9742adb94bb178f8da5a38489ae6a
tree91cfa510c89128399c87371f9ffc974654c24a46
parent5594a2210655f0eba7329d3aa3aa4a91f2d3fa33
Btrfs: don't compress for a small write

To compress a small file range(<=blocksize) that is not
an inline extent can not save disk space at all. skip it can
save us some cpu time.

This patch can also fix wrong setting nocompression flag for
inode, say a case when @total_in is 4096, and then we get
@total_compressed 52,because we do aligment to page cache size
firstly, and then we get into conclusion @total_in=@total_compressed
thus we will clear this inode's compression flag.

An exception comes from inserting inline extent failure but we
still have @total_compressed < @total_in,so we will still reset
inode's flag, this is ok, because we don't have good compression
effect.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/inode.c