From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/2] Btrfs: don't compress for a small write
Date: Thu, 27 Mar 2014 11:06:12 +0800 [thread overview]
Message-ID: <533395A4.4020601@cn.fujitsu.com> (raw)
In-Reply-To: <20140326181053.GU29256@twin.jikos.cz>
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 inlined, so i think this make senses.
Thanks,
Wang
On 03/27/2014 02:10 AM, David Sterba wrote:
> 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 limiting IMO.
>
>> 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.
> This is a bug but can be fixed without disabling compression of small
> blocks.
>
> I have a similar patch as part of the large compression update, the
> logic that decides if the small extent should be compressed or not
> depends on the compression algo and some typical data samples. for zlib
> it's around ~100 B and lzo at ~200 B. That's a boundary where compressed
> size == uncompressed, so there's no benefit, only additional overhead.
>
next prev parent reply other threads:[~2014-03-27 3:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-24 9:58 [PATCH 1/2] Btrfs: don't compress for a small write Wang Shilong
2014-03-24 9:58 ` [PATCH 2/2] Btrfs: scrub raid56 stripes in the right way Wang Shilong
2014-03-28 12:00 ` Wang Shilong
2014-03-26 18:10 ` [PATCH 1/2] Btrfs: don't compress for a small write David Sterba
2014-03-27 3:06 ` Wang Shilong [this message]
2014-03-31 12:31 ` Chris Mason
2014-03-31 12:53 ` Shilong Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=533395A4.4020601@cn.fujitsu.com \
--to=wangsl.fnst@cn.fujitsu.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).