From: Oleg Drokin <gr...@linuxhacker.ru>

Move xattr_cache file from /proc/fs/lustre/llite/*
to /sys/fs/lustre/llite/*/

Signed-off-by: Oleg Drokin <gr...@linuxhacker.ru>
---
 drivers/staging/lustre/lustre/llite/lproc_llite.c | 30 +++++++++++------------
 drivers/staging/lustre/sysfs-fs-lustre            |  7 ++++++
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c 
b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index 7f29607..8270a81 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -737,26 +737,24 @@ static int ll_sbi_flags_seq_show(struct seq_file *m, void 
*v)
 }
 LPROC_SEQ_FOPS_RO(ll_sbi_flags);
 
-static int ll_xattr_cache_seq_show(struct seq_file *m, void *v)
+static ssize_t xattr_cache_show(struct kobject *kobj, char *buf)
 {
-       struct super_block *sb = m->private;
-       struct ll_sb_info *sbi = ll_s2sbi(sb);
-
-       seq_printf(m, "%u\n", sbi->ll_xattr_cache_enabled);
+       struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+                                             ll_kobj);
 
-       return 0;
+       return sprintf(buf, "%u\n", sbi->ll_xattr_cache_enabled);
 }
 
-static ssize_t ll_xattr_cache_seq_write(struct file *file,
-                                       const char __user *buffer,
-                                       size_t count, loff_t *off)
+static ssize_t xattr_cache_store(struct kobject *kobj,
+                                const char *buffer,
+                                size_t count)
 {
-       struct seq_file *seq = file->private_data;
-       struct super_block *sb = seq->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;
 
@@ -770,7 +768,7 @@ static ssize_t ll_xattr_cache_seq_write(struct file *file,
 
        return count;
 }
-LPROC_SEQ_FOPS(ll_xattr_cache);
+LUSTRE_RW_ATTR(xattr_cache);
 
 static struct lprocfs_vars lprocfs_llite_obd_vars[] = {
        /* { "mntpt_path",   ll_rd_path,             0, 0 }, */
@@ -779,7 +777,6 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = {
        { "max_cached_mb",    &ll_max_cached_mb_fops, NULL },
        { "statahead_stats",  &ll_statahead_stats_fops, NULL, 0 },
        { "sbi_flags",        &ll_sbi_flags_fops, NULL, 0 },
-       { "xattr_cache",      &ll_xattr_cache_fops, NULL, 0 },
        { NULL }
 };
 
@@ -807,6 +804,7 @@ static struct attribute *llite_attrs[] = {
        &lustre_attr_lazystatfs.attr,
        &lustre_attr_max_easize.attr,
        &lustre_attr_default_easize.attr,
+       &lustre_attr_xattr_cache.attr,
        NULL,
 };
 
diff --git a/drivers/staging/lustre/sysfs-fs-lustre 
b/drivers/staging/lustre/sysfs-fs-lustre
index bf3f82a..ec4ae47 100644
--- a/drivers/staging/lustre/sysfs-fs-lustre
+++ b/drivers/staging/lustre/sysfs-fs-lustre
@@ -183,3 +183,10 @@ Contact:   "Oleg Drokin" <oleg.dro...@intel.com>
 Description:
                Shows maximum observed file striping data seen by this
                filesystem client instance.
+
+What:          /sys/fs/lustre/llite/<fsname>-<uuid>/xattr_cache
+Date:          May 2015
+Contact:       "Oleg Drokin" <oleg.dro...@intel.com>
+Description:
+               Controls extended attributes client-side cache.
+               1 to enable, 0 to disable.
-- 
2.1.0

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to