Re: [PATCH] btrfs: introduce BTRFS_IOC_GET_DEVS

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

 



On Fri, Feb 07, 2014 at 06:08:56PM +0800, Anand Jain wrote:
> 
> 
>  Thanks for the comments.
> 
>  mainly here sysfs way defeats the purpose - debug as
>  mentioned. Sysfs would/should show only mounted disks,

   So let's find a way of showing the "known-about" data structure
separately from the "mounted" data structure. Just thinking aloud
here, how about something like this:

For unmounted, but known filesystems:
/sys/fs/btrfs/devmap/<UUID>/<symlink to device>   (for each device known)
/sys/fs/btrfs/devmap/<UUID>/label
/sys/fs/btrfs/devmap/<UUID>/complete      (0 if missing devices, 1 otherwise)
/sys/fs/btrfs/devmap/<UUID>/<other properties>

And then for mounted filesystems, we can populate the <other
properties> with more details as appropriate (and remove them when
unmounted again). We can also add a symlink to the <UUID> directory
for the filesystem to e.g.:

/sys/fs/btrfs/mounted/<symlink to UUID>

   If truly the *only* reason to do this is debug, then simply dump
the info in debugfs and have done with it. However, there are good
reasons to want to have this information in an ordinary running
system, too. So stick with sysfs, IMO.

>  the ioctl way doesn't have such a limitation (of course
>  as I commented memory dump way would have been best choice
>  but I got stuck with that approach if anybody wants to give
>  a try with that approach you are most welcome).
> 
>  IMO no harm to have both sysfs way and ioctl way let user
>  or developer use which were is suitable in their context.

   Extra maintenance overhead; divergence of the APIs. "You can find
out the label of the filesystem using sysfs, but not the ioctl. You
can find out the size of the filesystem using the ioctl, but not using
sysfs." That way lies quite a bit of pain for the user of the
interfaces.

   Hugo.

> Thanks, Anand
> 
> 
> On 02/07/2014 06:05 AM, David Sterba wrote:
> >On Thu, Feb 06, 2014 at 09:09:57PM +0100, Goffredo Baroncelli wrote:
> >>>With 3.14 the sysfs interface is available, but the devices under
> >>>  /sys/fs/btrfs/<fs-uuid>/devices/...
> >>>are symlinks to the sysfs devices, so this btrfs-specific device
> >>>information has to be located in a separate directory.
> >>
> >>yes please; it would scale better than the ioctl()s; anyway I suggest 1
> >>file per property, and not "...one file that holds all the stats
> >>  about the device"
> >
> >Well, we can do both, I don't have a preference and both make sense.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 65E74AC0 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
       --- Great oxymorons of the world, no. 4: Future Perfect ---       

Attachment: signature.asc
Description: Digital signature


[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