diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2015-08-27 12:43:00 -0400 |
---|---|---|
committer | Bob Peterson <rpeterso@redhat.com> | 2015-09-03 14:33:05 -0400 |
commit | 81648d043191e5f8f5870c5af6060b56383b139d (patch) | |
tree | 9d27aa85bc03785e2571f63f2538dfd7cdf265bc | |
parent | c63f887bdae80858c7cebf914f45f69bbaa88e8d (diff) |
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: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
-rw-r--r-- | fs/gfs2/glock.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index a38e38f7b6fc..a694413a6e32 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -1776,10 +1776,10 @@ static const char *gfs2_stype[] = { | |||
1776 | 1776 | ||
1777 | static int gfs2_sbstats_seq_show(struct seq_file *seq, void *iter_ptr) | 1777 | static int gfs2_sbstats_seq_show(struct seq_file *seq, void *iter_ptr) |
1778 | { | 1778 | { |
1779 | struct gfs2_glock_iter *gi = seq->private; | 1779 | struct gfs2_sbd *sdp = seq->private; |
1780 | struct gfs2_sbd *sdp = gi->sdp; | 1780 | loff_t pos = *(loff_t *)iter_ptr; |
1781 | unsigned index = gi->hash >> 3; | 1781 | unsigned index = pos >> 3; |
1782 | unsigned subindex = gi->hash & 0x07; | 1782 | unsigned subindex = pos & 0x07; |
1783 | s64 value; | 1783 | s64 value; |
1784 | int i; | 1784 | int i; |
1785 | 1785 | ||
@@ -1930,26 +1930,19 @@ static int gfs2_glock_seq_show(struct seq_file *seq, void *iter_ptr) | |||
1930 | 1930 | ||
1931 | static void *gfs2_sbstats_seq_start(struct seq_file *seq, loff_t *pos) | 1931 | static void *gfs2_sbstats_seq_start(struct seq_file *seq, loff_t *pos) |
1932 | { | 1932 | { |
1933 | struct gfs2_glock_iter *gi = seq->private; | 1933 | preempt_disable(); |
1934 | |||
1935 | gi->hash = *pos; | ||
1936 | if (*pos >= GFS2_NR_SBSTATS) | 1934 | if (*pos >= GFS2_NR_SBSTATS) |
1937 | return NULL; | 1935 | return NULL; |
1938 | preempt_disable(); | 1936 | return pos; |
1939 | return SEQ_START_TOKEN; | ||
1940 | } | 1937 | } |
1941 | 1938 | ||
1942 | static void *gfs2_sbstats_seq_next(struct seq_file *seq, void *iter_ptr, | 1939 | static void *gfs2_sbstats_seq_next(struct seq_file *seq, void *iter_ptr, |
1943 | loff_t *pos) | 1940 | loff_t *pos) |
1944 | { | 1941 | { |
1945 | struct gfs2_glock_iter *gi = seq->private; | ||
1946 | (*pos)++; | 1942 | (*pos)++; |
1947 | gi->hash++; | 1943 | if (*pos >= GFS2_NR_SBSTATS) |
1948 | if (gi->hash >= GFS2_NR_SBSTATS) { | ||
1949 | preempt_enable(); | ||
1950 | return NULL; | 1944 | return NULL; |
1951 | } | 1945 | return pos; |
1952 | return SEQ_START_TOKEN; | ||
1953 | } | 1946 | } |
1954 | 1947 | ||
1955 | static void gfs2_sbstats_seq_stop(struct seq_file *seq, void *iter_ptr) | 1948 | 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 | 2005 | ||
2013 | static int gfs2_sbstats_open(struct inode *inode, struct file *file) | 2006 | static int gfs2_sbstats_open(struct inode *inode, struct file *file) |
2014 | { | 2007 | { |
2015 | int ret = seq_open_private(file, &gfs2_sbstats_seq_ops, | 2008 | int ret = seq_open(file, &gfs2_sbstats_seq_ops); |
2016 | sizeof(struct gfs2_glock_iter)); | ||
2017 | if (ret == 0) { | 2009 | if (ret == 0) { |
2018 | struct seq_file *seq = file->private_data; | 2010 | struct seq_file *seq = file->private_data; |
2019 | struct gfs2_glock_iter *gi = seq->private; | 2011 | seq->private = inode->i_private; /* sdp */ |
2020 | gi->sdp = inode->i_private; | ||
2021 | } | 2012 | } |
2022 | return ret; | 2013 | return ret; |
2023 | } | 2014 | } |
@@ -2043,7 +2034,7 @@ static const struct file_operations gfs2_sbstats_fops = { | |||
2043 | .open = gfs2_sbstats_open, | 2034 | .open = gfs2_sbstats_open, |
2044 | .read = seq_read, | 2035 | .read = seq_read, |
2045 | .llseek = seq_lseek, | 2036 | .llseek = seq_lseek, |
2046 | .release = seq_release_private, | 2037 | .release = seq_release, |
2047 | }; | 2038 | }; |
2048 | 2039 | ||
2049 | int gfs2_create_debugfs_file(struct gfs2_sbd *sdp) | 2040 | int gfs2_create_debugfs_file(struct gfs2_sbd *sdp) |