Discussion:
[PATCH] scsi_debug: switch to table based parser
(too old to reply)
Douglas Gilbert
2014-10-23 20:33:10 UTC
Permalink
Changing a frequently hacked, big switch parser to being table
based is, of necessity, not a small patch. Testing showed up
some breakages which required extra code and re-factoring.
Since supporting the REPORT SUPPORTED OPERATION CODES command,
checking cdbs for non-zero values in reserved locations, and
the table based parser are closely related; implementing them
at the same time seemed to be practical. But some additions,
such as the COMPARE AND WRITE command, should really be in
their own patches (but adding new bugs was a useful technique
for finding existing ones).

The first attachment is large and against Christoph's
drivers-for-3.19 branch. It will also apply to his
drivers-for-3.18 branch. The second, smaller attachment is
for anyone who wants to look at (or try) this patch on
lk 3.17.1; first apply the second patch, then the first.
Almost all of my testing has been on lk 3.17.0 and .1 .

Perhaps contributors to this driver, such as Martin Petersen
who has written large parts of this driver (e.g. logical block
provisioning, DIF and error injection), might run any test
cases they have to determine what I have broken.

Speed improvements at this stage are marginal at best.

ChangeLog:
- remove big switch statement in queuecommand() and replace
with a table based parser
- implement REPORT SUPPORTED OPERATION CODES command which
reads that table
- add 'strict' option which when set will cause each incoming
cdb to be checked against the cdb usage mask held in the
table based parser
- add logic for ILLEGAL REQUEST sense key specific field
pointers, use for most ILLEGAL REQUESTs
- add 'capacity data has changed' unit attention since the
virtual_gb option can be changed on-the-fly
- implement REPORT SUPPORTED TASK MANAGEMENT FUNCTIONS command
- implement COMPARE AND WRITE command
- implement NDOB (no data-out buffer) in WRITE SAME(16)
- make GET LBA STATUS work when no logical block provisioning

Todo:
- re-order teardown in scsi_debug_exit()
- make sdebug_dev_info::stopped atomic (add to end of uas_bm ?)
- review Rob Elliott's suggestions; look at speed ups
- remove host_lock logic and make the host_lock option a dummy
- update some mode page and VPD data to reflect more recent
devices
- changing remaining >> and << byte handling over to
get/put_unaligned_be*()
- set INFO field for COMPARE AND WRITE command MISCOMPAREs

Signed-off-by: Douglas Gilbert <***@interlog.com>

Loading...