Whamcloud - gitweb
LU-8066 llite: move /proc/fs/lustre/llite/checksum_pages to sysfs 02/32502/8
authorJames Simmons <uja.ornl@yahoo.com>
Thu, 16 Aug 2018 23:48:25 +0000 (19:48 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 10 Sep 2018 16:54:17 +0000 (16:54 +0000)
Move checksum_pages file from /proc/fs/lustre/llite/*
to /sys/fs/lustre/llite/*/

This is a modified version of

Linux-commit: 40cc864a9fcd48d7f3a67421a8e578e8d4cbe308

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

Change-Id: Ice48c69503680ac995b60844a8d0d7ae2bddd102
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/32502
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Sonia Sharma <sharmaso@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/llite/lproc_llite.c

index f585dd6..66d0f11 100644 (file)
@@ -580,21 +580,22 @@ out:
 }
 LPROC_SEQ_FOPS(ll_max_cached_mb);
 
-static int ll_checksum_seq_show(struct seq_file *m, void *v)
+static ssize_t checksum_pages_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_CHECKSUM) ? 1 : 0);
-       return 0;
+       return sprintf(buf, "%u\n", (sbi->ll_flags & LL_SBI_CHECKSUM) ? 1 : 0);
 }
 
-static ssize_t ll_checksum_seq_write(struct file *file,
-                                    const char __user *buffer,
-                                    size_t count, loff_t *off)
+static ssize_t checksum_pages_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 tmp;
        int rc;
@@ -603,7 +604,7 @@ static ssize_t ll_checksum_seq_write(struct file *file,
                /* Not set up yet */
                return -EAGAIN;
 
-       rc = kstrtobool_from_user(buffer, count, &val);
+       rc = kstrtobool(buffer, &val);
        if (rc)
                return rc;
        if (val)
@@ -619,7 +620,7 @@ static ssize_t ll_checksum_seq_write(struct file *file,
 
        return count;
 }
-LPROC_SEQ_FOPS(ll_checksum);
+LUSTRE_RW_ATTR(checksum_pages);
 
 static int ll_rd_track_id(struct seq_file *m, enum stats_track_type type)
 {
@@ -1183,8 +1184,6 @@ struct lprocfs_vars lprocfs_llite_obd_vars[] = {
          .fops =       &ll_max_read_ahead_whole_mb_fops        },
        { .name =       "max_cached_mb",
          .fops =       &ll_max_cached_mb_fops                  },
-       { .name =       "checksum_pages",
-         .fops =       &ll_checksum_fops                       },
        { .name =       "stats_track_pid",
          .fops =       &ll_track_pid_fops                      },
        { .name =       "stats_track_ppid",
@@ -1234,6 +1233,7 @@ static struct attribute *llite_attrs[] = {
        &lustre_attr_client_type.attr,
        &lustre_attr_fstype.attr,
        &lustre_attr_uuid.attr,
+       &lustre_attr_checksum_pages.attr,
        &lustre_attr_statahead_running_max.attr,
        NULL,
 };