Re: [PATCH v1] scsi: ufs: core: changing the status to check inflight

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/5/24 00:16, SEO HOYOUNG wrote:
According to below the patch applied, lrbp->cmd do not will NULL
after call release_scsi_cmd()
So check the rq->state unconditionally even if it is completed normally
in ufshcd_cmd_inflight()

If occurred abort status and tm_cmd timeout, will run err_handler
for re-init UFS.
Then err_handler will check pending request for clearing cmd.
At that time, check if the state of rq is not MQ_RQ_IDLE.
In other words, check if it is MQ_RQ_COMPLETE or MQ_RQ_IN_FLIGHT.
If rq->state is MQ_RQ_COMPLETE, it is already completed in the block,
so there is no need to process the queue.

The above description does not explain the motivation for this patch
very well. How about the following description?

"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."

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 21429eec1b82..3f47ea584cb1 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -3088,7 +3088,7 @@ bool ufshcd_cmd_inflight(struct scsi_cmnd *cmd)
  		return false;
rq = scsi_cmd_to_rq(cmd);
-	if (!blk_mq_request_started(rq))
+	if (blk_mq_rq_state(rq) != MQ_RQ_IN_FLIGHT)
  		return false;
return true;

Please convert the two return statements into a single return statement,
e.g. as follows:

	return cmd &&
	    blk_mq_rq_state(scsi_cmd_to_rq(cmd)) == MQ_RQ_IN_FLIGHT;

Thanks,

Bart.




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux