From: James Simmons Date: Fri, 21 Sep 2018 15:02:18 +0000 (-0400) Subject: LU-8066 llite: move /proc/fs/lustre/llite/lazystatfs to sysfs X-Git-Tag: 2.11.56~42 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=02af2adc9b338d12a83fc7642662979ca9f341db;p=fs%2Flustre-release.git LU-8066 llite: move /proc/fs/lustre/llite/lazystatfs to sysfs 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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/32505 Reviewed-by: Andreas Dilger Reviewed-by: Ben Evans Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 46d3df9..fe64d7b 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -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, };