Re: [PATCH 02/24] scsi: add scsi_{get,put}_reserved_cmd()

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

 



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



[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