> +static inline struct scsi_cmnd *scsi_get_reserved_cmd(struct scsi_device 
> *sdev)
> +{
> +     struct request *rq;
> +     struct scsi_cmnd *scmd;
> +
> +     rq = blk_mq_alloc_request(sdev->request_queue,
> +                               REQ_OP_SCSI_OUT | REQ_NOWAIT,
> +                               BLK_MQ_REQ_RESERVED);

REQ_OP_SCSI_OUT is used for data transfers to the device, is that really
what you want?  REQ_NOWAIT not only seems misplaced, but also generally
wrong.  Maybe for some callers you don't want to wait, but that
really should be passed in.

Also why does this take a scsi device?  Host reserved command usually
would be on a per-host, not a per-LU basis.

> +     if (IS_ERR(rq))
> +             return NULL;
> +     scmd = blk_mq_rq_to_pdu(rq);
> +     scmd->request = rq;
> +     return scmd;
> +}
> +
> +static inline void scsi_put_reserved_cmd(struct scsi_cmnd *scmd)
> +{
> +     struct request *rq = blk_mq_rq_from_pdu(scmd);
> +
> +     blk_mq_free_request(rq);
> +}

Also both helpers really should be out of line somewhere.

Reply via email to