public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: do compressed bio size roundup and zeroing in one go
Date: Tue, 24 Feb 2026 15:06:24 +0100	[thread overview]
Message-ID: <20260224140624.GU26902@twin.jikos.cz> (raw)
In-Reply-To: <5d98d50379077b98164f3b962ada7b0526e1d4bb.1771544612.git.wqu@suse.com>

On Fri, Feb 20, 2026 at 10:13:38AM +1030, Qu Wenruo wrote:
> Currently we zero out all the remaining bytes of the last folio of
> the compressed bio, then round the bio size to fs block boundary.
> 
> But that is done in two different functions, zero_last_folio() to zero
> the remaining bytes of the last folio, and round_up_last_block() to
> round up the bio to fs block boundary.
> 
> There are some minor problems:
> 
> - zero_last_folio() is zeroing ranges we won't submit
>   This is mostly affecting block size < page size cases, where we can
>   have a large folio (e.g. 64K), but the fs block size is only 4K.
> 
>   In that case, we may only want to submit the first 4K of the folio,
>   the remaining range won't matter, but we still zero them all.
> 
>   This causes unnecessary CPU usage just to zero out some bytes we won't
>   utilized.
> 
> - compressed_bio_last_folio() is called twice in two different functions
>   Which in theory we only need to call it once.
> 
> Enhance the situation by:
> 
> - Only zero out bytes up to the fs block boundary
>   Thus this will reduce some overhead for bs < ps cases.
> 
> - Move the folio_zero_range() call into round_up_last_block()
>   So that we can reuse the same folio returned by
>   compressed_bio_last_folio().
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: David Sterba <dsterba@suse.com>

      parent reply	other threads:[~2026-02-24 14:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-19 23:43 [PATCH] btrfs: do compressed bio size roundup and zeroing in one go Qu Wenruo
2026-02-24 13:41 ` Anand Jain
2026-02-24 22:05   ` Qu Wenruo
2026-02-24 14:06 ` David Sterba [this message]

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=20260224140624.GU26902@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /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