Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/4] btrfs: cache max and min order inside btrfs_fs_info
Date: Mon, 1 Sep 2025 20:10:57 +0200	[thread overview]
Message-ID: <20250901181057.GD5333@twin.jikos.cz> (raw)
In-Reply-To: <d1a3793b551f0a6ccaf8907cc5aa06d8f5b3d5c2.1756703958.git.wqu@suse.com>

On Mon, Sep 01, 2025 at 02:54:04PM +0930, Qu Wenruo wrote:
> Inside btrfs_fs_info we cache several bits shift like sectorsize_bits.
> 
> Apply this to max and min folio orders so that every time mapping order
> needs to be applied we can skip the calculation.
> 
> Furthermore all those sectorsize/nodesize shifts, along with the new
> min/max folio orders have a very limited value range by their natures.
> 
> E.g. blocksize bits can be at most ilog2(64K) which is 16, and for 4K
> page size and 64K block size (bs > ps) the minimal folio order is only
> 4.
> Neither those number can even exceed U8_MAX, thus there is no need to
> use u32 for those bits.
> 
> Use u8 for those members to save memory.

The reason for u32 is that it generates a bit better assembly code, we
don't have to save each byte in fs_info so please keep it u32.

  reply	other threads:[~2025-09-01 18:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01  5:24 [PATCH 0/4] btrfs: bs > ps support preparation Qu Wenruo
2025-09-01  5:24 ` [PATCH 1/4] btrfs: support all block sizes which is no larger than page size Qu Wenruo
2025-09-01  5:24 ` [PATCH 2/4] btrfs: cache max and min order inside btrfs_fs_info Qu Wenruo
2025-09-01 18:10   ` David Sterba [this message]
2025-09-02  3:46   ` kernel test robot
2025-09-01  5:24 ` [PATCH 3/4] btrfs: replace single page bio_iter_iovec() usage Qu Wenruo
2025-09-01  6:25   ` Qu Wenruo
2025-09-01  5:24 ` [PATCH 4/4] btrfs: replace bio_for_each_segment usage Qu Wenruo

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=20250901181057.GD5333@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@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