Re: btrfs and /proc/self/mountinfo

2009-04-13 Thread Chris Mason
On Sun, 2009-04-12 at 10:35 -0400, David Zeuthen wrote:
 Hi,
 
 I have a question about how btrfs is supposed to work with
 /proc/self/mountinfo. It appears that the dev_t isn't matching what
 one would expect when mounting a btrfs filesystem - here's /dev/sdb2
 mounted at /media/usb-fedora
 
  # cat /proc/self/mountinfo |grep btrfs
  17 19 0:19 / /media/usb-fedora rw,nosuid,nodev,relatime - btrfs /dev/sdb2 rw
 

Yes, this is because I switched to an anonymous super to remove
restrictions about which devices could be removed from a mounted
filesystem. 

Today it is possible to do something like this:

mkfs.ext3 /dev/sdb
mkfs.ext3 /dev/sdc

mount /dev/sdb /mnt
mount /dev/sdc /mnt

Which gives me this in mountinfo:

29 14 8:16 / /mnt rw - ext3 /dev/sdb rw,errors=continue,data=ordered
31 29 8:32 / /mnt rw - ext3 /dev/sdc rw,errors=continue,data=ordered

So, applications can already see duplicate device entries for the same
mount point.  Do they deal with that today?  I'm not sure I'll be able
to get control over the dev_ts mountinfo spits out just for btrfs, but
we can always float a patch.

Otherwise, we'll have to use the sysfs goo Kay is working on.

-chris


--
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


Re: btrfs and /proc/self/mountinfo

2009-04-12 Thread Kay Sievers
On Sun, Apr 12, 2009 at 07:35, David Zeuthen zeut...@gmail.com wrote:

 But we'd still need some kind of way of having the kernel tell user
 space what devices are currently claimed by the btrfs filesystem
 instance (and we'd need notifications on changes too). Otherwise we
 don't have enough information for the desktop shell and partitioning
 programs to let the user know that /dev/sdb2 or /dev/sdc1 or whatever
 is currently claimed by the 0:19 btrfs mount at /media/fedora-usb.

 One idea is to have a pollable file, /proc/fs/btrfs/devs, that maps
 from the dev_t of the btrfs filesystem instance (as used in
 /proc/self/mountinfo) to the set of dev_t for block devices currently
 claimed? E.g. for the example above we'd have

  /proc/fs/btrfs/devs:
  0:19    8:18

Btrfs used to export some information in /sys/fs/btrfs/, this is
disabled for now. Maybe we can possibly make it export something like:
  $ tree /sys/fs/btrfs/
  /sys/fs/btrfs/
  |-- 969d1386-a002-4c28-94f2-47be23f344e4
  |   |-- ba1532f3-849b-400b-9c76-2c9aee126c52
  |   |   |-- device - ../../../devices/.../block/sda/sda3
  |   |   |-- attribute1
  |   |   |-- ...
  |   `-- 45645656-849b-400b-9c76-2c9aee126c52
  |   |-- device - ../../../devices/.../block/sdb/sdb3
  |   |-- attribute1
  |   
  `-- 645645686-a002-4c28-94f2-47be23f344e4
  |-- ...


So you could look for a device link at the subvolume devices? Or if
that does not fit for some reason, we could also add a btrfs class,
to export details about the subvolumes.

Thanks,
Kay
--
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