* [PATCH v3] scsi: ufs: core: changing the status to check inflight
[not found] <CGME20240411071042epcas2p4b2e6937a952e6dfa879db166983b1c54@epcas2p4.samsung.com>
@ 2024-04-11 7:14 ` SEO HOYOUNG
2024-04-11 18:23 ` Bart Van Assche
2024-04-12 1:54 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: SEO HOYOUNG @ 2024-04-11 7:14 UTC (permalink / raw)
To: linux-scsi, linux-kernel, alim.akhtar, avri.altman, jejb,
martin.petersen, beanhuo, bvanassche, kwangwon.min, kwmad.kim,
sh425.lee, quic_nguyenb, cpgs, h10.kim
Cc: SEO HOYOUNG
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 <hy50.seo@samsung.com>
---
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;
}
/*
--
2.26.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] scsi: ufs: core: changing the status to check inflight
2024-04-11 7:14 ` [PATCH v3] scsi: ufs: core: changing the status to check inflight SEO HOYOUNG
@ 2024-04-11 18:23 ` Bart Van Assche
2024-04-12 1:54 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2024-04-11 18:23 UTC (permalink / raw)
To: SEO HOYOUNG, linux-scsi, linux-kernel, alim.akhtar, avri.altman,
jejb, martin.petersen, beanhuo, kwangwon.min, kwmad.kim,
sh425.lee, quic_nguyenb, cpgs, h10.kim
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] scsi: ufs: core: changing the status to check inflight
2024-04-11 7:14 ` [PATCH v3] scsi: ufs: core: changing the status to check inflight SEO HOYOUNG
2024-04-11 18:23 ` Bart Van Assche
@ 2024-04-12 1:54 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2024-04-12 1:54 UTC (permalink / raw)
To: SEO HOYOUNG
Cc: linux-scsi, linux-kernel, alim.akhtar, avri.altman, jejb,
martin.petersen, beanhuo, bvanassche, kwangwon.min, kwmad.kim,
sh425.lee, quic_nguyenb, cpgs, h10.kim
> 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.
Applied to 6.10/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-12 1:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20240411071042epcas2p4b2e6937a952e6dfa879db166983b1c54@epcas2p4.samsung.com>
2024-04-11 7:14 ` [PATCH v3] scsi: ufs: core: changing the status to check inflight SEO HOYOUNG
2024-04-11 18:23 ` Bart Van Assche
2024-04-12 1:54 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox