]> 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)
commitccf746a9100a886b4da9876a49470f45a2c7b185
tree91cfa510c89128399c87371f9ffc974654c24a46
parent71dda4fc776156be7eec047c5dae10e160fabde1
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