Commit 81648d04 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Bob Peterson

gfs2: Simplify the seq file code for "sbstats"

Don't use struct gfs2_glock_iter as the helper data structure for iterating
through "sbstats"; we are not iterating through glocks here.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
parent c63f887b
...@@ -1776,10 +1776,10 @@ static const char *gfs2_stype[] = { ...@@ -1776,10 +1776,10 @@ static const char *gfs2_stype[] = {
static int gfs2_sbstats_seq_show(struct seq_file *seq, void *iter_ptr) static int gfs2_sbstats_seq_show(struct seq_file *seq, void *iter_ptr)
{ {
struct gfs2_glock_iter *gi = seq->private; struct gfs2_sbd *sdp = seq->private;
struct gfs2_sbd *sdp = gi->sdp; loff_t pos = *(loff_t *)iter_ptr;
unsigned index = gi->hash >> 3; unsigned index = pos >> 3;
unsigned subindex = gi->hash & 0x07; unsigned subindex = pos & 0x07;
s64 value; s64 value;
int i; int i;
...@@ -1930,26 +1930,19 @@ static int gfs2_glock_seq_show(struct seq_file *seq, void *iter_ptr) ...@@ -1930,26 +1930,19 @@ static int gfs2_glock_seq_show(struct seq_file *seq, void *iter_ptr)
static void *gfs2_sbstats_seq_start(struct seq_file *seq, loff_t *pos) static void *gfs2_sbstats_seq_start(struct seq_file *seq, loff_t *pos)
{ {
struct gfs2_glock_iter *gi = seq->private; preempt_disable();
gi->hash = *pos;
if (*pos >= GFS2_NR_SBSTATS) if (*pos >= GFS2_NR_SBSTATS)
return NULL; return NULL;
preempt_disable(); return pos;
return SEQ_START_TOKEN;
} }
static void *gfs2_sbstats_seq_next(struct seq_file *seq, void *iter_ptr, static void *gfs2_sbstats_seq_next(struct seq_file *seq, void *iter_ptr,
loff_t *pos) loff_t *pos)
{ {
struct gfs2_glock_iter *gi = seq->private;
(*pos)++; (*pos)++;
gi->hash++; if (*pos >= GFS2_NR_SBSTATS)
if (gi->hash >= GFS2_NR_SBSTATS) {
preempt_enable();
return NULL; return NULL;
} return pos;
return SEQ_START_TOKEN;
} }
static void gfs2_sbstats_seq_stop(struct seq_file *seq, void *iter_ptr) static void gfs2_sbstats_seq_stop(struct seq_file *seq, void *iter_ptr)
...@@ -2012,12 +2005,10 @@ static int gfs2_glstats_open(struct inode *inode, struct file *file) ...@@ -2012,12 +2005,10 @@ static int gfs2_glstats_open(struct inode *inode, struct file *file)
static int gfs2_sbstats_open(struct inode *inode, struct file *file) static int gfs2_sbstats_open(struct inode *inode, struct file *file)
{ {
int ret = seq_open_private(file, &gfs2_sbstats_seq_ops, int ret = seq_open(file, &gfs2_sbstats_seq_ops);
sizeof(struct gfs2_glock_iter));
if (ret == 0) { if (ret == 0) {
struct seq_file *seq = file->private_data; struct seq_file *seq = file->private_data;
struct gfs2_glock_iter *gi = seq->private; seq->private = inode->i_private; /* sdp */
gi->sdp = inode->i_private;
} }
return ret; return ret;
} }
...@@ -2043,7 +2034,7 @@ static const struct file_operations gfs2_sbstats_fops = { ...@@ -2043,7 +2034,7 @@ static const struct file_operations gfs2_sbstats_fops = {
.open = gfs2_sbstats_open, .open = gfs2_sbstats_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
.release = seq_release_private, .release = seq_release,
}; };
int gfs2_create_debugfs_file(struct gfs2_sbd *sdp) int gfs2_create_debugfs_file(struct gfs2_sbd *sdp)
......
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