• Wang Shilong's avatar
    Btrfs: don't compress for a small write · 68bb462d
    Wang Shilong authored
    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: default avatarWang Shilong <wangsl.fnst@cn.fujitsu.com>
    Signed-off-by: default avatarChris Mason <clm@fb.com>
    68bb462d
inode.c 238 KB