From: James Simmons Date: Sat, 28 Jul 2018 16:02:35 +0000 (-0400) Subject: LU-8066 llite: move /proc/fs/lustre/llite/files* to sysfs X-Git-Tag: 2.11.54~29 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=3a8f2e2c87b58a1405277abb59e225838d6b0984 LU-8066 llite: move /proc/fs/lustre/llite/files* to sysfs Move filestotal and filesfree files from /proc/fs/lustre/llite/* to /sys/fs/lustre/llite/*/ This is a modified version of Linux-commit: 7267ec0d8726c214aaf24ca9e8baebb443b0da75 due to the large amount of changes to the OpenSFS/Intel branch. Change-Id: I84b6d6a0868058d60a83a0700f0389d3ba685ddb Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/32498 Reviewed-by: Andreas Dilger Reviewed-by: Bobi Jam Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index c777d35..c9ee782 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -203,33 +203,37 @@ static ssize_t kbytesavail_show(struct kobject *kobj, struct attribute *attr, } LUSTRE_RO_ATTR(kbytesavail); -static int ll_filestotal_seq_show(struct seq_file *m, void *v) +static ssize_t filestotal_show(struct kobject *kobj, struct attribute *attr, + char *buf) { - struct super_block *sb = m->private; + struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, + ll_kset.kobj); struct obd_statfs osfs; int rc; - LASSERT(sb != NULL); - rc = ll_statfs_internal(ll_s2sbi(sb), &osfs, OBD_STATFS_NODELAY); - if (!rc) - seq_printf(m, "%llu\n", osfs.os_files); - return rc; + rc = ll_statfs_internal(sbi, &osfs, OBD_STATFS_NODELAY); + if (rc) + return rc; + + return sprintf(buf, "%llu\n", osfs.os_files); } -LPROC_SEQ_FOPS_RO(ll_filestotal); +LUSTRE_RO_ATTR(filestotal); -static int ll_filesfree_seq_show(struct seq_file *m, void *v) +static ssize_t filesfree_show(struct kobject *kobj, struct attribute *attr, + char *buf) { - struct super_block *sb = m->private; + struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, + ll_kset.kobj); struct obd_statfs osfs; int rc; - LASSERT(sb != NULL); - rc = ll_statfs_internal(ll_s2sbi(sb), &osfs, OBD_STATFS_NODELAY); - if (!rc) - seq_printf(m, "%llu\n", osfs.os_ffree); - return rc; + rc = ll_statfs_internal(sbi, &osfs, OBD_STATFS_NODELAY); + if (rc) + return rc; + + return sprintf(buf, "%llu\n", osfs.os_ffree); } -LPROC_SEQ_FOPS_RO(ll_filesfree); +LUSTRE_RO_ATTR(filesfree); static int ll_client_type_seq_show(struct seq_file *m, void *v) { @@ -1183,10 +1187,6 @@ struct lprocfs_vars lprocfs_llite_obd_vars[] = { .fops = &ll_site_stats_fops }, { .name = "stat_blocksize", .fops = &ll_stat_blksize_fops }, - { .name = "filestotal", - .fops = &ll_filestotal_fops }, - { .name = "filesfree", - .fops = &ll_filesfree_fops }, { .name = "client_type", .fops = &ll_client_type_fops }, { .name = "max_read_ahead_mb", @@ -1243,6 +1243,8 @@ static struct attribute *llite_attrs[] = { &lustre_attr_kbytestotal.attr, &lustre_attr_kbytesfree.attr, &lustre_attr_kbytesavail.attr, + &lustre_attr_filestotal.attr, + &lustre_attr_filesfree.attr, &lustre_attr_statahead_running_max.attr, NULL, };