Skip to contentSkip to conversation

gfs2: Replace rhashtable_walk_init with rhashtable_walk_enter

PATCH New Andreas Gruenbacher 2 participants 4 messages Mar 6, 2017 – Mar 9, 2017 GFS2 file system

lore
Share & tools
lore

Andreas Gruenbacher

author maintainer
#0 lore raw

PATCH 1/2 gfs2: Replace rhashtable_walk_init with rhashtable_walk_enter

Function rhashtable_walk_init is deprecated.

---
 fs/gfs2/glock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/glock.c +1 -1
index ec0848f..339deb4 100644
@@ -1932,7 +1932,7 @@ static int gfs2_glocks_open(struct inode *inode, struct file *file)
 		if (seq->buf)
 			seq->size = GFS2_SEQ_GOODSIZE;
 		gi->gl = NULL;
-		ret = rhashtable_walk_init(&gl_hash_table, &gi->hti, GFP_KERNEL);
+		rhashtable_walk_enter(&gl_hash_table, &gi->hti);
 	}
 	return ret;
 }
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH 2/2 gfs2: Deduplicate gfs2_{glocks, glstats}_open

Both functions are identical except for the seq_operations used.

---
 fs/gfs2/glock.c | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)
fs/gfs2/glock.c +9 -17
index 339deb4..2cbc11b 100644
@@ -1918,10 +1918,10 @@ static const struct seq_operations gfs2_sbstats_seq_ops = {
 
 #define GFS2_SEQ_GOODSIZE min(PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER, 65536UL)
 
-static int gfs2_glocks_open(struct inode *inode, struct file *file)
+static int __gfs2_glocks_open(struct inode *inode, struct file *file,
+			      const struct seq_operations *ops)
 {
-	int ret = seq_open_private(file, &gfs2_glock_seq_ops,
-				   sizeof(struct gfs2_glock_iter));
+	int ret = seq_open_private(file, ops, sizeof(struct gfs2_glock_iter));
 	if (ret == 0) {
 		struct seq_file *seq = file->private_data;
 		struct gfs2_glock_iter *gi = seq->private;
@@ -1937,6 +1937,11 @@ static int gfs2_glocks_open(struct inode *inode, struct file *file)
 	return ret;
 }
 
+static int gfs2_glocks_open(struct inode *inode, struct file *file)
+{
+	return __gfs2_glocks_open(inode, file, &gfs2_glock_seq_ops);
+}
+
 static int gfs2_glocks_release(struct inode *inode, struct file *file)
 {
 	struct seq_file *seq = file->private_data;
@@ -1949,20 +1954,7 @@ static int gfs2_glocks_release(struct inode *inode, struct file *file)
 
 static int gfs2_glstats_open(struct inode *inode, struct file *file)
 {
-	int ret = seq_open_private(file, &gfs2_glstats_seq_ops,
-				   sizeof(struct gfs2_glock_iter));
-	if (ret == 0) {
-		struct seq_file *seq = file->private_data;
-		struct gfs2_glock_iter *gi = seq->private;
-		gi->sdp = inode->i_private;
-		gi->last_pos = 0;
-		seq->buf = kmalloc(GFS2_SEQ_GOODSIZE, GFP_KERNEL | __GFP_NOWARN);
-		if (seq->buf)
-			seq->size = GFS2_SEQ_GOODSIZE;
-		gi->gl = NULL;
-		ret = rhashtable_walk_init(&gl_hash_table, &gi->hti, GFP_KERNEL);
-	}
-	return ret;
+	return __gfs2_glocks_open(inode, file, &gfs2_glstats_seq_ops);
 }
 
 static int gfs2_sbstats_open(struct inode *inode, struct file *file)
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 gfs2: Deduplicate gfs2_{glocks, glstats}_open

----- Original Message -----

| Both functions are identical except for the seq_operations used.
| 
| Signed-off-by: Andreas Gruenbacher <[email protected]>
| ---

Hi,

Thanks. This is now applied to the for-next branch of the linux-gfs2 tree:
https://git.kernel.org/cgit/linux/kernel/git/gfs2/linux-gfs2.git/commit/?h=for-next&id=8b43b0891e394098304195c34d7498bfef51f520

Regards,

Bob Peterson
Red Hat File Systems

#3 lore raw

PATCH 1/2 gfs2: Replace rhashtable_walk_init with rhashtable_walk_enter

In reply to Andreas Gruenbacher

----- Original Message -----

| Function rhashtable_walk_init is deprecated.
| 
| Signed-off-by: Andreas Gruenbacher <[email protected]>
| ---

Hi,

Thanks. This is now applied to the for-next branch of the linux-gfs2 tree:
https://git.kernel.org/cgit/linux/kernel/git/gfs2/linux-gfs2.git/commit/?h=for-next&id=7209c60c5c17a1e93363fc18714dedbb2197f260

Regards,

Bob Peterson
Red Hat File Systems