From 2a45af9061cf08acfd965d4ad043b61515b9680a Mon Sep 17 00:00:00 2001 From: Arshad Hussain Date: Thu, 29 Aug 2024 05:34:01 -0400 Subject: [PATCH] LU-16796 lfsck: Change lfsck_instance to use refcount_t This patch changes struct lfsck_instance to use refcount_t instead of atomic_t Test-Parameters: trivial testlist=sanity-lfsck Signed-off-by: Arshad Hussain Change-Id: I9bf3337ed7b68dbd44e723bf7c1374a8e3a07eb7 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56195 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- lustre/lfsck/lfsck_internal.h | 6 +++--- lustre/lfsck/lfsck_lib.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lustre/lfsck/lfsck_internal.h b/lustre/lfsck/lfsck_internal.h index 5437533..542c55c 100644 --- a/lustre/lfsck/lfsck_internal.h +++ b/lustre/lfsck/lfsck_internal.h @@ -657,7 +657,7 @@ struct lfsck_instance { /* For the lfsck_lmv_unit to be handled. */ struct list_head li_list_lmv; - atomic_t li_ref; + refcount_t li_ref; atomic_t li_double_scan_count; struct ptlrpc_thread li_thread; struct task_struct *li_task; @@ -1395,7 +1395,7 @@ static inline void lfsck_component_put(const struct lu_env *env, static inline struct lfsck_instance * lfsck_instance_get(struct lfsck_instance *lfsck) { - atomic_inc(&lfsck->li_ref); + refcount_inc(&lfsck->li_ref); return lfsck; } @@ -1403,7 +1403,7 @@ lfsck_instance_get(struct lfsck_instance *lfsck) static inline void lfsck_instance_put(const struct lu_env *env, struct lfsck_instance *lfsck) { - if (atomic_dec_and_test(&lfsck->li_ref)) + if (refcount_dec_and_test(&lfsck->li_ref)) lfsck_instance_cleanup(env, lfsck); } diff --git a/lustre/lfsck/lfsck_lib.c b/lustre/lfsck/lfsck_lib.c index 8fc6517..48fc4de 100644 --- a/lustre/lfsck/lfsck_lib.c +++ b/lustre/lfsck/lfsck_lib.c @@ -3652,7 +3652,7 @@ int lfsck_register(const struct lu_env *env, struct dt_device *key, INIT_LIST_HEAD(&lfsck->li_list_double_scan); INIT_LIST_HEAD(&lfsck->li_list_idle); INIT_LIST_HEAD(&lfsck->li_list_lmv); - atomic_set(&lfsck->li_ref, 1); + refcount_set(&lfsck->li_ref, 1); atomic_set(&lfsck->li_double_scan_count, 0); init_waitqueue_head(&lfsck->li_thread.t_ctl_waitq); lfsck->li_out_notify = notify; -- 1.8.3.1