All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Revert "btrfs: compression: don't try to compress if we don't have enough pages"
Date: Wed, 25 Aug 2021 20:06:57 +0800	[thread overview]
Message-ID: <d0dccd5e-c67f-a18d-8d6e-559504b5ee91@suse.com> (raw)
In-Reply-To: <20210825115559.GG3379@twin.jikos.cz>



On 2021/8/25 下午7:55, David Sterba wrote:
> On Wed, Aug 25, 2021 at 01:41:42PM +0800, Qu Wenruo wrote:
>> This reverts commit f2165627319ffd33a6217275e5690b1ab5c45763.
> 
> At this point the revert is the simplest way to restore the inline
> extent compression so that's what I'll probably do. However.
>>
>> [BUG]
>> It's no longer possible to create compressed inline extent after commit
>> f2165627319f ("btrfs: compression: don't try to compress if we don't
>> have enough pages").
>>
>> [CAUSE]
>> For compression code, there are several possible reasons we have a range
>> that needs to be compressed while it's no more than one page.
>>
>> - Compressed inline write
>>    The data is always smaller than one sector.
> 
> The missing logic was for the true inline extent. The patch was supposed
> to skip compression for single pages other than inline extents, due to
> efficiency. So I wonder if we want to do that or just don't bother as
> it's probably a negligible amount of wasted time.

Yeah, I guess that's the case.

We may be able to do such check in the future, but at that time, we need 
to take inline extents into consideration.

Thus it won't be just a simple @nr_pages check, but with extra 
@start/@len check.

>>
>> - Compressed subpage write
>>    For the incoming subpage compressed write support, we require page
>>    alignment of the delalloc range.
>>    And for 64K page size, we can compress just one page into smaller
>>    sectors.
> 
> Oh so the logic would have to be updated to distinguish sectors and
> pages, but to simplify the code for subpage compression support it would
> be easier to revert it and start from there.
> 
For subpage support, there will be no conflicts inside the that function.

Just a reminder that we need to change our mindset to distinguish page 
and sector more in the future.

Anyway, if we really want to do the same check in the future, it will 
take into @start, @len, and sectorsize into consider, and maybe more 
factors to be consider.

Thanks,
Qu


  reply	other threads:[~2021-08-25 12:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-25  5:41 [PATCH] Revert "btrfs: compression: don't try to compress if we don't have enough pages" Qu Wenruo
2021-08-25 11:55 ` David Sterba
2021-08-25 12:06   ` Qu Wenruo [this message]
2021-08-25 13:04     ` David Sterba
2021-08-27  3:41 ` Wang Yugui
2021-08-27  4:03   ` Wang Yugui
2021-08-27  5:04   ` Qu Wenruo
2021-08-27  8:35     ` David Sterba
2021-08-27  9:31       ` Qu Wenruo
2021-08-27 10:12         ` David Sterba

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=d0dccd5e-c67f-a18d-8d6e-559504b5ee91@suse.com \
    --to=wqu@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.