aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/scsi/scsi_mid_low_api.txt
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2010-12-23 21:40:37 -0500
committerJames Bottomley <James.Bottomley@suse.de>2011-01-24 13:21:39 -0500
commit75c65a5edaa8b815c1428314eaf696788f1ebbdb (patch)
treebdb28de023e48dcc0f848bf8fb55310a9caa0322 /Documentation/scsi/scsi_mid_low_api.txt
parent4977c82504f58d7579acabd21688183eaa8768fb (diff)
[SCSI] scsi_mid_low_api.txt recommend resid usage
As discussed in a thread on this list titled: "RFC: short reads on block devices" this patch adds recommendations for LLDs to set resid when there might be uncertainty about how much data has been returned by a device. This patch inline and attached] is against scsi-misc-2.6.git Signed-off-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'Documentation/scsi/scsi_mid_low_api.txt')
-rw-r--r--Documentation/scsi/scsi_mid_low_api.txt14
1 files changed, 13 insertions, 1 deletions
diff --git a/Documentation/scsi/scsi_mid_low_api.txt b/Documentation/scsi/scsi_mid_low_api.txt
index df322c103466..5f17d29c59b5 100644
--- a/Documentation/scsi/scsi_mid_low_api.txt
+++ b/Documentation/scsi/scsi_mid_low_api.txt
@@ -1343,7 +1343,7 @@ Members of interest:
1343 underruns (overruns should be rare). If possible an LLD 1343 underruns (overruns should be rare). If possible an LLD
1344 should set 'resid' prior to invoking 'done'. The most 1344 should set 'resid' prior to invoking 'done'. The most
1345 interesting case is data transfers from a SCSI target 1345 interesting case is data transfers from a SCSI target
1346 device device (i.e. READs) that underrun. 1346 device (e.g. READs) that underrun.
1347 underflow - LLD should place (DID_ERROR << 16) in 'result' if 1347 underflow - LLD should place (DID_ERROR << 16) in 'result' if
1348 actual number of bytes transferred is less than this 1348 actual number of bytes transferred is less than this
1349 figure. Not many LLDs implement this check and some that 1349 figure. Not many LLDs implement this check and some that
@@ -1351,6 +1351,18 @@ Members of interest:
1351 report a DID_ERROR. Better for an LLD to implement 1351 report a DID_ERROR. Better for an LLD to implement
1352 'resid'. 1352 'resid'.
1353 1353
1354It is recommended that a LLD set 'resid' on data transfers from a SCSI
1355target device (e.g. READs). It is especially important that 'resid' is set
1356when such data transfers have sense keys of MEDIUM ERROR and HARDWARE ERROR
1357(and possibly RECOVERED ERROR). In these cases if a LLD is in doubt how much
1358data has been received then the safest approach is to indicate no bytes have
1359been received. For example: to indicate that no valid data has been received
1360a LLD might use these helpers:
1361 scsi_set_resid(SCpnt, scsi_bufflen(SCpnt));
1362where 'SCpnt' is a pointer to a scsi_cmnd object. To indicate only three 512
1363bytes blocks has been received 'resid' could be set like this:
1364 scsi_set_resid(SCpnt, scsi_bufflen(SCpnt) - (3 * 512));
1365
1354The scsi_cmnd structure is defined in include/scsi/scsi_cmnd.h 1366The scsi_cmnd structure is defined in include/scsi/scsi_cmnd.h
1355 1367
1356 1368