From patchwork Mon Sep 30 18:56:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11167283 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E1D31599 for ; Mon, 30 Sep 2019 19:06:22 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 06BF6224D2 for ; Mon, 30 Sep 2019 19:06:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06BF6224D2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 3069C5E4C5A; Mon, 30 Sep 2019 12:00:55 -0700 (PDT) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp4.ccs.ornl.gov (smtp4.ccs.ornl.gov [160.91.203.40]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id E6B835C3CE4 for ; Mon, 30 Sep 2019 11:57:44 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp4.ccs.ornl.gov (Postfix) with ESMTP id 00F691005FA9; Mon, 30 Sep 2019 14:56:58 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id F3843A9; Mon, 30 Sep 2019 14:56:57 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Mon, 30 Sep 2019 14:56:43 -0400 Message-Id: <1569869810-23848-145-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1569869810-23848-1-git-send-email-jsimmons@infradead.org> References: <1569869810-23848-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 144/151] lustre: ptlrpc: use list_move where appropriate. X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: NeilBrown There are several places in lustre where "list_del" (or occasionally "list_del_init") is followed by "list_add" or "list_add_tail" which moves the object to a different list. These can be combined into "list_move" or "list_move_tail". WC-bug-id: https://jira.whamcloud.com/browse/LU-4423 Lustre-commit: a71948a4e6de ("LU-4423 ptlrpc: use list_move where appropriate") Signed-off-by: NeilBrown Reviewed-on: https://review.whamcloud.com/35507 Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- fs/lustre/ldlm/ldlm_lib.c | 5 ++--- fs/lustre/ldlm/ldlm_request.c | 3 +-- fs/lustre/ptlrpc/client.c | 10 ++++------ fs/lustre/ptlrpc/import.c | 3 +-- fs/lustre/ptlrpc/service.c | 13 ++++--------- 5 files changed, 12 insertions(+), 22 deletions(-) diff --git a/fs/lustre/ldlm/ldlm_lib.c b/fs/lustre/ldlm/ldlm_lib.c index 45dc70d..7bc1d10 100644 --- a/fs/lustre/ldlm/ldlm_lib.c +++ b/fs/lustre/ldlm/ldlm_lib.c @@ -86,9 +86,8 @@ static int import_set_conn(struct obd_import *imp, struct obd_uuid *uuid, list_for_each_entry(item, &imp->imp_conn_list, oic_item) { if (obd_uuid_equals(uuid, &item->oic_uuid)) { if (priority) { - list_del(&item->oic_item); - list_add(&item->oic_item, - &imp->imp_conn_list); + list_move(&item->oic_item, + &imp->imp_conn_list); item->oic_last_attempt = 0; } CDEBUG(D_HA, "imp %p@%s: found existing conn %s%s\n", diff --git a/fs/lustre/ldlm/ldlm_request.c b/fs/lustre/ldlm/ldlm_request.c index 4c6db33..00336ca 100644 --- a/fs/lustre/ldlm/ldlm_request.c +++ b/fs/lustre/ldlm/ldlm_request.c @@ -1132,8 +1132,7 @@ int ldlm_cli_cancel_list_local(struct list_head *cancels, int count, */ if (!(flags & LCF_BL_AST) && (rc == LDLM_FL_BL_AST)) { LDLM_DEBUG(lock, "Cancel lock separately"); - list_del_init(&lock->l_bl_ast); - list_add(&lock->l_bl_ast, &head); + list_move(&lock->l_bl_ast, &head); bl_ast++; continue; } diff --git a/fs/lustre/ptlrpc/client.c b/fs/lustre/ptlrpc/client.c index e3aee32..6055980 100644 --- a/fs/lustre/ptlrpc/client.c +++ b/fs/lustre/ptlrpc/client.c @@ -1833,9 +1833,8 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) * put on delay list - only if we wait * recovery finished - before send */ - list_del_init(&req->rq_list); - list_add_tail(&req->rq_list, - &imp->imp_delayed_list); + list_move_tail(&req->rq_list, + &imp->imp_delayed_list); spin_unlock(&imp->imp_lock); continue; } @@ -1856,9 +1855,8 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) goto interpret; } - list_del_init(&req->rq_list); - list_add_tail(&req->rq_list, - &imp->imp_sending_list); + list_move_tail(&req->rq_list, + &imp->imp_sending_list); spin_unlock(&imp->imp_lock); diff --git a/fs/lustre/ptlrpc/import.c b/fs/lustre/ptlrpc/import.c index 32bd218..eb19ca6 100644 --- a/fs/lustre/ptlrpc/import.c +++ b/fs/lustre/ptlrpc/import.c @@ -753,8 +753,7 @@ static int ptlrpc_connect_set_flags(struct obd_import *imp, static bool warned; spin_lock(&imp->imp_lock); - list_del(&imp->imp_conn_current->oic_item); - list_add(&imp->imp_conn_current->oic_item, &imp->imp_conn_list); + list_move(&imp->imp_conn_current->oic_item, &imp->imp_conn_list); imp->imp_last_success_conn = imp->imp_conn_current->oic_last_attempt; spin_unlock(&imp->imp_lock); diff --git a/fs/lustre/ptlrpc/service.c b/fs/lustre/ptlrpc/service.c index e0cce15..c2a00de 100644 --- a/fs/lustre/ptlrpc/service.c +++ b/fs/lustre/ptlrpc/service.c @@ -307,11 +307,10 @@ void ptlrpc_dispatch_difficult_reply(struct ptlrpc_reply_state *rs) rqbd = list_first_entry(&svcpt->scp_rqbd_idle, struct ptlrpc_request_buffer_desc, rqbd_list); - list_del(&rqbd->rqbd_list); /* assume we will post successfully */ svcpt->scp_nrqbds_posted++; - list_add(&rqbd->rqbd_list, &svcpt->scp_rqbd_posted); + list_move(&rqbd->rqbd_list, &svcpt->scp_rqbd_posted); spin_unlock(&svcpt->scp_lock); @@ -325,8 +324,7 @@ void ptlrpc_dispatch_difficult_reply(struct ptlrpc_reply_state *rs) spin_lock(&svcpt->scp_lock); svcpt->scp_nrqbds_posted--; - list_del(&rqbd->rqbd_list); - list_add_tail(&rqbd->rqbd_list, &svcpt->scp_rqbd_idle); + list_move_tail(&rqbd->rqbd_list, &svcpt->scp_rqbd_idle); /* Don't complain if no request buffers are posted right now; LNET * won't drop requests because we set the portal lazy! @@ -769,9 +767,7 @@ static void ptlrpc_server_drop_request(struct ptlrpc_request *req) refcount = --(rqbd->rqbd_refcount); if (refcount == 0) { /* request buffer is now idle: add to history */ - list_del(&rqbd->rqbd_list); - - list_add_tail(&rqbd->rqbd_list, &svcpt->scp_hist_rqbds); + list_move_tail(&rqbd->rqbd_list, &svcpt->scp_hist_rqbds); svcpt->scp_hist_nrqbds++; /* cull some history? @@ -2416,8 +2412,7 @@ static void ptlrpc_svcpt_stop_threads(struct ptlrpc_service_part *svcpt) struct ptlrpc_thread, t_link)) != NULL) { if (thread_is_stopped(thread)) { - list_del(&thread->t_link); - list_add(&thread->t_link, &zombie); + list_move(&thread->t_link, &zombie); continue; } spin_unlock(&svcpt->scp_lock);