mbox series

[v2,0/2] provide fsid in sysfs devinfo

Message ID cover.1634829757.git.anand.jain@oracle.com (mailing list archive)
Headers show
Series provide fsid in sysfs devinfo | expand

Message

Anand Jain Oct. 21, 2021, 3:31 p.m. UTC
v2:
Fix sysfs_emit conversion at the two non-sysfs show functions in patch1.

btrfs-progs tries to read the fsid from the super-block for a missing
device and, it fails. It needs to find out if the device is a seed
device. It does it by comparing the device's fsid with the fsid of the
mounted filesystem. To help this scenario introduce a new sysfs file to
read the fsid from the kernel.
     /sys/fs/btrfs/<fsid>/devinfo/<devid>/fsid

Patch 1 is a cleanup converts scnprtin()f and snprintf() to sysfs_emit()
Patch 2 introduces the new sysfs interface as above

The other implementation choice is to add another parameter to the
struct btrfs_ioctl_dev_info_args and use BTRFS_IOC_DEV_INFO ioctl. But
then backward kernel compatibility with the newer btrfs-progs is more
complicated. If needed, we can add that too.

Related btrfs-progs patches:
  btrfs-progs: prepare helper device_is_seed
  btrfs-progs: read fsid from the sysfs in device_is_seed

Anand Jain (2):
  btrfs: sysfs convert scnprintf and snprintf to use sysfs_emit
  btrfs: sysfs add devinfo/fsid to retrieve fsid from the device

 fs/btrfs/sysfs.c | 106 +++++++++++++++++++++++++----------------------
 1 file changed, 57 insertions(+), 49 deletions(-)

Comments

Anand Jain Nov. 9, 2021, 10:09 a.m. UTC | #1
David,

  And this one could also merge?

Thanks, Anand


On 21/10/21 11:31 pm, Anand Jain wrote:
> v2:
> Fix sysfs_emit conversion at the two non-sysfs show functions in patch1.
> 
> btrfs-progs tries to read the fsid from the super-block for a missing
> device and, it fails. It needs to find out if the device is a seed
> device. It does it by comparing the device's fsid with the fsid of the
> mounted filesystem. To help this scenario introduce a new sysfs file to
> read the fsid from the kernel.
>       /sys/fs/btrfs/<fsid>/devinfo/<devid>/fsid
> 
> Patch 1 is a cleanup converts scnprtin()f and snprintf() to sysfs_emit()
> Patch 2 introduces the new sysfs interface as above
> 
> The other implementation choice is to add another parameter to the
> struct btrfs_ioctl_dev_info_args and use BTRFS_IOC_DEV_INFO ioctl. But
> then backward kernel compatibility with the newer btrfs-progs is more
> complicated. If needed, we can add that too.
> 
> Related btrfs-progs patches:
>    btrfs-progs: prepare helper device_is_seed
>    btrfs-progs: read fsid from the sysfs in device_is_seed
> 
> Anand Jain (2):
>    btrfs: sysfs convert scnprintf and snprintf to use sysfs_emit
>    btrfs: sysfs add devinfo/fsid to retrieve fsid from the device
> 
>   fs/btrfs/sysfs.c | 106 +++++++++++++++++++++++++----------------------
>   1 file changed, 57 insertions(+), 49 deletions(-)
>