From: David Sterba <dsterba@suse.cz>
To: Boris Burkov <boris@bur.io>
Cc: David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: use shifts for sectorsize and nodesize
Date: Wed, 27 May 2026 20:50:29 +0200 [thread overview]
Message-ID: <20260527185029.GC880787@suse.cz> (raw)
In-Reply-To: <20260527160409.GC1981571@zen.localdomain>
On Wed, May 27, 2026 at 09:04:09AM -0700, Boris Burkov wrote:
> > --- a/fs/btrfs/relocation.c
> > +++ b/fs/btrfs/relocation.c
> > @@ -1560,7 +1560,7 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc,
> > * and * 2 since we have two trees to COW.
> > */
> > reserve_level = max_t(int, 1, btrfs_root_level(root_item));
> > - min_reserved = fs_info->nodesize * reserve_level * 2;
> > + min_reserved = (reserve_level << fs_info->nodesize_bits) * 2;
>
> Is it nicer to just add 1 to the shift operand?
There's fragment of the comment in the diff context, in full
/*
* In merge_reloc_root(), we modify the upper level pointer to swap the
* tree blocks between reloc tree and subvolume tree. Thus for tree
* block COW, we COW at most from level 1 to root level for each tree.
*
* Thus the needed metadata size is at most root_level * nodesize,
* and * 2 since we have two trees to COW.
*/
so the "* 2" matches it.
next prev parent reply other threads:[~2026-05-27 18:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 11:16 [PATCH] btrfs: use shifts for sectorsize and nodesize David Sterba
2026-05-27 16:04 ` Boris Burkov
2026-05-27 18:50 ` David Sterba [this message]
2026-05-27 21:45 ` 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=20260527185029.GC880787@suse.cz \
--to=dsterba@suse.cz \
--cc=boris@bur.io \
--cc=dsterba@suse.com \
--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