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.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to