Message ID | feba5530a78df4066d5052aed57d814eb6f95814.1602055130.git.anand.jain@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: add fs_info generation to sysfs | expand |
On 7.10.20 г. 10:20 ч., Anand Jain wrote: > Matching with the information that's available from the ioctl > BTRFS_IOC_FS_INFO, this patch adds generation to the sysfs. > > Signed-off-by: Anand Jain <anand.jain@oracle.com> What problem are you trying to solve?
On Wed, Oct 07, 2020 at 10:50:27AM +0300, Nikolay Borisov wrote: > > > On 7.10.20 г. 10:20 ч., Anand Jain wrote: > > Matching with the information that's available from the ioctl > > BTRFS_IOC_FS_INFO, this patch adds generation to the sysfs. > > > > Signed-off-by: Anand Jain <anand.jain@oracle.com> > > What problem are you trying to solve? Parity of FS_INFO ioctl and sysfs exports.
On Wed, Oct 07, 2020 at 03:20:03PM +0800, Anand Jain wrote: > Matching with the information that's available from the ioctl > BTRFS_IOC_FS_INFO, this patch adds generation to the sysfs. > > Signed-off-by: Anand Jain <anand.jain@oracle.com> Added to misc-next, thanks.
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 279d9262b676..8424f5d0e5ed 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -854,6 +854,15 @@ static ssize_t btrfs_exclusive_operation_show(struct kobject *kobj, } BTRFS_ATTR(, exclusive_operation, btrfs_exclusive_operation_show); +static ssize_t btrfs_generation_show(struct kobject *kobj, + struct kobj_attribute *a, char *buf) +{ + struct btrfs_fs_info *fs_info = to_fs_info(kobj); + + return scnprintf(buf, PAGE_SIZE, "%llu\n", fs_info->generation); +} +BTRFS_ATTR(, generation, btrfs_generation_show); + static const struct attribute *btrfs_attrs[] = { BTRFS_ATTR_PTR(, label), BTRFS_ATTR_PTR(, nodesize), @@ -863,6 +872,7 @@ static const struct attribute *btrfs_attrs[] = { BTRFS_ATTR_PTR(, metadata_uuid), BTRFS_ATTR_PTR(, checksum), BTRFS_ATTR_PTR(, exclusive_operation), + BTRFS_ATTR_PTR(, generation), NULL, };
Matching with the information that's available from the ioctl BTRFS_IOC_FS_INFO, this patch adds generation to the sysfs. Signed-off-by: Anand Jain <anand.jain@oracle.com> --- fs/btrfs/sysfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+)