Re: [PATCH 1/2] Btrfs: don't compress for a small write

2014-03-31 Thread Chris Mason
On 03/24/2014 05:58 AM, Wang Shilong wrote: To compress a small write(=blocksize) dosen't save us disk space at all, skip it can save us some compression time. This patch can also fix wrong setting nocompression flag for inode, say a case when @total_in is 4096, and then we get

Re: [PATCH 1/2] Btrfs: don't compress for a small write

2014-03-31 Thread Shilong Wang
2014-03-31 20:31 GMT+08:00 Chris Mason c...@fb.com: On 03/24/2014 05:58 AM, Wang Shilong wrote: To compress a small write(=blocksize) dosen't save us disk space at all, skip it can save us some compression time. This patch can also fix wrong setting nocompression flag for inode, say a

Re: [PATCH 1/2] Btrfs: don't compress for a small write

2014-03-26 Thread David Sterba
On Mon, Mar 24, 2014 at 05:58:10PM +0800, Wang Shilong wrote: To compress a small write(=blocksize) dosen't save us disk space at all, skip it can save us some compression time. The compressibility depends on the data, a block full of zeros can compress pretty well, so your patch is too

Re: [PATCH 1/2] Btrfs: don't compress for a small write

2014-03-26 Thread Wang Shilong
Not really, you just miss inline part, say we compress a page to 50B, but this inode's data can not be inlined(see inline check), we still have to allocate 'blocksize'(min allocating unit) disk space and then write data and zero filled datas into disk. This patch only skips data can not be

[PATCH 1/2] Btrfs: don't compress for a small write

2014-03-24 Thread Wang Shilong
To compress a small write(=blocksize) dosen't save us disk space at all, skip it can save us some compression 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