linux-btrfs.vger.kernel.org archive mirror
 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: Introduce new mount option to skip block group items scan
Date: Mon, 7 Jan 2019 19:59:45 +0100	[thread overview]
Message-ID: <20190107185945.GC23615@twin.jikos.cz> (raw)
In-Reply-To: <20181220080137.22819-1-wqu@suse.com>

On Thu, Dec 20, 2018 at 04:01:37PM +0800, Qu Wenruo wrote:
> Btrfs needs to read out all block group (bg) items to fill its bg
> caches.
> 
> However such bg caches are only needed for read-write mount, and makes
> no sense for RO mount.
> 
> So this patch introduce new mount option, skip_bg, to skip block group
> items scan.
> 
> This new 'skip_bg' mount option can only be used with TRUE read-only
> mount, which needs the following dependency:
> - RO mount
>   Obviously.
> 
> - No log tree or notreelog mount option
> 
> - No way to remoutn RW
>   Similar to notreelog mount option.
> 
> - No chunk <-> bg <-> dev extents restrict check
> 
> This option should only be used as kernel equivalent of btrfs-restore.
> 
> With this patch, we can even mount a btrfs whose extent root is
> completely corrupted.

So it's a last-resort rescue option, I'd suggest to make that more
explicit. Something like rescue=skip-bg. We can add all sorts of other
values that would relax some checks. Adding a separate mount option
would be quite impractical.

This would also align with the constraints you mention above, eg. no way
to remount RW. This is fine for the corrupted extent root. I wonder what
kind of metadata damage support would still make sense. a 'completely
corrupted extent root' means you never know what you get from the
filesystem.

The in-kernel checks and interconnection of the structures would have to
be ready for missing metadata or more sanity checks would need to be
added.

I think that all the restore and rescue functionality is better suited
for userspace where the unpredictable corruptions that cannot be parsed
do not lead to kernel crashes or silent memory overwrites.

> But can also be an option to test if btrfs_read_block_groups() is the
> major cause for slow btrfs mount.

We have a debugging/testing -only mount option 'fragment', so we may
consider adding more.

  reply	other threads:[~2019-01-07 19:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-20  8:01 [PATCH] btrfs: Introduce new mount option to skip block group items scan Qu Wenruo
2019-01-07 18:59 ` David Sterba [this message]
2019-01-08  1:11   ` 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=20190107185945.GC23615@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;
as well as URLs for NNTP newsgroup(s).