From: Boris Burkov <boris@bur.io>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/2] btrfs: warn about dev extents that are inside the reserved range
Date: Tue, 14 Jun 2022 08:30:53 -0700 [thread overview]
Message-ID: <Yqiprewvw0q6OYza@zen> (raw)
In-Reply-To: <7d764668-cb95-f410-4846-9a1a98e3b861@gmx.com>
On Tue, Jun 14, 2022 at 03:48:06PM +0800, Qu Wenruo wrote:
>
>
> On 2022/6/14 03:05, Boris Burkov wrote:
> > On Mon, Jun 13, 2022 at 03:06:35PM +0800, Qu Wenruo wrote:
> > > Btrfs has reserved the first 1MiB for the primary super block (at 64KiB
> > > offset) and legacy programs like older bootloaders.
> > >
> > > This behavior is only introduced since v4.1 btrfs-progs release,
> > > although kernel can ensure we never touch the reserved range of super
> > > blocks, it's better to inform the end users, and a balance will resolve
> > > the problem.
> > >
> > > Signed-off-by: Qu Wenruo <wqu@suse.com>
> > > ---
> > > fs/btrfs/volumes.c | 10 ++++++++++
> > > 1 file changed, 10 insertions(+)
> > >
> > > diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> > > index 051d124679d1..b39f4030d2ba 100644
> > > --- a/fs/btrfs/volumes.c
> > > +++ b/fs/btrfs/volumes.c
> > > @@ -7989,6 +7989,16 @@ static int verify_one_dev_extent(struct btrfs_fs_info *fs_info,
> > > goto out;
> > > }
> > >
> > > + /*
> > > + * Very old mkfs.btrfs (before v4.1) will not respect the reserved
> > > + * space. Although kernel can handle it without problem, better to
> > > + * warn the users.
> > > + */
> > > + if (physical_offset < BTRFS_DEFAULT_RESERVED)
> > > + btrfs_warn(fs_info,
> > > +"devid %llu physical %llu len %llu is inside the reserved space, balance is needed to solve this problem.",
> >
> > If I saw this warning, I wouldn't know what balance to run, and it's
> > not obvious what to search for online either (if it's even documented).
> > I think a more explicit instruction like "btrfs balance start XXXX"
> > would be helpful.
>
> Firstly, the balance command needs extra filters, thus the command can
> be pretty long, like:
>
> # btrfs balance start -mdrange=0..1048576 -ddrange=0..1048576
> -srange0..1048576 <mnt>
>
> I'm not sure if this is a good idea to put all these into the already
> long message.
>
> >
> > If it's something we're ok with in general, then maybe a URL for a wiki
> > page that explains the issue and the workaround would be the most
> > useful.
>
> URL can be helpful but not always. Imagine a poor sysadmin in a noisy
> server room, seeing a URL in dmesg, and has to type the full URL into
> their phone, if the server has very limited network access.
I don't see how the poor sysadmin would be any better off with "you need
to do a balance" vs "you need to do a balance: <URL>" or "you need to do
a balance using mdrange and ddrange to move the affected extents" etc..
My high level point is that you clearly have something in mind that the
person needs to do in the unlikely event they hit this, but I have no
idea how they are supposed to figure it out. Send a mail to our mailing
list and hope you notice it?
>
> In fact, this error message for now will be super rare already.
>
> The main usage of this message is for the incoming feature, which will
> allow btrfs to reserve extra space for its internal usage.
>
> In that case, we will allow btrfstune to set the reservation (even it's
> already used by some dev extent), and btrfstune would give a commandline
> how to do the balance.
>
> I guess I'd put all these preparation patches into the incoming on-disk
> format change patchset to make it clear.
>
> Thanks,
> Qu
>
> >
> > > + devid, physical_offset, physical_len);
> > > +
> > > for (i = 0; i < map->num_stripes; i++) {
> > > if (map->stripes[i].dev->devid == devid &&
> > > map->stripes[i].physical == physical_offset) {
> > > --
> > > 2.36.1
> > >
next prev parent reply other threads:[~2022-06-14 15:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-13 7:06 [PATCH 0/2] btrfs: cleanup related to the 1MiB reserved space Qu Wenruo
2022-06-13 7:06 ` [PATCH 1/2] btrfs: introduce BTRFS_DEFAULT_RESERVED macro Qu Wenruo
2022-06-13 9:13 ` Nikolay Borisov
2022-06-13 9:36 ` Qu Wenruo
2022-06-16 15:20 ` David Sterba
2022-06-17 1:47 ` Qu Wenruo
2022-06-17 14:04 ` David Sterba
2022-06-13 7:06 ` [PATCH 2/2] btrfs: warn about dev extents that are inside the reserved range Qu Wenruo
2022-06-13 19:05 ` Boris Burkov
2022-06-14 7:48 ` Qu Wenruo
2022-06-14 15:30 ` Boris Burkov [this message]
2022-06-14 22:12 ` Qu Wenruo
2022-06-16 15:03 ` David Sterba
2022-06-13 18:20 ` [PATCH 0/2] btrfs: cleanup related to the 1MiB reserved space David Sterba
2022-06-13 23:50 ` Qu Wenruo
2022-06-14 13:56 ` 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=Yqiprewvw0q6OYza@zen \
--to=boris@bur.io \
--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