Whamcloud - gitweb
LU-8066 llite: move /proc/fs/lustre/llite/lazystatfs to sysfs 05/32505/3
authorJames Simmons <uja.ornl@yahoo.com>
Fri, 21 Sep 2018 15:02:18 +0000 (11:02 -0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 5 Oct 2018 22:26:25 +0000 (22:26 +0000)
Move lazystatfs file from /proc/fs/lustre/llite/*
to /sys/fs/lustre/llite/*/

This is a modified version of

Linux-commit: c7fe64bdd0623f5871800ff42842741175f19562

due to the large amount of changes to the OpenSFS/Intel branch.

Change-Id: I279f3361ae7b779bbd186504f5c4072b265330f9
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/32505
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Ben Evans <bevans@cray.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/lproc_llite.c

index 46d3df9..fe64d7b 100644 (file)
@@ -823,26 +823,27 @@ static int ll_statahead_stats_seq_show(struct seq_file *m, void *v)
 }
 LPROC_SEQ_FOPS_RO(ll_statahead_stats);
 
-static int ll_lazystatfs_seq_show(struct seq_file *m, void *v)
+static ssize_t lazystatfs_show(struct kobject *kobj,
+                              struct attribute *attr,
+                              char *buf)
 {
-       struct super_block *sb = m->private;
-       struct ll_sb_info *sbi = ll_s2sbi(sb);
+       struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+                                             ll_kset.kobj);
 
-       seq_printf(m, "%u\n",
-                  (sbi->ll_flags & LL_SBI_LAZYSTATFS) ? 1 : 0);
-       return 0;
+       return sprintf(buf, "%u\n", (sbi->ll_flags & LL_SBI_LAZYSTATFS) ? 1 : 0);
 }
 
-static ssize_t ll_lazystatfs_seq_write(struct file *file,
-                                      const char __user *buffer,
-                                       size_t count, loff_t *off)
+static ssize_t lazystatfs_store(struct kobject *kobj,
+                               struct attribute *attr,
+                               const char *buffer,
+                               size_t count)
 {
-       struct seq_file *m = file->private_data;
-       struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
+       struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+                                             ll_kset.kobj);
        bool val;
        int rc;
 
-       rc = kstrtobool_from_user(buffer, count, &val);
+       rc = kstrtobool(buffer, &val);
        if (rc)
                return rc;
 
@@ -853,7 +854,7 @@ static ssize_t ll_lazystatfs_seq_write(struct file *file,
 
        return count;
 }
-LPROC_SEQ_FOPS(ll_lazystatfs);
+LUSTRE_RW_ATTR(lazystatfs);
 
 static int ll_max_easize_seq_show(struct seq_file *m, void *v)
 {
@@ -1195,8 +1196,6 @@ struct lprocfs_vars lprocfs_llite_obd_vars[] = {
          .fops =       &ll_max_cached_mb_fops                  },
        { .name =       "statahead_stats",
          .fops =       &ll_statahead_stats_fops                },
-       { .name =       "lazystatfs",
-         .fops =       &ll_lazystatfs_fops                     },
        { .name =       "max_easize",
          .fops =       &ll_max_easize_fops                     },
        { .name =       "default_easize",
@@ -1239,6 +1238,7 @@ static struct attribute *llite_attrs[] = {
        &lustre_attr_statahead_running_max.attr,
        &lustre_attr_statahead_max.attr,
        &lustre_attr_statahead_agl.attr,
+       &lustre_attr_lazystatfs.attr,
        NULL,
 };