]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
staging/lustre/llite: move /proc/fs/lustre/llite/statahead_{max, agl} to sysfs
authorOleg Drokin <green@linuxhacker.ru>
Thu, 21 May 2015 19:31:50 +0000 (15:31 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 31 May 2015 01:50:18 +0000 (10:50 +0900)
Move statahead_max and statahead_agl files from /proc/fs/lustre/llite/*
to /sys/fs/lustre/llite/*/

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/llite/lproc_llite.c
drivers/staging/lustre/sysfs-fs-lustre

index 3f9cdd2a6a5c34910b3932fad3522763ca70bcc9..aa0e12b0a69b9d08684f42fbc660a645f5c6fa59 100644 (file)
@@ -603,55 +603,61 @@ static ssize_t stats_track_gid_store(struct kobject *kobj,
 }
 LUSTRE_RW_ATTR(stats_track_gid);
 
-static int ll_statahead_max_seq_show(struct seq_file *m, void *v)
+static ssize_t statahead_max_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_kobj);
 
-       seq_printf(m, "%u\n", sbi->ll_sa_max);
-       return 0;
+       return sprintf(buf, "%u\n", sbi->ll_sa_max);
 }
 
-static ssize_t ll_statahead_max_seq_write(struct file *file,
-                                         const char __user *buffer,
-                                         size_t count, loff_t *off)
+static ssize_t statahead_max_store(struct kobject *kobj,
+                                  struct attribute *attr,
+                                  const char *buffer,
+                                  size_t count)
 {
-       struct super_block *sb = ((struct seq_file *)file->private_data)->private;
-       struct ll_sb_info *sbi = ll_s2sbi(sb);
-       int val, rc;
+       struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+                                             ll_kobj);
+       int rc;
+       unsigned long val;
 
-       rc = lprocfs_write_helper(buffer, count, &val);
+       rc = kstrtoul(buffer, 10, &val);
        if (rc)
                return rc;
 
-       if (val >= 0 && val <= LL_SA_RPC_MAX)
+       if (val <= LL_SA_RPC_MAX)
                sbi->ll_sa_max = val;
        else
-               CERROR("Bad statahead_max value %d. Valid values are in the range [0, %d]\n",
+               CERROR("Bad statahead_max value %lu. Valid values are in the range [0, %d]\n",
                       val, LL_SA_RPC_MAX);
 
        return count;
 }
-LPROC_SEQ_FOPS(ll_statahead_max);
+LUSTRE_RW_ATTR(statahead_max);
 
-static int ll_statahead_agl_seq_show(struct seq_file *m, void *v)
+static ssize_t statahead_agl_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_kobj);
 
-       seq_printf(m, "%u\n", sbi->ll_flags & LL_SBI_AGL_ENABLED ? 1 : 0);
-       return 0;
+       return sprintf(buf, "%u\n", sbi->ll_flags & LL_SBI_AGL_ENABLED ? 1 : 0);
 }
 
-static ssize_t ll_statahead_agl_seq_write(struct file *file,
-                                         const char __user *buffer,
-                                         size_t count, loff_t *off)
+static ssize_t statahead_agl_store(struct kobject *kobj,
+                                  struct attribute *attr,
+                                  const char *buffer,
+                                  size_t count)
 {
-       struct super_block *sb = ((struct seq_file *)file->private_data)->private;
-       struct ll_sb_info *sbi = ll_s2sbi(sb);
-       int val, rc;
+       struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+                                             ll_kobj);
+       int rc;
+       unsigned long val;
 
-       rc = lprocfs_write_helper(buffer, count, &val);
+       rc = kstrtoul(buffer, 10, &val);
        if (rc)
                return rc;
 
@@ -662,7 +668,7 @@ static ssize_t ll_statahead_agl_seq_write(struct file *file,
 
        return count;
 }
-LPROC_SEQ_FOPS(ll_statahead_agl);
+LUSTRE_RW_ATTR(statahead_agl);
 
 static int ll_statahead_stats_seq_show(struct seq_file *m, void *v)
 {
@@ -838,8 +844,6 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = {
        { "site",         &ll_site_stats_fops,    NULL, 0 },
        /* { "filegroups",   lprocfs_rd_filegroups,  0, 0 }, */
        { "max_cached_mb",    &ll_max_cached_mb_fops, NULL },
-       { "statahead_max",    &ll_statahead_max_fops, NULL },
-       { "statahead_agl",    &ll_statahead_agl_fops, NULL },
        { "statahead_stats",  &ll_statahead_stats_fops, NULL, 0 },
        { "lazystatfs",       &ll_lazystatfs_fops, NULL },
        { "max_easize",       &ll_max_easize_fops, NULL, 0 },
@@ -870,6 +874,8 @@ static struct attribute *llite_attrs[] = {
        &lustre_attr_stats_track_pid.attr,
        &lustre_attr_stats_track_ppid.attr,
        &lustre_attr_stats_track_gid.attr,
+       &lustre_attr_statahead_max.attr,
+       &lustre_attr_statahead_agl.attr,
        NULL,
 };
 
index acf85cc57231fa7cb9086cf9e61b08c40e9dbcd2..2920eadbb844399738ddb260444e53ebe5a86307 100644 (file)
@@ -145,3 +145,19 @@ Contact:   "Oleg Drokin" <oleg.drokin@intel.com>
 Description:
                Limit Lustre vfs operations gathering to just a single gid.
                0 to track everything.
+
+What:          /sys/fs/lustre/llite/<fsname>-<uuid>/statahead_max
+Date:          May 2015
+Contact:       "Oleg Drokin" <oleg.drokin@intel.com>
+Description:
+               Controls maximum number of statahead requests to send when
+               sequential readdir+stat pattern is detected.
+
+What:          /sys/fs/lustre/llite/<fsname>-<uuid>/statahead_agl
+Date:          May 2015
+Contact:       "Oleg Drokin" <oleg.drokin@intel.com>
+Description:
+               Controls if AGL (async glimpse ahead - obtain object information
+               from OSTs in parallel with MDS during statahead) should be
+               enabled or disabled.
+               0 to disable, 1 to enable.