• D
    [SCSI] scsi_debug: add consecutive medium errors · 32f7ef73
    Douglas Gilbert 提交于
    A useful test case for error recovery is multiple,
    consecutive medium errors. When scsi_debug is started
    with "opts=2" a MEDIUM ERROR is generated when block
    0x1234 (4660) is read. The patch extends that to
    10 consecutive blocks from 0x1234 (i.e. blocks 4660 to
    4669 inclusive).
    
    [0:0:0:0]  disk  ATA    INTEL SSD  2CV1 /dev/sda /dev/sg0 80.0GB
    [10:0:0:0] disk  Linux  scsi_debug 0004 /dev/sdb /dev/sg1 1.09TB
    
    Output file not specified so no copy, just reading input
     >> unrecovered read error at blk=4660, substitute zeros
    ...
     >> unrecovered read error at blk=4669, substitute zeros
    4670+10 records in
    0+0 records out
    10 unrecovered read errors
    lowest unrecovered read lba=4660, highest unrecovered lba=4669
    time to read data: 0.047943 secs at 49.87 MB/sec
    
    BTW Change /dev/sg1 (bsg device works just as well) to
    /dev/sdb to see why, with faulty media, you do not want
    to use the block layer interface. Reason: time block
    layer takes to do useless retries and collateral damage
    to data in its 4 KB blocks (O_DIRECT mitigates the
    latter).
    
    ChangeLog:
        - extend opts=2 medium error generation at block
          0x1234 to 10 consecutive blocks (i.e. blocks
          0x1234 to 0x123d).
    Signed-off-by: NDouglas Gilbert <dgilbert@interlog.com>
    Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
    32f7ef73
scsi_debug.c 118.5 KB