Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: dsterba@suse.cz, Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: shrink the size of btrfs_bio
Date: Mon, 8 Dec 2025 21:44:20 +0100	[thread overview]
Message-ID: <20251208204420.GD4859@twin.jikos.cz> (raw)
In-Reply-To: <3bbfc8bc-0b15-461b-90a4-a59d2b7fd97e@gmx.com>

On Tue, Dec 09, 2025 at 06:56:47AM +1030, Qu Wenruo wrote:
> 
> 
> 在 2025/12/9 05:49, David Sterba 写道:
> > On Fri, Dec 05, 2025 at 06:34:30PM +1030, Qu Wenruo wrote:
> >> This is done by:
> >>
> >> - Shrink the size of btrfs_bio::mirror_num
> >>    From 32 bits unsigned int to 8 bits u8.
> > 
> > What is the explanation for this? IIRC the mirror num on raid56 refers
> > to the device index,
> 
> You're right, u8 can not cut the max number of devices for RAID6.
> (RAID5 only has two mirrors, mirror 0 meaning reading from data stripes, 
> mirror 1 means rebuild using other data and P stripe)
> 
> BTRFS_MAX_DEVICES() is around 500 for the default 16K node size, which 
> is already beyond 255.
> 
> Although in the real world it can hardly go that extreme, but without a 
> proper rejection/sanity checks, we can not do the shrink now.
> 
> I'd like to limit the device number to something more realistic.
> Would the device limit of 32 cut for both RAID5 and RAID6?
> (And maybe apply this limit to RAID10/RAID0 too?)
> 
> Or someone would prefer more devices?

I'd rather not add such artificial limit, I find 32 to small anyway.
Using say 200+ devices will likely hit other boundaries like fitting
items into some structures or performance reasons, but this does not
justify setting some data structure to u8/1 byte.

With u16 and 16K devices this sounds future proof enough and we may use
u16 in the sructures to save bytes (although it generates a bit worse
code).

  reply	other threads:[~2025-12-08 20:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-05  8:04 [PATCH] btrfs: shrink the size of btrfs_bio Qu Wenruo
2025-12-05 10:09 ` Johannes Thumshirn
2025-12-08 19:19 ` David Sterba
2025-12-08 20:26   ` Qu Wenruo
2025-12-08 20:44     ` David Sterba [this message]
2025-12-08 20:53       ` Qu Wenruo
  -- strict thread matches above, loose matches on Subject: below --
2025-12-08 21:25 Qu Wenruo
2025-12-12  3:18 ` 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=20251208204420.GD4859@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    --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