Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4973840pxj; Wed, 9 Jun 2021 06:30:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0WQ8auIEjJkWUXwVM2u3jvHoCEzLO7KhlSfIQO+RbxzX+4UOJGB4ZX6tbgSY1J7Rx0/vj X-Received: by 2002:a05:6402:1a:: with SMTP id d26mr31169819edu.105.1623245446304; Wed, 09 Jun 2021 06:30:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623245446; cv=none; d=google.com; s=arc-20160816; b=PZbC2T0QKLvBiIwf8uLh67d/+SpnZGBTDfYmhUjdzsVicB8fvS5rKpeInbwPCNa4Tq Yf6wTytw8RTdPZYyclNtS8n+s1xBmcsgDmvYXfaD7QIY3dGKIhqToLXpelVoWV+bGyi3 FLGwK1FJAn2NSABYtaYAQSQEak5BBc7TxBBv4TYe6TTyET7rxwV3CmXIa023jULQvdLo I3BmVnSFSfUq6pMu1rHsXxUFAGnuvW/cEwkzTQap3VEzq+BuC577nOu/Nirs9hoVgUX8 PRgOLHdp5N7LPMnxcZrB0a0oimy2TFIJ67pntaonzKSLwXjDdWnh2D/+0rRCx2L+A1Mx MxnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=+xLC9e6rXmPKdlrnIJdtVWThjGYxf1FXUohbK47yEus=; b=RzZnD8YKsXPSy478SkFPVQ+TIuSiP7HFkQoW/vDVRhJyQ3zrMMDFS9S3tCWdSy9T+p E6UDdezdt/EKUCMPQSh3i8MejYIDiXUAzFKHmFXdSHFyhRr9LdtQdM9pblGUfaQ10sKB G5SmfjjRydM5kMPGPViqS/0sy5bah3T0h5fBkSWubYYcPupR8r9EV+BkLTgB6xiDZZQG 4cIOc4oxHHyzkvYKw8JN1E+b7O3Fv7xtNs6k6f5omat/x4euDc3Y0TxJA7yaZ9qjRpoU 6EjV+xfJtYs6ReK6inyruGa4hs9KDsmDHGkQu8mVmhxHiIv8aZkT0OsNMhEu7tmBDhE6 WLgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v16si2218248ejg.147.2021.06.09.06.30.21; Wed, 09 Jun 2021 06:30:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237103AbhFIHOv (ORCPT + 99 others); Wed, 9 Jun 2021 03:14:51 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:5462 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235698AbhFIHOv (ORCPT ); Wed, 9 Jun 2021 03:14:51 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4G0JCK1mDZzZfb2; Wed, 9 Jun 2021 15:10:05 +0800 (CST) Received: from dggpeml500020.china.huawei.com (7.185.36.88) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 9 Jun 2021 15:12:54 +0800 Received: from huawei.com (10.175.127.227) by dggpeml500020.china.huawei.com (7.185.36.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 9 Jun 2021 15:12:53 +0800 From: Baokun Li To: , Anil Gurumurthy , Sudarsana Kalluru , "James E.J. Bottomley" , "Martin K. Petersen" CC: , , , , , , , Hulk Robot Subject: [PATCH -next v2] [SCSI] bfa: Use list_move_tail instead of list_del/list_add_tail in bfa_fcpim.c Date: Wed, 9 Jun 2021 15:22:02 +0800 Message-ID: <20210609072202.1352890-1-libaokun1@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500020.china.huawei.com (7.185.36.88) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using list_move_tail() instead of list_del() + list_add_tail() in bfa_fcpim.c. Reported-by: Hulk Robot Signed-off-by: Baokun Li --- V1->V2: CC mailist drivers/scsi/bfa/bfa_fcpim.c | 37 +++++++++--------------- 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c index 7ad22288071b..a5eeb8a59afe 100644 --- a/drivers/scsi/bfa/bfa_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcpim.c @@ -83,8 +83,7 @@ enum bfa_itnim_event { * BFA IOIM related definitions */ #define bfa_ioim_move_to_comp_q(__ioim) do { \ - list_del(&(__ioim)->qe); \ - list_add_tail(&(__ioim)->qe, &(__ioim)->fcpim->ioim_comp_q); \ + list_move_tail(&(__ioim)->qe, &(__ioim)->fcpim->ioim_comp_q); \ } while (0) @@ -1023,8 +1022,7 @@ bfa_itnim_cleanup(struct bfa_itnim_s *itnim) * Move IO to a cleanup queue from active queue so that a later * TM will not pickup this IO. */ - list_del(&ioim->qe); - list_add_tail(&ioim->qe, &itnim->io_cleanup_q); + list_move_tail(&ioim->qe, &itnim->io_cleanup_q); bfa_wc_up(&itnim->wc); bfa_ioim_cleanup(ioim); @@ -1509,15 +1507,13 @@ bfa_ioim_sm_uninit(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) if (!bfa_itnim_is_online(ioim->itnim)) { if (!bfa_itnim_hold_io(ioim->itnim)) { bfa_sm_set_state(ioim, bfa_ioim_sm_hcb); - list_del(&ioim->qe); - list_add_tail(&ioim->qe, - &ioim->fcpim->ioim_comp_q); + list_move_tail(&ioim->qe, + &ioim->fcpim->ioim_comp_q); bfa_cb_queue(ioim->bfa, &ioim->hcb_qe, __bfa_cb_ioim_pathtov, ioim); } else { - list_del(&ioim->qe); - list_add_tail(&ioim->qe, - &ioim->itnim->pending_q); + list_move_tail(&ioim->qe, + &ioim->itnim->pending_q); } break; } @@ -2044,8 +2040,7 @@ bfa_ioim_sm_hcb_free(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) switch (event) { case BFA_IOIM_SM_HCB: bfa_sm_set_state(ioim, bfa_ioim_sm_resfree); - list_del(&ioim->qe); - list_add_tail(&ioim->qe, &ioim->fcpim->ioim_resfree_q); + list_move_tail(&ioim->qe, &ioim->fcpim->ioim_resfree_q); break; case BFA_IOIM_SM_FREE: @@ -2672,14 +2667,12 @@ bfa_ioim_notify_cleanup(struct bfa_ioim_s *ioim) * Move IO from itnim queue to fcpim global queue since itnim will be * freed. */ - list_del(&ioim->qe); - list_add_tail(&ioim->qe, &ioim->fcpim->ioim_comp_q); + list_move_tail(&ioim->qe, &ioim->fcpim->ioim_comp_q); if (!ioim->iosp->tskim) { if (ioim->fcpim->delay_comp && ioim->itnim->iotov_active) { bfa_cb_dequeue(&ioim->hcb_qe); - list_del(&ioim->qe); - list_add_tail(&ioim->qe, &ioim->itnim->delay_comp_q); + list_move_tail(&ioim->qe, &ioim->itnim->delay_comp_q); } bfa_itnim_iodone(ioim->itnim); } else @@ -2723,8 +2716,7 @@ bfa_ioim_delayed_comp(struct bfa_ioim_s *ioim, bfa_boolean_t iotov) * Move IO to fcpim global queue since itnim will be * freed. */ - list_del(&ioim->qe); - list_add_tail(&ioim->qe, &ioim->fcpim->ioim_comp_q); + list_move_tail(&ioim->qe, &ioim->fcpim->ioim_comp_q); } @@ -3318,8 +3310,7 @@ bfa_tskim_gather_ios(struct bfa_tskim_s *tskim) cmnd = (struct scsi_cmnd *) ioim->dio; int_to_scsilun(cmnd->device->lun, &scsilun); if (bfa_tskim_match_scope(tskim, scsilun)) { - list_del(&ioim->qe); - list_add_tail(&ioim->qe, &tskim->io_q); + list_move_tail(&ioim->qe, &tskim->io_q); } } @@ -3331,8 +3322,7 @@ bfa_tskim_gather_ios(struct bfa_tskim_s *tskim) cmnd = (struct scsi_cmnd *) ioim->dio; int_to_scsilun(cmnd->device->lun, &scsilun); if (bfa_tskim_match_scope(tskim, scsilun)) { - list_del(&ioim->qe); - list_add_tail(&ioim->qe, &ioim->fcpim->ioim_comp_q); + list_move_tail(&ioim->qe, &ioim->fcpim->ioim_comp_q); bfa_ioim_tov(ioim); } } @@ -3576,8 +3566,7 @@ void bfa_tskim_free(struct bfa_tskim_s *tskim) { WARN_ON(!bfa_q_is_on_q_func(&tskim->itnim->tsk_q, &tskim->qe)); - list_del(&tskim->qe); - list_add_tail(&tskim->qe, &tskim->fcpim->tskim_free_q); + list_move_tail(&tskim->qe, &tskim->fcpim->tskim_free_q); } /*