From: David Sterba <dsterba@suse.cz>
To: "Holger Hoffstätte" <holger@applied-asynchrony.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] btrfs-progs: add option to only list parent subvolumes
Date: Mon, 2 Oct 2017 16:40:13 +0200 [thread overview]
Message-ID: <20171002144013.GY31640@suse.cz> (raw)
In-Reply-To: <6c01643a-b6cd-21ae-45ec-e074995a5de2@applied-asynchrony.com>
On Sat, Sep 30, 2017 at 03:08:13PM +0200, Holger Hoffstätte wrote:
> Hi,
>
> When listing subvolumes it can be useful to filter out any snapshots;
> surprisingly enough I couldn't find an option to do this easily, only
> the opposite (list only snapshots).
>
> A "root" subvolume is identified by a null parent UUID, so adding a new
> subvolume filter and flag -P ("Parent") does the trick.
>
> The same can of course be accomplished with shell hackery, e.g.:
>
> btrfs subvol list -q -o <path> | grep -i "parent_uuid -" | cut -d " " -f 11
>
> but a built-in way seems less fragile.
>
> I originally cooked this up for myself, but David Sterba encouraged me to
> send this to the list, so here it is. I'm not too proud of the -P but
> couldn't find a better option letter; suggestions welcome. :)
Thanks for sending it. Filtering by non-snapshots is indeed missing.
I've applied the patch as is, but I suspect the option name will change
before it ends up in a release.
We have terminology problems (again), as 'subvolume' is commonly used
for both plain subvolumes and also snapshots, but for the filtering we
need to make the clear distinction.
For the snapshot it's easy, the starting point of a snapshot is another
subvolume or snapshot, ie. there's the parent UUID. Plain subvolume gets
created by 'btrfs subvolume create'.
While the 'parent' notion reflects that a snapshot originates from
another subvolume, there's also directory structure that uses the term.
And in combination with subvolumes it's not always true that a parent
subvolume is also parent directory.
So my idea is to use '-S' as for "subvolumes", and '-s' for "snapshots"
by the strict defintion.
The output of subvolume listing will get reworked, so I'd like to keep
the final decision about the option naming open, until I get the whole
picture and some working prototype with the libsmartcols.
prev parent reply other threads:[~2017-10-02 14:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-30 13:08 [PATCH] btrfs-progs: add option to only list parent subvolumes Holger Hoffstätte
2017-09-30 16:37 ` Graham Cobb
2017-09-30 17:56 ` Holger Hoffstätte
2017-09-30 18:17 ` Holger Hoffstätte
2017-09-30 22:33 ` Graham Cobb
2017-10-02 0:40 ` Misono, Tomohiro
2017-09-30 18:40 ` Nicholas D Steeves
2017-10-02 14:40 ` David Sterba [this message]
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=20171002144013.GY31640@suse.cz \
--to=dsterba@suse.cz \
--cc=holger@applied-asynchrony.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;
as well as URLs for NNTP newsgroup(s).