2022-07-21 20:55:28

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH v2 0/3] 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(-)

--
2.34.1


2022-07-21 20:55:48

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH v2 2/3] ocfs2: use the bitmap API to simplify code

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

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

Signed-off-by: Christophe JAILLET <[email protected]>
Reviewed-by: Joseph Qi <[email protected]>
---
v1 -> v2
- no change
- it was patch 3/3 in v1
---
fs/ocfs2/heartbeat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ocfs2/heartbeat.c b/fs/ocfs2/heartbeat.c
index 1d72e0788943..dd29d60af154 100644
--- a/fs/ocfs2/heartbeat.c
+++ b/fs/ocfs2/heartbeat.c
@@ -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)
--
2.34.1

2022-07-21 20:57:02

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH v2 3/3] ocfs2: Fix a typo in a comment

s/heartbaet/heartbeat

Signed-off-by: Christophe JAILLET <[email protected]>
---
v1 -> v2
- this patch is new in the serie
---
fs/ocfs2/heartbeat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ocfs2/heartbeat.c b/fs/ocfs2/heartbeat.c
index dd29d60af154..22da768e65b7 100644
--- a/fs/ocfs2/heartbeat.c
+++ b/fs/ocfs2/heartbeat.c
@@ -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.
--
2.34.1

2022-07-21 21:03:31

by Christophe JAILLET

[permalink] [raw]
Subject: [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.

Signed-off-by: Christophe JAILLET <[email protected]>
Reviewed-by: Joseph Qi <[email protected]>
---
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(-)

diff --git a/fs/ocfs2/heartbeat.c b/fs/ocfs2/heartbeat.c
index 9099d8fc7599..1d72e0788943 100644
--- a/fs/ocfs2/heartbeat.c
+++ b/fs/ocfs2/heartbeat.c
@@ -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);
}

--
2.34.1

2022-07-22 01:48:01

by Joseph Qi

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



On 7/22/22 4:49 AM, Christophe JAILLET wrote:
> s/heartbaet/heartbeat
>
> Signed-off-by: Christophe JAILLET <[email protected]>

Reviewed-by: Joseph Qi <[email protected]>
> ---
> v1 -> v2
> - this patch is new in the serie
> ---
> fs/ocfs2/heartbeat.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ocfs2/heartbeat.c b/fs/ocfs2/heartbeat.c
> index dd29d60af154..22da768e65b7 100644
> --- a/fs/ocfs2/heartbeat.c
> +++ b/fs/ocfs2/heartbeat.c
> @@ -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.