[Libguestfs] [PATCH] listfs: ignore the default btrfs subvolume
Pino Toscano
ptoscano at redhat.com
Fri Feb 26 10:11:40 UTC 2016
On Thursday 25 February 2016 19:10:39 Richard W.M. Jones wrote:
> On Thu, Feb 25, 2016 at 05:50:57PM +0100, Pino Toscano wrote:
> > When listing the subvolumes of a btrfs filesystem, ignore the default
> > subvolume: we get the content of it when mounting the whole device
> > (without specifying any particular subvolume), so avoid listing it
> > twice.
> > ---
> > src/listfs.c | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git a/src/listfs.c b/src/listfs.c
> > index 98e74c7..de3b6f5 100644
> > --- a/src/listfs.c
> > +++ b/src/listfs.c
> > @@ -169,8 +169,17 @@ check_with_vfs_type (guestfs_h *g, const char *device, struct stringsbuf *sb)
> > if (vols == NULL)
> > return -1;
> >
> > + int64_t default_volume = guestfs_btrfs_subvolume_get_default (g, device);
> > +
> > for (size_t i = 0; i < vols->len; i++) {
> > struct guestfs_btrfssubvolume *this = &vols->val[i];
> > +
> > + /* Ignore the default subvolume. We get it by simply mounting
> > + * the whole device of this btrfs filesystem.
> > + */
> > + if (this->btrfssubvolume_id == (uint64_t) default_volume)
> > + continue;
> > +
> > guestfs_int_add_sprintf (g, sb,
> > "btrfsvol:%s/%s",
> > device, this->btrfssubvolume_path);
>
> ACK.
>
> Was there an RHBZ# for this? Can't seem to find it ...
#824021 seems to be similar/close, although I cannot reproduce it even
without this patch (i.e. inspection works in a Fedora + btrfs layout).
--
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160226/6913fa83/attachment.sig>
More information about the Libguestfs
mailing list