From patchwork Thu Apr 11 07:14:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SEO HOYOUNG X-Patchwork-Id: 788206 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67A7B13E401 for ; Thu, 11 Apr 2024 07:10:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712819449; cv=none; b=qNNEQqN4IeEpHeS2UaZXa6MS3zsWiCoPqDmx89t0Rqcvmu6UQ4LPoYqXhtCt4u36yorzB0qayA2kWRGXSA7GxTnbK2egqygzymjdV31lRJWmKrPEvhO5AUXF6l+38MHLPF89TyzdrtFYrHdjUqVJhBFC0cMLJEWKy2ILQ5YVn2M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712819449; c=relaxed/simple; bh=EVrrGbITq6iY1+riebn7BmWva7odfM/dc+M8apZJsbk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type: References; b=b3/lLtv+lEm4iRJinCbu6ik7vnfvbC2WSWWKGgCx0Q7AlXGZy0ByLJHjos1FKJvMSLcl6r6QQdRJuC1hKrxfnkWTUNTa3MCQhjLlyrGrkF8Wpqjk2ORD7aU0P5MLAYqanJuaJ0kGbp2/ZsR3/Od+LDA28j+3bsXCEEw9C14ELMk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=HLXTbNFO; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="HLXTbNFO" Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20240411071044epoutp03499d1936e9fb7be60994e48d894480f9~FKDWpP9Yg2393323933epoutp03P for ; Thu, 11 Apr 2024 07:10:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20240411071044epoutp03499d1936e9fb7be60994e48d894480f9~FKDWpP9Yg2393323933epoutp03P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1712819444; bh=zVTnUQHv886FrPUVq7+WRcst/8IszsvzOiHELYTRM4Q=; h=From:To:Cc:Subject:Date:References:From; b=HLXTbNFO1TrH7dJM4cA5ghQdyg+scQATWASlRi0RrqKUGCSVcCX8EiTxE1ollqjBj yi9MOeiek/6Xx2n6OSkF+cfH1lFLUWkdHFuE2cPOiXkuVbA2S9OEe9lFD4v1bqfy7p q1zh8Hic8qq6b3SS06mZh9jGWoV9QlILBG66jHtE= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20240411071043epcas2p4f4f3f01b427d0aa827a057608b6ea64b~FKDWBERXA0511405114epcas2p4m; Thu, 11 Apr 2024 07:10:43 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.99]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4VFW7Q60s7z4x9Q1; Thu, 11 Apr 2024 07:10:42 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 2A.99.09640.2FC87166; Thu, 11 Apr 2024 16:10:42 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20240411071042epcas2p4b2e6937a952e6dfa879db166983b1c54~FKDU5YhP40511405114epcas2p4j; Thu, 11 Apr 2024 07:10:42 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20240411071042epsmtrp151f16100e8b264a1de75943ef94c66ce~FKDU4ULWa2252922529epsmtrp18; Thu, 11 Apr 2024 07:10:42 +0000 (GMT) X-AuditID: b6c32a48-01f5ca80000025a8-88-66178cf24864 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 21.54.07541.2FC87166; Thu, 11 Apr 2024 16:10:42 +0900 (KST) Received: from rack03.dsn.sec.samsung.com (unknown [10.229.95.126]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240411071042epsmtip1a0e5464db6a74fe1adfd6a7cc2e38d72~FKDUngiKF0441504415epsmtip1R; Thu, 11 Apr 2024 07:10:42 +0000 (GMT) From: SEO HOYOUNG To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, beanhuo@micron.com, bvanassche@acm.org, kwangwon.min@samsung.com, kwmad.kim@samsung.com, sh425.lee@samsung.com, quic_nguyenb@quicinc.com, cpgs@samsung.com, h10.kim@samsung.com Cc: SEO HOYOUNG Subject: [PATCH v3] scsi: ufs: core: changing the status to check inflight Date: Thu, 11 Apr 2024 16:14:44 +0900 Message-Id: <20240411071444.51873-1-hy50.seo@samsung.com> X-Mailer: git-send-email 2.26.0 Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHJsWRmVeSWpSXmKPExsWy7bCmue6nHvE0g/3LDCwezNvGZvHy51U2 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l8sbl SNZFLd5TFzBYLQlgzHCe+ST9X/V8jxhjvr2utg9/zrS7dl/gm0pBKh+LQHv7Kb7i//d/l81Q 4NCzC3/F3Sc9zVPozUzbgAsl85RYijMSDbWYi4oTAUrSb9r3AgAA X-CMS-MailID: 20240411071042epcas2p4b2e6937a952e6dfa879db166983b1c54 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240411071042epcas2p4b2e6937a952e6dfa879db166983b1c54 References: ufshcd_cmd_inflight() is used to check whether or not a command is in progress. Make it skip commands that have already completed by changing the !blk_mq_request_started(rq) check into blk_mq_rq_state(rq) != MQ_RQ_IN_FLIGHT. We cannot rely on lrbp->cmd since lrbp->cmd is not cleared when a command completes. v1 -> v2: convert the two return statements into a single return statement And modified comment of commit v2 -> v3: remove superfluous parentheses in the above return statement Link: https://lore.kernel.org/linux-scsi/20230517223157.1068210-3-bvanassche@acm.org/ Signed-off-by: SEO HOYOUNG --- drivers/ufs/core/ufshcd.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 21429eec1b82..a99f7ab85f12 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -3082,16 +3082,7 @@ static int ufshcd_compose_dev_cmd(struct ufs_hba *hba, */ bool ufshcd_cmd_inflight(struct scsi_cmnd *cmd) { - struct request *rq; - - if (!cmd) - return false; - - rq = scsi_cmd_to_rq(cmd); - if (!blk_mq_request_started(rq)) - return false; - - return true; + return cmd && blk_mq_rq_state(scsi_cmd_to_rq(cmd)) == MQ_RQ_IN_FLIGHT; } /*