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

staging/lustre/llite: move /proc/fs/lustre/llite/stats_track* to sysfs

Move stats_track_pid, stats_track_ppid and stats_track_gid  files
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 06ed0cd8
...@@ -520,79 +520,88 @@ static ssize_t checksum_pages_store(struct kobject *kobj, ...@@ -520,79 +520,88 @@ static ssize_t checksum_pages_store(struct kobject *kobj,
} }
LUSTRE_RW_ATTR(checksum_pages); LUSTRE_RW_ATTR(checksum_pages);
static int ll_rd_track_id(struct seq_file *m, enum stats_track_type type) static ssize_t ll_rd_track_id(struct kobject *kobj, char *buf,
enum stats_track_type type)
{ {
struct super_block *sb = m->private; struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
ll_kobj);
if (ll_s2sbi(sb)->ll_stats_track_type == type) if (sbi->ll_stats_track_type == type)
seq_printf(m, "%d\n", ll_s2sbi(sb)->ll_stats_track_id); return sprintf(buf, "%d\n", sbi->ll_stats_track_id);
else if (ll_s2sbi(sb)->ll_stats_track_type == STATS_TRACK_ALL) else if (sbi->ll_stats_track_type == STATS_TRACK_ALL)
seq_puts(m, "0 (all)\n"); return sprintf(buf, "0 (all)\n");
else else
seq_puts(m, "untracked\n"); return sprintf(buf, "untracked\n");
return 0;
} }
static int ll_wr_track_id(const char __user *buffer, unsigned long count, static ssize_t ll_wr_track_id(struct kobject *kobj, const char *buffer,
void *data, enum stats_track_type type) size_t count,
enum stats_track_type type)
{ {
struct super_block *sb = data; struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
int rc, pid; ll_kobj);
int rc;
unsigned long pid;
rc = lprocfs_write_helper(buffer, count, &pid); rc = kstrtoul(buffer, 10, &pid);
if (rc) if (rc)
return rc; return rc;
ll_s2sbi(sb)->ll_stats_track_id = pid; sbi->ll_stats_track_id = pid;
if (pid == 0) if (pid == 0)
ll_s2sbi(sb)->ll_stats_track_type = STATS_TRACK_ALL; sbi->ll_stats_track_type = STATS_TRACK_ALL;
else else
ll_s2sbi(sb)->ll_stats_track_type = type; sbi->ll_stats_track_type = type;
lprocfs_clear_stats(ll_s2sbi(sb)->ll_stats); lprocfs_clear_stats(sbi->ll_stats);
return count; return count;
} }
static int ll_track_pid_seq_show(struct seq_file *m, void *v) static ssize_t stats_track_pid_show(struct kobject *kobj,
struct attribute *attr,
char *buf)
{ {
return ll_rd_track_id(m, STATS_TRACK_PID); return ll_rd_track_id(kobj, buf, STATS_TRACK_PID);
} }
static ssize_t ll_track_pid_seq_write(struct file *file, static ssize_t stats_track_pid_store(struct kobject *kobj,
const char __user *buffer, struct attribute *attr,
size_t count, loff_t *off) const char *buffer,
size_t count)
{ {
struct seq_file *seq = file->private_data; return ll_wr_track_id(kobj, buffer, count, STATS_TRACK_PID);
return ll_wr_track_id(buffer, count, seq->private, STATS_TRACK_PID);
} }
LPROC_SEQ_FOPS(ll_track_pid); LUSTRE_RW_ATTR(stats_track_pid);
static int ll_track_ppid_seq_show(struct seq_file *m, void *v) static ssize_t stats_track_ppid_show(struct kobject *kobj,
struct attribute *attr,
char *buf)
{ {
return ll_rd_track_id(m, STATS_TRACK_PPID); return ll_rd_track_id(kobj, buf, STATS_TRACK_PPID);
} }
static ssize_t ll_track_ppid_seq_write(struct file *file, static ssize_t stats_track_ppid_store(struct kobject *kobj,
const char __user *buffer, struct attribute *attr,
size_t count, loff_t *off) const char *buffer,
size_t count)
{ {
struct seq_file *seq = file->private_data; return ll_wr_track_id(kobj, buffer, count, STATS_TRACK_PPID);
return ll_wr_track_id(buffer, count, seq->private, STATS_TRACK_PPID);
} }
LPROC_SEQ_FOPS(ll_track_ppid); LUSTRE_RW_ATTR(stats_track_ppid);
static int ll_track_gid_seq_show(struct seq_file *m, void *v) static ssize_t stats_track_gid_show(struct kobject *kobj,
struct attribute *attr,
char *buf)
{ {
return ll_rd_track_id(m, STATS_TRACK_GID); return ll_rd_track_id(kobj, buf, STATS_TRACK_GID);
} }
static ssize_t ll_track_gid_seq_write(struct file *file, static ssize_t stats_track_gid_store(struct kobject *kobj,
const char __user *buffer, struct attribute *attr,
size_t count, loff_t *off) const char *buffer,
size_t count)
{ {
struct seq_file *seq = file->private_data; return ll_wr_track_id(kobj, buffer, count, STATS_TRACK_GID);
return ll_wr_track_id(buffer, count, seq->private, STATS_TRACK_GID);
} }
LPROC_SEQ_FOPS(ll_track_gid); LUSTRE_RW_ATTR(stats_track_gid);
static int ll_statahead_max_seq_show(struct seq_file *m, void *v) static int ll_statahead_max_seq_show(struct seq_file *m, void *v)
{ {
...@@ -829,9 +838,6 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = { ...@@ -829,9 +838,6 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = {
{ "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_cached_mb", &ll_max_cached_mb_fops, NULL }, { "max_cached_mb", &ll_max_cached_mb_fops, NULL },
{ "stats_track_pid", &ll_track_pid_fops, NULL },
{ "stats_track_ppid", &ll_track_ppid_fops, NULL },
{ "stats_track_gid", &ll_track_gid_fops, NULL },
{ "statahead_max", &ll_statahead_max_fops, NULL }, { "statahead_max", &ll_statahead_max_fops, NULL },
{ "statahead_agl", &ll_statahead_agl_fops, NULL }, { "statahead_agl", &ll_statahead_agl_fops, NULL },
{ "statahead_stats", &ll_statahead_stats_fops, NULL, 0 }, { "statahead_stats", &ll_statahead_stats_fops, NULL, 0 },
...@@ -861,6 +867,9 @@ static struct attribute *llite_attrs[] = { ...@@ -861,6 +867,9 @@ static struct attribute *llite_attrs[] = {
&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, &lustre_attr_max_read_ahead_whole_mb.attr,
&lustre_attr_checksum_pages.attr, &lustre_attr_checksum_pages.attr,
&lustre_attr_stats_track_pid.attr,
&lustre_attr_stats_track_ppid.attr,
&lustre_attr_stats_track_gid.attr,
NULL, NULL,
}; };
......
...@@ -124,3 +124,24 @@ Contact: "Oleg Drokin" <oleg.drokin@intel.com> ...@@ -124,3 +124,24 @@ Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description: Description:
Enables or disables per-page checksum at llite layer, before Enables or disables per-page checksum at llite layer, before
the pages are actually given to lower level for network transfer the pages are actually given to lower level for network transfer
What: /sys/fs/lustre/llite/<fsname>-<uuid>/stats_track_pid
Date: May 2015
Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description:
Limit Lustre vfs operations gathering to just a single pid.
0 to track everything.
What: /sys/fs/lustre/llite/<fsname>-<uuid>/stats_track_ppid
Date: May 2015
Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description:
Limit Lustre vfs operations gathering to just a single ppid.
0 to track everything.
What: /sys/fs/lustre/llite/<fsname>-<uuid>/stats_track_gid
Date: May 2015
Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description:
Limit Lustre vfs operations gathering to just a single gid.
0 to track everything.
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