summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Drokin <green@linuxhacker.ru>2015-05-21 15:31:44 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-05-31 10:48:03 +0900
commite1a1df5e885ccf71cf2037b0c7ac4a5fd3a0e27f (patch)
tree1db4682e72bdde16dd1e77d011099264e2915bb3
parentec55a6299990efa969dfc00d95c72444ff1e3461 (diff)
downloadop-kernel-dev-e1a1df5e885ccf71cf2037b0c7ac4a5fd3a0e27f.zip
op-kernel-dev-e1a1df5e885ccf71cf2037b0c7ac4a5fd3a0e27f.tar.gz
staging/lustre/llite: move /proc/fs/lustre/llite/max_read_ahead_mb to sysfs
Move max_read_ahead_mb file 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>
-rw-r--r--drivers/staging/lustre/lustre/llite/lproc_llite.c35
-rw-r--r--drivers/staging/lustre/sysfs-fs-lustre7
2 files changed, 27 insertions, 15 deletions
diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index deee702..5baffc1 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -220,10 +220,11 @@ static int ll_site_stats_seq_show(struct seq_file *m, void *v)
}
LPROC_SEQ_FOPS_RO(ll_site_stats);
-static int ll_max_readahead_mb_seq_show(struct seq_file *m, void *v)
+static ssize_t max_read_ahead_mb_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);
long pages_number;
int mult;
@@ -232,23 +233,27 @@ static int ll_max_readahead_mb_seq_show(struct seq_file *m, void *v)
spin_unlock(&sbi->ll_lock);
mult = 1 << (20 - PAGE_CACHE_SHIFT);
- return lprocfs_seq_read_frac_helper(m, pages_number, mult);
+ return lprocfs_read_frac_helper(buf, PAGE_SIZE, pages_number, mult);
}
-static ssize_t ll_max_readahead_mb_seq_write(struct file *file,
- const char __user *buffer,
- size_t count, loff_t *off)
+static ssize_t max_read_ahead_mb_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 mult, rc, pages_number;
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kobj);
+ int rc;
+ unsigned long pages_number;
- mult = 1 << (20 - PAGE_CACHE_SHIFT);
- rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
+ rc = kstrtoul(buffer, 10, &pages_number);
if (rc)
return rc;
- if (pages_number < 0 || pages_number > totalram_pages / 2) {
+ pages_number *= 1 << (20 - PAGE_CACHE_SHIFT); /* MB -> pages */
+
+ if (pages_number > totalram_pages / 2) {
+
CERROR("can't set file readahead more than %lu MB\n",
totalram_pages >> (20 - PAGE_CACHE_SHIFT + 1)); /*1/2 of RAM*/
return -ERANGE;
@@ -260,7 +265,7 @@ static ssize_t ll_max_readahead_mb_seq_write(struct file *file,
return count;
}
-LPROC_SEQ_FOPS(ll_max_readahead_mb);
+LUSTRE_RW_ATTR(max_read_ahead_mb);
static int ll_max_readahead_per_file_mb_seq_show(struct seq_file *m, void *v)
{
@@ -840,7 +845,6 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = {
/* { "mntpt_path", ll_rd_path, 0, 0 }, */
{ "site", &ll_site_stats_fops, NULL, 0 },
/* { "filegroups", lprocfs_rd_filegroups, 0, 0 }, */
- { "max_read_ahead_mb", &ll_max_readahead_mb_fops, NULL },
{ "max_read_ahead_per_file_mb", &ll_max_readahead_per_file_mb_fops,
NULL },
{ "max_read_ahead_whole_mb", &ll_max_read_ahead_whole_mb_fops, NULL },
@@ -875,6 +879,7 @@ static struct attribute *llite_attrs[] = {
&lustre_attr_client_type.attr,
&lustre_attr_fstype.attr,
&lustre_attr_uuid.attr,
+ &lustre_attr_max_read_ahead_mb.attr,
NULL,
};
diff --git a/drivers/staging/lustre/sysfs-fs-lustre b/drivers/staging/lustre/sysfs-fs-lustre
index f353d12..fa32197 100644
--- a/drivers/staging/lustre/sysfs-fs-lustre
+++ b/drivers/staging/lustre/sysfs-fs-lustre
@@ -97,3 +97,10 @@ Date: May 2015
Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description:
Shows this filesystem superblock uuid
+
+What: /sys/fs/lustre/llite/<fsname>-<uuid>/max_read_ahead_mb
+Date: May 2015
+Contact: "Oleg Drokin" <oleg.drokin@intel.com>
+Description:
+ Sets maximum number of megabytes in system memory to be
+ given to read-ahead cache.
OpenPOWER on IntegriCloud