Whamcloud - gitweb
LU-16796 lfsck: Change lfsck_instance to use refcount_t 95/56195/2
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Thu, 29 Aug 2024 09:34:01 +0000 (05:34 -0400)
committerOleg Drokin <green@whamcloud.com>
Thu, 13 Mar 2025 17:05:50 +0000 (17:05 +0000)
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 <arshad.hussain@aeoncomputing.com>
Change-Id: I9bf3337ed7b68dbd44e723bf7c1374a8e3a07eb7
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56195
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lfsck/lfsck_internal.h
lustre/lfsck/lfsck_lib.c

index 5437533..542c55c 100644 (file)
@@ -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);
 }
 
index 8fc6517..48fc4de 100644 (file)
@@ -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;