提交 b57d7c01 编写于 作者: C Christoph Hellwig

scsi_debug: simple short transfer injection

Add an option to only transfer half the data for every n-th command.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Acked-by: NDouglas Gilbert <dgilbert@interlog.com>
Reviewed-by: NNicholas Bellinger <nab@linux-iscsi.org>
上级 b54197c4
...@@ -130,6 +130,7 @@ static const char * scsi_debug_version_date = "20100324"; ...@@ -130,6 +130,7 @@ static const char * scsi_debug_version_date = "20100324";
#define SCSI_DEBUG_OPT_DIF_ERR 32 #define SCSI_DEBUG_OPT_DIF_ERR 32
#define SCSI_DEBUG_OPT_DIX_ERR 64 #define SCSI_DEBUG_OPT_DIX_ERR 64
#define SCSI_DEBUG_OPT_MAC_TIMEOUT 128 #define SCSI_DEBUG_OPT_MAC_TIMEOUT 128
#define SCSI_DEBUG_OPT_SHORT_TRANSFER 256
/* When "every_nth" > 0 then modulo "every_nth" commands: /* When "every_nth" > 0 then modulo "every_nth" commands:
* - a no response is simulated if SCSI_DEBUG_OPT_TIMEOUT is set * - a no response is simulated if SCSI_DEBUG_OPT_TIMEOUT is set
* - a RECOVERED_ERROR is simulated on successful read and write * - a RECOVERED_ERROR is simulated on successful read and write
...@@ -3583,6 +3584,7 @@ int scsi_debug_queuecommand_lck(struct scsi_cmnd *SCpnt, done_funct_t done) ...@@ -3583,6 +3584,7 @@ int scsi_debug_queuecommand_lck(struct scsi_cmnd *SCpnt, done_funct_t done)
int inj_transport = 0; int inj_transport = 0;
int inj_dif = 0; int inj_dif = 0;
int inj_dix = 0; int inj_dix = 0;
int inj_short = 0;
int delay_override = 0; int delay_override = 0;
int unmap = 0; int unmap = 0;
...@@ -3628,6 +3630,8 @@ int scsi_debug_queuecommand_lck(struct scsi_cmnd *SCpnt, done_funct_t done) ...@@ -3628,6 +3630,8 @@ int scsi_debug_queuecommand_lck(struct scsi_cmnd *SCpnt, done_funct_t done)
inj_dif = 1; /* to reads and writes below */ inj_dif = 1; /* to reads and writes below */
else if (SCSI_DEBUG_OPT_DIX_ERR & scsi_debug_opts) else if (SCSI_DEBUG_OPT_DIX_ERR & scsi_debug_opts)
inj_dix = 1; /* to reads and writes below */ inj_dix = 1; /* to reads and writes below */
else if (SCSI_DEBUG_OPT_SHORT_TRANSFER & scsi_debug_opts)
inj_short = 1;
} }
if (devip->wlun) { if (devip->wlun) {
...@@ -3744,6 +3748,10 @@ int scsi_debug_queuecommand_lck(struct scsi_cmnd *SCpnt, done_funct_t done) ...@@ -3744,6 +3748,10 @@ int scsi_debug_queuecommand_lck(struct scsi_cmnd *SCpnt, done_funct_t done)
if (scsi_debug_fake_rw) if (scsi_debug_fake_rw)
break; break;
get_data_transfer_info(cmd, &lba, &num, &ei_lba); get_data_transfer_info(cmd, &lba, &num, &ei_lba);
if (inj_short)
num /= 2;
errsts = resp_read(SCpnt, lba, num, devip, ei_lba); errsts = resp_read(SCpnt, lba, num, devip, ei_lba);
if (inj_recovered && (0 == errsts)) { if (inj_recovered && (0 == errsts)) {
mk_sense_buffer(devip, RECOVERED_ERROR, mk_sense_buffer(devip, RECOVERED_ERROR,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册