Re: Subvolumes and /proc/self/mountinfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 18, 2012 at 06:39:31PM -0600, H. Peter Anvin wrote:
> I'm trying to figure out an algorithm from taking an arbitrary mounted
> btrfs directory and break it down into:
> 
> <device(s), subvolume, subpath>
> 
> where, keep in mind, <subpath> may not actually be part of the mount.

Do you want an API for this, or is it enough to wander through /dev/disk
style symlinks?

The big reason it isn't here yet is because Kay had this neat patch to
blkid and udev to just put all the info you need into /dev/btrfs (or
some other suitable location).  It would allow you to see which devices
belong to which filesystems etc.

> 
> /proc/self/mountinfo seems to have some of that information, however, it
> does not appear to distinguish between non-default subvolumes and
> directories.  At the same time, once I have mounted a subvolume I see
> its name in the root btrfs directory even if I didn't access it.
> 
> Questions, thus:
> 
> a. Are subvolumes always part of the "root" namespace?  If so, is it the
> mounted root, the default subvolume, or subvolume 0 which always exposes
> these other subvolumes?  Are there disambiguation rules so that if I
> have /btrfs/root/blah and "blah" is both a subvolume and a directory (I
> presume that can happen?)

subvolumes may become disconnected from the root namespace.  In this
case we can find it just by the subvol id, and mount it into an
arbitrary directory.

> 
> b. Are there better ways (walking the tree using BTRFS_IOC_TREE_SEARCH?)
> to accomplish this than using /proc/self/mountinfo?

Not yet, but I'm definitely open to adding them.  Lets just hash out
what you need and we'll either go through Kay's stuff or add ioctls for
you.

-chris
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux