From 68cd9825d5a428af7ba38dcb6e1357af514a7fa3 Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Thu, 16 Jul 2020 14:07:56 +1000 Subject: [PATCH] LU-6142 lfsck: make all 'struct lfsck_operations' to const Operations structures should be 'const' wherever possible. So change both lfsck_operations and lfsck_assistant_operations to const. Test-Parameters: trivial Signed-off-by: Mr NeilBrown Change-Id: Ic457c0e52ceafab58cb788db383957ed4ab39df4 Reviewed-on: https://review.whamcloud.com/39397 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Lai Siyao Reviewed-by: Arshad Hussain Reviewed-by: Oleg Drokin --- lustre/lfsck/lfsck_engine.c | 2 +- lustre/lfsck/lfsck_internal.h | 6 +++--- lustre/lfsck/lfsck_layout.c | 6 +++--- lustre/lfsck/lfsck_lib.c | 2 +- lustre/lfsck/lfsck_namespace.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lustre/lfsck/lfsck_engine.c b/lustre/lfsck/lfsck_engine.c index f278c1d..2ae4ad8 100644 --- a/lustre/lfsck/lfsck_engine.c +++ b/lustre/lfsck/lfsck_engine.c @@ -1583,7 +1583,7 @@ int lfsck_assistant_engine(void *args) struct lfsck_assistant_data *lad = com->lc_data; struct ptlrpc_thread *mthread = &lfsck->li_thread; struct ptlrpc_thread *athread = &lad->lad_thread; - struct lfsck_assistant_operations *lao = lad->lad_ops; + const struct lfsck_assistant_operations *lao = lad->lad_ops; struct lfsck_assistant_req *lar; int rc = 0; int rc1 = 0; diff --git a/lustre/lfsck/lfsck_internal.h b/lustre/lfsck/lfsck_internal.h index 9292891..7217c60 100644 --- a/lustre/lfsck/lfsck_internal.h +++ b/lustre/lfsck/lfsck_internal.h @@ -552,7 +552,7 @@ struct lfsck_component { struct lfsck_instance *lc_lfsck; struct dt_object *lc_obj; struct lfsck_sub_trace_obj lc_sub_trace_objs[LFSCK_STF_COUNT]; - struct lfsck_operations *lc_ops; + const struct lfsck_operations *lc_ops; void *lc_file_ram; void *lc_file_disk; void *lc_data; @@ -849,7 +849,7 @@ struct lfsck_assistant_data { struct ptlrpc_thread lad_thread; struct task_struct *lad_task; - struct lfsck_assistant_operations *lad_ops; + const struct lfsck_assistant_operations *lad_ops; struct cfs_bitmap *lad_bitmap; @@ -960,7 +960,7 @@ void lfsck_control_speed(struct lfsck_instance *lfsck); void lfsck_control_speed_by_self(struct lfsck_component *com); void lfsck_thread_args_fini(struct lfsck_thread_args *lta); struct lfsck_assistant_data * -lfsck_assistant_data_init(struct lfsck_assistant_operations *lao, +lfsck_assistant_data_init(const struct lfsck_assistant_operations *lao, const char *name); struct lfsck_assistant_object * lfsck_assistant_object_init(const struct lu_env *env, const struct lu_fid *fid, diff --git a/lustre/lfsck/lfsck_layout.c b/lustre/lfsck/lfsck_layout.c index 9c0c865..8f81d8f 100644 --- a/lustre/lfsck/lfsck_layout.c +++ b/lustre/lfsck/lfsck_layout.c @@ -6808,7 +6808,7 @@ static int lfsck_layout_slave_join(const struct lu_env *env, RETURN(rc); } -static struct lfsck_operations lfsck_layout_master_ops = { +static const struct lfsck_operations lfsck_layout_master_ops = { .lfsck_reset = lfsck_layout_reset, .lfsck_fail = lfsck_layout_fail, .lfsck_checkpoint = lfsck_layout_master_checkpoint, @@ -6824,7 +6824,7 @@ static struct lfsck_operations lfsck_layout_master_ops = { .lfsck_query = lfsck_layout_query, }; -static struct lfsck_operations lfsck_layout_slave_ops = { +static const struct lfsck_operations lfsck_layout_slave_ops = { .lfsck_reset = lfsck_layout_reset, .lfsck_fail = lfsck_layout_fail, .lfsck_checkpoint = lfsck_layout_slave_checkpoint, @@ -6862,7 +6862,7 @@ static void lfsck_layout_assistant_fill_pos(const struct lu_env *env, pos->lp_oit_cookie = llr->llr_lar.lar_parent->lso_oit_cookie - 1; } -struct lfsck_assistant_operations lfsck_layout_assistant_ops = { +const struct lfsck_assistant_operations lfsck_layout_assistant_ops = { .la_handler_p1 = lfsck_layout_assistant_handler_p1, .la_handler_p2 = lfsck_layout_assistant_handler_p2, .la_fill_pos = lfsck_layout_assistant_fill_pos, diff --git a/lustre/lfsck/lfsck_lib.c b/lustre/lfsck/lfsck_lib.c index 19f7a4d..8efdfce 100644 --- a/lustre/lfsck/lfsck_lib.c +++ b/lustre/lfsck/lfsck_lib.c @@ -1957,7 +1957,7 @@ void lfsck_thread_args_fini(struct lfsck_thread_args *lta) } struct lfsck_assistant_data * -lfsck_assistant_data_init(struct lfsck_assistant_operations *lao, +lfsck_assistant_data_init(const struct lfsck_assistant_operations *lao, const char *name) { struct lfsck_assistant_data *lad; diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c index 6e952ac..a227bb0 100644 --- a/lustre/lfsck/lfsck_namespace.c +++ b/lustre/lfsck/lfsck_namespace.c @@ -5227,7 +5227,7 @@ static int lfsck_namespace_query(const struct lu_env *env, return rc; } -static struct lfsck_operations lfsck_namespace_ops = { +static const struct lfsck_operations lfsck_namespace_ops = { .lfsck_reset = lfsck_namespace_reset, .lfsck_fail = lfsck_namespace_fail, .lfsck_close_dir = lfsck_namespace_close_dir, @@ -6828,7 +6828,7 @@ out: EXIT; } -struct lfsck_assistant_operations lfsck_namespace_assistant_ops = { +const struct lfsck_assistant_operations lfsck_namespace_assistant_ops = { .la_handler_p1 = lfsck_namespace_assistant_handler_p1, .la_handler_p2 = lfsck_namespace_assistant_handler_p2, .la_fill_pos = lfsck_namespace_assistant_fill_pos, -- 1.8.3.1