2017-08-30 11:59:20

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH] gfs2: constify rhashtable_params

rhashtable_params are not supposed to change at runtime. All
Functions rhashtable_* working with const rhashtable_params
provided by <linux/rhashtable.h>. So mark the non-const structs
as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
fs/gfs2/glock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index c38ab6c..baf3ae7 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -71,7 +71,7 @@ struct gfs2_glock_iter {
#define GFS2_GL_HASH_SHIFT 15
#define GFS2_GL_HASH_SIZE BIT(GFS2_GL_HASH_SHIFT)

-static struct rhashtable_params ht_parms = {
+static const struct rhashtable_params ht_parms = {
.nelem_hint = GFS2_GL_HASH_SIZE * 3 / 4,
.key_len = offsetofend(struct lm_lockname, ln_type),
.key_offset = offsetof(struct gfs2_glock, gl_name),
--
1.9.1


2017-08-30 13:19:07

by Bob Peterson

[permalink] [raw]
Subject: Re: [PATCH] gfs2: constify rhashtable_params

----- Original Message -----
| rhashtable_params are not supposed to change at runtime. All
| Functions rhashtable_* working with const rhashtable_params
| provided by <linux/rhashtable.h>. So mark the non-const structs
| as const.
|
| Signed-off-by: Arvind Yadav <[email protected]>
| ---
Hi,

Thanks. This is now pushed to the for-next branch of the linux-gfs2 tree:
https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git/commit/fs/gfs2?h=for-next&id=d296b15ed58231bd991c0fb0f3592d595539bcd1

Regards,

Bob Peterson
Red Hat File Systems