tcm/pscsi: Removal of struct scsi_disk access from pscsi_do_task()..?
Greetings hch and Co,
With this todays TCM/pSCSI cleanups pushed to lio-core-2.6.git/lio-4.0, I am currently looking at removing the last two remaining uses of drivers/scsi/sd.h:struct scsi_disk in pscsi_do_task() and __pscsi_get_dev_info().
The latter is easy enough as the modern LIO userspace tools no longer depend on this 'pSCSI claimer' information from $PSCSI_HBA/$DEV/info, so I have go ahead and removed it this reference. The former case for the main I/O path for struct se_task currently looks like:
/*
* Grab pointer to struct gendisk for TYPE_DISK and TYPE_ROM
* cases (eg: cases where struct scsi_device has a backing
* struct block_device. Also set the struct request->timeout
* value based on peripheral device type (from SCSI).
*/
if (pdv->pdv_sd->type == TYPE_DISK) {
struct scsi_disk *sdisk = dev_get_drvdata(
&pdv->pdv_sd->sdev_gendev);
gd = sdisk->disk;
pt->pscsi_req->timeout = PS_TIMEOUT_DISK;
} else
pt->pscsi_req->timeout = PS_TIMEOUT_OTHER;
pt->pscsi_req->retries = PS_RETRY;
/*
* Queue the struct request into the struct scsi_device->request_queue.
*/
blk_execute_rq_nowait(pdv->pdv_sd->request_queue, gd,
pt->pscsi_req, 1, pscsi_req_done);
return PYX_TRANSPORT_SENT_TO_TRANSPORT;My two questions are:
*) Is passing NULL for struct gendisk *gd into blk_execute_rq_nowait() and hence
a NULL struct request->rd_disk acceptable for struct request->rq_flags=REQ_TYPE_BLOCK_PC usage in pscsi_blk_init_request() and pscsi_blk_get_request()..?
*) Is there a more sane way to locate struct gendisk *gd from struct scsi_device
for the typical backing struct block_device TYPE_DISK case..?
Thanks!
--nab
Quoted 3 lines · Nicholas A. Bellinger
*) Is passing NULL for struct gendisk *gd into
blk_execute_rq_nowait()and hence
a NULL structrequest->rd_diskacceptable for struct request->rq_flags=REQ_TYPE_BLOCK_PC usage inpscsi_blk_init_request()andpscsi_blk_get_request()..?
Yes.
Quoted 2 lines
*) Is there a more sane way to locate struct gendisk *gd from struct
scsi_device
for the typical backing structblock_deviceTYPE_DISKcase..?
No.