Commit ec469235 authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman

staging/lustre/llite: move llite/max_read_ahead_whole_mb to sysfs

Move max_read_ahead_whole_mb file from /proc/fs/lustre/llite/*
to /sys/fs/lustre/llite/*/
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0e6c5a21
...@@ -312,10 +312,12 @@ static ssize_t max_read_ahead_per_file_mb_store(struct kobject *kobj, ...@@ -312,10 +312,12 @@ static ssize_t max_read_ahead_per_file_mb_store(struct kobject *kobj,
} }
LUSTRE_RW_ATTR(max_read_ahead_per_file_mb); LUSTRE_RW_ATTR(max_read_ahead_per_file_mb);
static int ll_max_read_ahead_whole_mb_seq_show(struct seq_file *m, void *unused) static ssize_t max_read_ahead_whole_mb_show(struct kobject *kobj,
struct attribute *attr,
char *buf)
{ {
struct super_block *sb = m->private; struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
struct ll_sb_info *sbi = ll_s2sbi(sb); ll_kobj);
long pages_number; long pages_number;
int mult; int mult;
...@@ -324,26 +326,26 @@ static int ll_max_read_ahead_whole_mb_seq_show(struct seq_file *m, void *unused) ...@@ -324,26 +326,26 @@ static int ll_max_read_ahead_whole_mb_seq_show(struct seq_file *m, void *unused)
spin_unlock(&sbi->ll_lock); spin_unlock(&sbi->ll_lock);
mult = 1 << (20 - PAGE_CACHE_SHIFT); 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_read_ahead_whole_mb_seq_write(struct file *file, static ssize_t max_read_ahead_whole_mb_store(struct kobject *kobj,
const char __user *buffer, struct attribute *attr,
size_t count, loff_t *off) const char *buffer,
size_t count)
{ {
struct super_block *sb = ((struct seq_file *)file->private_data)->private; struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
struct ll_sb_info *sbi = ll_s2sbi(sb); ll_kobj);
int mult, rc, pages_number; int rc;
unsigned long pages_number;
mult = 1 << (20 - PAGE_CACHE_SHIFT); rc = kstrtoul(buffer, 10, &pages_number);
rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
if (rc) if (rc)
return rc; return rc;
/* Cap this at the current max readahead window size, the readahead /* Cap this at the current max readahead window size, the readahead
* algorithm does this anyway so it's pointless to set it larger. */ * algorithm does this anyway so it's pointless to set it larger. */
if (pages_number < 0 || if (pages_number > sbi->ll_ra_info.ra_max_pages_per_file) {
pages_number > sbi->ll_ra_info.ra_max_pages_per_file) {
CERROR("can't set max_read_ahead_whole_mb more than max_read_ahead_per_file_mb: %lu\n", CERROR("can't set max_read_ahead_whole_mb more than max_read_ahead_per_file_mb: %lu\n",
sbi->ll_ra_info.ra_max_pages_per_file >> (20 - PAGE_CACHE_SHIFT)); sbi->ll_ra_info.ra_max_pages_per_file >> (20 - PAGE_CACHE_SHIFT));
return -ERANGE; return -ERANGE;
...@@ -355,7 +357,7 @@ static ssize_t ll_max_read_ahead_whole_mb_seq_write(struct file *file, ...@@ -355,7 +357,7 @@ static ssize_t ll_max_read_ahead_whole_mb_seq_write(struct file *file,
return count; return count;
} }
LPROC_SEQ_FOPS(ll_max_read_ahead_whole_mb); LUSTRE_RW_ATTR(max_read_ahead_whole_mb);
static int ll_max_cached_mb_seq_show(struct seq_file *m, void *v) static int ll_max_cached_mb_seq_show(struct seq_file *m, void *v)
{ {
...@@ -847,7 +849,6 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = { ...@@ -847,7 +849,6 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = {
/* { "mntpt_path", ll_rd_path, 0, 0 }, */ /* { "mntpt_path", ll_rd_path, 0, 0 }, */
{ "site", &ll_site_stats_fops, NULL, 0 }, { "site", &ll_site_stats_fops, NULL, 0 },
/* { "filegroups", lprocfs_rd_filegroups, 0, 0 }, */ /* { "filegroups", lprocfs_rd_filegroups, 0, 0 }, */
{ "max_read_ahead_whole_mb", &ll_max_read_ahead_whole_mb_fops, NULL },
{ "max_cached_mb", &ll_max_cached_mb_fops, NULL }, { "max_cached_mb", &ll_max_cached_mb_fops, NULL },
{ "checksum_pages", &ll_checksum_fops, NULL }, { "checksum_pages", &ll_checksum_fops, NULL },
{ "max_rw_chunk", &ll_max_rw_chunk_fops, NULL }, { "max_rw_chunk", &ll_max_rw_chunk_fops, NULL },
...@@ -881,6 +882,7 @@ static struct attribute *llite_attrs[] = { ...@@ -881,6 +882,7 @@ static struct attribute *llite_attrs[] = {
&lustre_attr_uuid.attr, &lustre_attr_uuid.attr,
&lustre_attr_max_read_ahead_mb.attr, &lustre_attr_max_read_ahead_mb.attr,
&lustre_attr_max_read_ahead_per_file_mb.attr, &lustre_attr_max_read_ahead_per_file_mb.attr,
&lustre_attr_max_read_ahead_whole_mb.attr,
NULL, NULL,
}; };
......
...@@ -110,3 +110,10 @@ Date: May 2015 ...@@ -110,3 +110,10 @@ Date: May 2015
Contact: "Oleg Drokin" <oleg.drokin@intel.com> Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description: Description:
Sets maximum number of megabytes to read-ahead for a single file Sets maximum number of megabytes to read-ahead for a single file
What: /sys/fs/lustre/llite/<fsname>-<uuid>/max_read_ahead_whole_mb
Date: May 2015
Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description:
For small reads, how many megabytes to actually request from
the server as initial read-ahead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment