Re: [PATCH 10/18] scsi: implement reserved command handling

Hannes Reinecke
2021-05-05T05:56:52Z

On 5/5/21 2:45 AM, Bart Van Assche wrote:
> On 5/3/21 8:03 AM, Hannes Reinecke wrote:
>> struct scsi_cmnd *scsi_get_internal_cmd(struct scsi_device *sdev,
>> unsigned int op, blk_mq_req_flags_t flags)
>> @@ -2005,6 +2009,10 @@ struct scsi_cmnd *scsi_get_internal_cmd(struct scsi_device *sdev,
>>
>> WARN_ON_ONCE(((op & REQ_OP_MASK) != REQ_OP_SCSI_IN) &&
>> ((op & REQ_OP_MASK) != REQ_OP_SCSI_OUT));
>> +
>> + if (sdev->host->nr_reserved_cmds)
>> + flags |= BLK_MQ_REQ_RESERVED;
>> +
>> rq = blk_mq_alloc_request(sdev->request_queue, op, flags);
>> if (IS_ERR(rq))
>> return NULL;
>
> Can the if-statement be removed such that scsi_get_internal_cmd() fails
> if sdev->host->nr_reserved_cmds == 0? I'm concerned that otherwise it
> will be very hard to determine which requests are internal and which
> ones not from inside a blk_mq_tagset_busy_iter() callback.
>
Original idea was that one could use scsi_get_internal_cmd() even with
nr_reserved_cmds == 0, but you are right that this will probably just
lead to confusion.

Will be modifying it for the next round.

Cheers,

Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions Germany GmbH, 90409 Nürnberg
GF: F. Imendörffer, HRB 36809 (AG Nürnberg)