On Mon, 2014-02-10 at 04:09 -0800, Christoph Hellwig wrote: > On Sun, Feb 09, 2014 at 12:26:48AM -0800, Nicholas A. Bellinger wrote: > > Again, try NOP'ing all REQ_TYPE_FS type commands immediately in > > ->queuecommand() in order to determine a baseline without any other LLD > > overhead involved. > > Seems like this duplicates the fake_rw parameter. Removing the needless > host_lock in queuecommand and maybe a few more optimizations would > certainly be more useful than duplicating the fake_rw parameter. > Fine by me. --nab diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 80b8b10..631f5d2 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -3603,7 +3603,7 @@ static void sdebug_remove_adapter(void) } static -int scsi_debug_queuecommand_lck(struct scsi_cmnd *SCpnt, done_funct_t done) +int __scsi_debug_queuecommand_lck(struct scsi_cmnd *SCpnt, done_funct_t done) { unsigned char *cmd = (unsigned char *) SCpnt->cmnd; int len, k; @@ -3775,8 +3775,6 @@ read: errsts = check_readiness(SCpnt, 0, devip); if (errsts) break; - if (scsi_debug_fake_rw) - break; get_data_transfer_info(cmd, &lba, &num, &ei_lba); errsts = resp_read(SCpnt, lba, num, devip, ei_lba); if (inj_recovered && (0 == errsts)) { @@ -3825,8 +3823,6 @@ write: errsts = check_readiness(SCpnt, 0, devip); if (errsts) break; - if (scsi_debug_fake_rw) - break; get_data_transfer_info(cmd, &lba, &num, &ei_lba); errsts = resp_write(SCpnt, lba, num, devip, ei_lba); if (inj_recovered && (0 == errsts)) { @@ -3903,8 +3899,6 @@ write: errsts = check_readiness(SCpnt, 0, devip); if (errsts) break; - if (scsi_debug_fake_rw) - break; get_data_transfer_info(cmd, &lba, &num, &ei_lba); errsts = resp_read(SCpnt, lba, num, devip, ei_lba); if (errsts) @@ -3952,7 +3946,21 @@ write: (delay_override ? 0 : scsi_debug_delay)); } -static DEF_SCSI_QCMD(scsi_debug_queuecommand) +static DEF_SCSI_QCMD(__scsi_debug_queuecommand) + +static int scsi_debug_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) +{ + struct request *rq = sc->request; + + if (scsi_debug_fake_rw && rq->cmd_type == REQ_TYPE_FS) { + set_host_byte(sc, DID_OK); + sc->result |= SAM_STAT_GOOD; + sc->scsi_done(sc); + return 0; + } + + return __scsi_debug_queuecommand(host, sc); +} static struct scsi_host_template sdebug_driver_template = { .show_info = scsi_debug_show_info, @@ -3973,7 +3981,7 @@ static struct scsi_host_template sdebug_driver_template = { .can_queue = SCSI_DEBUG_CANQUEUE, .this_id = 7, .sg_tablesize = 256, - .cmd_per_lun = 16, + .cmd_per_lun = 64, .max_sectors = 0xffff, .use_clustering = DISABLE_CLUSTERING, .module = THIS_MODULE, -- 1.7.10.4 -- To unsubscribe from this list: 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