On 30/09/17 14:08, Holger Hoffstätte wrote: > A "root" subvolume is identified by a null parent UUID, so adding a new > subvolume filter and flag -P ("Parent") does the trick.
I don't like the naming. The flag you are proposing is really nothing to do with whether a subvolume is a parent or not: it is about whether it is a snapshot or not (many subvolumes are both snapshots and also parents of other snapshots, and many non-snapshots are not the parent of any subvolumes). I have two suggestions: 1) Use -S (meaning "not a snapshot", the inverse of -s). Along with this change. I would change the usage text to say something like: -s list subvolumes originally created as snapshots -S list subvolumes originally created not as snapshots Presumably specifying both -s and -S should be an error. 2) Add a -P (parent) option but make it take an argument: the UUID of the parent to match. This would display only subvolumes originally created as snapshots of the specified subvolume (which may or may not still exist, of course). A null value ('' -- or a special text like 'NULL' or 'NONE' if you prefer) would create the search you were looking for: subvolumes with a null Parent UUID. The second option is more code, of course, but I see being able to list all the snapshots of a particular subvolume as quite useful. If you do choose the second option you need to decide what to do if the -P is specified more than once. Probably treat it as an error (unless you want to allow a list of UUIDs any of which can match). You might also want to reject an attempt to specify both -s and -P. Graham -- 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