Skip to contentSkip to conversation

ocfs2: A few clean_ups

PATCH Applied Christophe JAILLET 2 participants 5 messages Jul 21, 2022 – Jul 22, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover ocfs2: A few clean_ups

Patch 1 and 2 were patch 1/3 and 3/3 in v1.
Code is unchanged and R-b tag are already added.

Patch 3 is new. It is just a typo

Christophe JAILLET (3):
ocfs2: Remove some useless functions
ocfs2: use the bitmap API to simplify code
ocfs2: Fix a typo in a comment

 fs/ocfs2/heartbeat.c | 27 +++++----------------------
 1 file changed, 5 insertions(+), 22 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/3 ocfs2: Remove some useless functions

__ocfs2_node_map_set_bit() and __ocfs2_node_map_clear_bit() are just wrapper around set_bit() and clear_bit().

The leading __ also makes think that these functions are non-atomic just like __set_bit() and __clear_bit().

So, just remove these wrappers and call set_bit() and clear_bit() directly.

---
v1 -> v2
- fix a typo in the log message
- add R-b tag

---
 fs/ocfs2/heartbeat.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)
fs/ocfs2/heartbeat.c +2 -19
index 9099d8fc7599..1d72e0788943 100644
@@ -24,11 +24,6 @@
 
 #include "buffer_head_io.h"
 
-static inline void __ocfs2_node_map_set_bit(struct ocfs2_node_map *map,
-					    int bit);
-static inline void __ocfs2_node_map_clear_bit(struct ocfs2_node_map *map,
-					      int bit);
-
 /* special case -1 for now
  * TODO: should *really* make sure the calling func never passes -1!!  */
 static void ocfs2_node_map_init(struct ocfs2_node_map *map)
@@ -65,12 +60,6 @@ void ocfs2_do_node_down(int node_num, void *data)
 	ocfs2_recovery_thread(osb, node_num);
 }
 
-static inline void __ocfs2_node_map_set_bit(struct ocfs2_node_map *map,
-					    int bit)
-{
-	set_bit(bit, map->map);
-}
-
 void ocfs2_node_map_set_bit(struct ocfs2_super *osb,
 			    struct ocfs2_node_map *map,
 			    int bit)
@@ -79,16 +68,10 @@ void ocfs2_node_map_set_bit(struct ocfs2_super *osb,
 		return;
 	BUG_ON(bit >= map->num_nodes);
 	spin_lock(&osb->node_map_lock);
-	__ocfs2_node_map_set_bit(map, bit);
+	set_bit(bit, map->map);
 	spin_unlock(&osb->node_map_lock);
 }
 
-static inline void __ocfs2_node_map_clear_bit(struct ocfs2_node_map *map,
-					      int bit)
-{
-	clear_bit(bit, map->map);
-}
-
 void ocfs2_node_map_clear_bit(struct ocfs2_super *osb,
 			      struct ocfs2_node_map *map,
 			      int bit)
@@ -97,7 +80,7 @@ void ocfs2_node_map_clear_bit(struct ocfs2_super *osb,
 		return;
 	BUG_ON(bit >= map->num_nodes);
 	spin_lock(&osb->node_map_lock);
-	__ocfs2_node_map_clear_bit(map, bit);
+	clear_bit(bit, map->map);
 	spin_unlock(&osb->node_map_lock);
 }
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/3 ocfs2: use the bitmap API to simplify code

In reply to Christophe JAILLET

Use bitmap_zero() instead of hand-writing it.
It is less verbose.

While at it, add an explicit #include <linux/bitmap.h>.

---
v1 -> v2
- no change
- it was patch 3/3 in v1

---
 fs/ocfs2/heartbeat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ocfs2/heartbeat.c +2 -2
index 1d72e0788943..dd29d60af154 100644
@@ -8,6 +8,7 @@
  * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
  */
 
+#include <linux/bitmap.h>
 #include <linux/fs.h>
 #include <linux/types.h>
 #include <linux/highmem.h>
@@ -29,8 +30,7 @@
 static void ocfs2_node_map_init(struct ocfs2_node_map *map)
 {
 	map->num_nodes = OCFS2_NODE_MAP_MAX_NODES;
-	memset(map->map, 0, BITS_TO_LONGS(OCFS2_NODE_MAP_MAX_NODES) *
-	       sizeof(unsigned long));
+	bitmap_zero(map->map, OCFS2_NODE_MAP_MAX_NODES);
 }
 
 void ocfs2_init_node_maps(struct ocfs2_super *osb)
Signature · 1 line
2.34.1
#3 lore raw

PATCH v2 3/3 ocfs2: Fix a typo in a comment

In reply to Christophe JAILLET

s/heartbaet/heartbeat

---
v1 -> v2
- this patch is new in the serie

---
 fs/ocfs2/heartbeat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/heartbeat.c +1 -1
index dd29d60af154..22da768e65b7 100644
@@ -2,7 +2,7 @@
 /*
  * heartbeat.c
  *
- * Register ourselves with the heartbaet service, keep our node maps
+ * Register ourselves with the heartbeat service, keep our node maps
  * up to date, and fire off recovery when needed.
  *
  * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
Signature · 1 line
2.34.1
maintainer Reviewed-by on v2 3/3
#4 lore raw

Re: [PATCH v2 3/3] ocfs2: Fix a typo in a comment

Quoted 3 lines · Christophe JAILLET

s/heartbaet/heartbeat

Quoted 20 lines

---
v1 -> v2
- this patch is new in the serie

---
 fs/ocfs2/heartbeat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/heartbeat.c +1 -1
index dd29d60af154..22da768e65b7 100644
@@ -2,7 +2,7 @@
 /*
  * heartbeat.c
  *
- * Register ourselves with the heartbaet service, keep our node maps
+ * Register ourselves with the heartbeat service, keep our node maps
  * up to date, and fire off recovery when needed.
  *
  * Copyright (C) 2002, 2004 Oracle.  All rights reserved.