Commit 6ec4de89 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'gfs2-4.16.fixes2' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2

Pull GFS2 fixes from Bob Peterson:
 "Andreas Gruenbacher wrote two additional patches that we would like
  merged in this time. Both are regressions:

   - fix another kernel build dependency problem

   - fix a performance regression in glock dumps"

* tag 'gfs2-4.16.fixes2' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
  gfs2: Glock dump performance regression fix
  gfs2: Fix the crc32c dependency
parents abbbd021 7ac07fda
...@@ -3,8 +3,7 @@ config GFS2_FS ...@@ -3,8 +3,7 @@ config GFS2_FS
depends on (64BIT || LBDAF) depends on (64BIT || LBDAF)
select FS_POSIX_ACL select FS_POSIX_ACL
select CRC32 select CRC32
select CRYPTO select LIBCRC32C
select CRYPTO_CRC32C
select QUOTACTL select QUOTACTL
select FS_IOMAP select FS_IOMAP
help help
......
...@@ -1921,19 +1921,29 @@ void gfs2_glock_exit(void) ...@@ -1921,19 +1921,29 @@ void gfs2_glock_exit(void)
destroy_workqueue(gfs2_delete_workqueue); destroy_workqueue(gfs2_delete_workqueue);
} }
static void gfs2_glock_iter_next(struct gfs2_glock_iter *gi) static void gfs2_glock_iter_next(struct gfs2_glock_iter *gi, loff_t n)
{ {
while ((gi->gl = rhashtable_walk_next(&gi->hti))) { if (n == 0)
if (IS_ERR(gi->gl)) { gi->gl = rhashtable_walk_peek(&gi->hti);
if (PTR_ERR(gi->gl) == -EAGAIN) else {
continue; gi->gl = rhashtable_walk_next(&gi->hti);
n--;
}
for (;;) {
if (IS_ERR_OR_NULL(gi->gl)) {
if (!gi->gl)
return;
if (PTR_ERR(gi->gl) != -EAGAIN) {
gi->gl = NULL; gi->gl = NULL;
return; return;
} }
/* Skip entries for other sb and dead entries */ n = 0;
if (gi->sdp == gi->gl->gl_name.ln_sbd && } else if (gi->sdp == gi->gl->gl_name.ln_sbd &&
!__lockref_is_dead(&gi->gl->gl_lockref)) !__lockref_is_dead(&gi->gl->gl_lockref)) {
return; if (!n--)
break;
}
gi->gl = rhashtable_walk_next(&gi->hti);
} }
} }
...@@ -1941,18 +1951,24 @@ static void *gfs2_glock_seq_start(struct seq_file *seq, loff_t *pos) ...@@ -1941,18 +1951,24 @@ static void *gfs2_glock_seq_start(struct seq_file *seq, loff_t *pos)
__acquires(RCU) __acquires(RCU)
{ {
struct gfs2_glock_iter *gi = seq->private; struct gfs2_glock_iter *gi = seq->private;
loff_t n = *pos; loff_t n;
/*
* We can either stay where we are, skip to the next hash table
* entry, or start from the beginning.
*/
if (*pos < gi->last_pos) {
rhashtable_walk_exit(&gi->hti);
rhashtable_walk_enter(&gl_hash_table, &gi->hti); rhashtable_walk_enter(&gl_hash_table, &gi->hti);
if (rhashtable_walk_start_check(&gi->hti) != 0) n = *pos + 1;
return NULL; } else {
n = *pos - gi->last_pos;
}
do { rhashtable_walk_start(&gi->hti);
gfs2_glock_iter_next(gi);
} while (gi->gl && n--);
gfs2_glock_iter_next(gi, n);
gi->last_pos = *pos; gi->last_pos = *pos;
return gi->gl; return gi->gl;
} }
...@@ -1963,8 +1979,7 @@ static void *gfs2_glock_seq_next(struct seq_file *seq, void *iter_ptr, ...@@ -1963,8 +1979,7 @@ static void *gfs2_glock_seq_next(struct seq_file *seq, void *iter_ptr,
(*pos)++; (*pos)++;
gi->last_pos = *pos; gi->last_pos = *pos;
gfs2_glock_iter_next(gi); gfs2_glock_iter_next(gi, 1);
return gi->gl; return gi->gl;
} }
...@@ -1975,7 +1990,6 @@ static void gfs2_glock_seq_stop(struct seq_file *seq, void *iter_ptr) ...@@ -1975,7 +1990,6 @@ static void gfs2_glock_seq_stop(struct seq_file *seq, void *iter_ptr)
gi->gl = NULL; gi->gl = NULL;
rhashtable_walk_stop(&gi->hti); rhashtable_walk_stop(&gi->hti);
rhashtable_walk_exit(&gi->hti);
} }
static int gfs2_glock_seq_show(struct seq_file *seq, void *iter_ptr) static int gfs2_glock_seq_show(struct seq_file *seq, void *iter_ptr)
...@@ -2041,7 +2055,13 @@ static int __gfs2_glocks_open(struct inode *inode, struct file *file, ...@@ -2041,7 +2055,13 @@ static int __gfs2_glocks_open(struct inode *inode, struct file *file,
seq->buf = kmalloc(GFS2_SEQ_GOODSIZE, GFP_KERNEL | __GFP_NOWARN); seq->buf = kmalloc(GFS2_SEQ_GOODSIZE, GFP_KERNEL | __GFP_NOWARN);
if (seq->buf) if (seq->buf)
seq->size = GFS2_SEQ_GOODSIZE; seq->size = GFS2_SEQ_GOODSIZE;
/*
* Initially, we are "before" the first hash table entry; the
* first call to rhashtable_walk_next gets us the first entry.
*/
gi->last_pos = -1;
gi->gl = NULL; gi->gl = NULL;
rhashtable_walk_enter(&gl_hash_table, &gi->hti);
} }
return ret; return ret;
} }
...@@ -2057,6 +2077,7 @@ static int gfs2_glocks_release(struct inode *inode, struct file *file) ...@@ -2057,6 +2077,7 @@ static int gfs2_glocks_release(struct inode *inode, struct file *file)
struct gfs2_glock_iter *gi = seq->private; struct gfs2_glock_iter *gi = seq->private;
gi->gl = NULL; gi->gl = NULL;
rhashtable_walk_exit(&gi->hti);
return seq_release_private(inode, file); return seq_release_private(inode, file);
} }
......
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