Whamcloud - gitweb
LU-6142 ldlm: use list_first_entry in ldlm_lock 59/49359/3
authorMr. NeilBrown <neilb@suse.de>
Sat, 10 Dec 2022 14:27:08 +0000 (09:27 -0500)
committerOleg Drokin <green@whamcloud.com>
Thu, 19 Jan 2023 15:27:56 +0000 (15:27 +0000)
This make the code (slightly) more readable.

Linux-commit: ef7e70a ("staging: lustre: ldlm: use list_first_entry in ldlm_lock")

Change-Id: If9789fef1dec55d08dec25819aaf5152946819c5
Signed-off-by: Mr. NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49359
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: jsimmons <jsimmons@infradead.org>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Andriy Skulysh <andriy.skulysh@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ldlm/ldlm_lock.c

index 58ae27f..4018722 100644 (file)
@@ -2149,7 +2149,7 @@ ldlm_work_bl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq)
        if (list_empty(arg->list))
                RETURN(-ENOENT);
 
-       lock = list_entry(arg->list->next, struct ldlm_lock, l_bl_ast);
+       lock = list_first_entry(arg->list, struct ldlm_lock, l_bl_ast);
 
        /* nobody should touch l_bl_ast but some locks in the list may become
         * granted after lock convert or COS downgrade, these locks should be
@@ -2214,7 +2214,7 @@ ldlm_work_revoke_ast_lock(struct ptlrpc_request_set *rqset, void *opaq)
        if (list_empty(arg->list))
                RETURN(-ENOENT);
 
-       lock = list_entry(arg->list->next, struct ldlm_lock, l_rk_ast);
+       lock = list_first_entry(arg->list, struct ldlm_lock, l_rk_ast);
        list_del_init(&lock->l_rk_ast);
 
        /* the desc just pretend to exclusive */
@@ -2242,8 +2242,8 @@ int ldlm_work_gl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq)
        if (list_empty(arg->list))
                RETURN(-ENOENT);
 
-       gl_work = list_entry(arg->list->next, struct ldlm_glimpse_work,
-                                gl_list);
+       gl_work = list_first_entry(arg->list, struct ldlm_glimpse_work,
+                                  gl_list);
        list_del_init(&gl_work->gl_list);
 
        lock = gl_work->gl_lock;
@@ -2286,7 +2286,7 @@ ldlm_work_cp_ast_lock(struct ptlrpc_request_set *rqset, void *opaq)
        if (list_empty(arg->list))
                RETURN(-ENOENT);
 
-       lock = list_entry(arg->list->next, struct ldlm_lock, l_cp_ast);
+       lock = list_first_entry(arg->list, struct ldlm_lock, l_cp_ast);
 
        /* It's possible to receive a completion AST before we've set
         * the l_completion_ast pointer: either because the AST arrived