Whamcloud - gitweb
LU-8066 llite: move /proc/fs/lustre/llite/files* to sysfs 98/32498/6
authorJames Simmons <uja.ornl@yahoo.com>
Sat, 28 Jul 2018 16:02:35 +0000 (12:02 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 6 Aug 2018 14:35:27 +0000 (14:35 +0000)
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 <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/32498
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/lproc_llite.c

index c777d35..c9ee782 100644 (file)
@@ -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,
 };