Re: [PATCH RFC 0/4] use scatter lists for all block pc requests and simplify hw handlers

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

 



On Sat, Jun 04, 2005 at 11:07:14AM -0500, James Bottomley wrote:
> +	if (bufflen)
> +		req = blk_rq_map_kern(sreq->sr_device->request_queue,
> +				      sreq->sr_data_direction == DMA_TO_DEVICE,
> +				      buffer, bufflen, __GFP_WAIT);
> +	else
> +		req = blk_get_request(sreq->sr_device->request_queue, READ,
> +				      __GFP_WAIT);

shouldn't blk_rq_map_kern handle a 0 buffer and do nothing more than
blk_get_request?  It's not exactly a criticial fastpath and that would make life
easier for the callers.

> +		if (req->rq_disk) {
> +			drv = *(struct scsi_driver **)req->rq_disk->private_data;
> +			if (unlikely(!drv->init_command(cmd))) {
> +				scsi_release_buffers(cmd);
> +				scsi_put_command(cmd);
> +				return BLKPREP_KILL;
> +			}
> +		} else {
> +			memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd));
> +			if (rq_data_dir(req) == WRITE)
> +				cmd->sc_data_direction = DMA_TO_DEVICE;
> +			else if (req->data_len)
> +				cmd->sc_data_direction = DMA_FROM_DEVICE;
> +			else
> +				cmd->sc_data_direction = DMA_NONE;
> +			
> +			cmd->transfersize = req->data_len;
> +			cmd->allowed = 3;
> +			cmd->timeout_per_command = req->timeout;

most of this could probably be done in the midlayer always instead of the
upper drivers.

-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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