diff options
-rw-r--r-- | block/bsg.c | 10 | ||||
-rw-r--r-- | include/linux/bsg.h | 13 |
2 files changed, 16 insertions, 7 deletions
diff --git a/block/bsg.c b/block/bsg.c index d60eee549405..ed2646827234 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * bsg.c - block layer implementation of the sg v3 interface | 2 | * bsg.c - block layer implementation of the sg v4 interface |
3 | * | 3 | * |
4 | * Copyright (C) 2004 Jens Axboe <axboe@suse.de> SUSE Labs | 4 | * Copyright (C) 2004 Jens Axboe <axboe@suse.de> SUSE Labs |
5 | * Copyright (C) 2004 Peter M. Jones <pjones@redhat.com> | 5 | * Copyright (C) 2004 Peter M. Jones <pjones@redhat.com> |
@@ -421,7 +421,6 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr, | |||
421 | hdr->info = 0; | 421 | hdr->info = 0; |
422 | if (hdr->device_status || hdr->transport_status || hdr->driver_status) | 422 | if (hdr->device_status || hdr->transport_status || hdr->driver_status) |
423 | hdr->info |= SG_INFO_CHECK; | 423 | hdr->info |= SG_INFO_CHECK; |
424 | hdr->din_resid = rq->data_len; | ||
425 | hdr->response_len = 0; | 424 | hdr->response_len = 0; |
426 | 425 | ||
427 | if (rq->sense_len && hdr->response) { | 426 | if (rq->sense_len && hdr->response) { |
@@ -437,9 +436,14 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr, | |||
437 | } | 436 | } |
438 | 437 | ||
439 | if (rq->next_rq) { | 438 | if (rq->next_rq) { |
439 | hdr->dout_resid = rq->data_len; | ||
440 | hdr->din_resid = rq->next_rq->data_len; | ||
440 | blk_rq_unmap_user(bidi_bio); | 441 | blk_rq_unmap_user(bidi_bio); |
441 | blk_put_request(rq->next_rq); | 442 | blk_put_request(rq->next_rq); |
442 | } | 443 | } else if (rq_data_dir(rq) == READ) |
444 | hdr->din_resid = rq->data_len; | ||
445 | else | ||
446 | hdr->dout_resid = rq->data_len; | ||
443 | 447 | ||
444 | blk_rq_unmap_user(bio); | 448 | blk_rq_unmap_user(bio); |
445 | blk_put_request(rq); | 449 | blk_put_request(rq); |
diff --git a/include/linux/bsg.h b/include/linux/bsg.h index 102dc096e1cb..60e377b520f8 100644 --- a/include/linux/bsg.h +++ b/include/linux/bsg.h | |||
@@ -15,14 +15,18 @@ struct sg_io_v4 { | |||
15 | 15 | ||
16 | __u32 request_len; /* [i] in bytes */ | 16 | __u32 request_len; /* [i] in bytes */ |
17 | __u64 request; /* [i], [*i] {SCSI: cdb} */ | 17 | __u64 request; /* [i], [*i] {SCSI: cdb} */ |
18 | __u64 request_tag; /* [i] {SCSI: task tag (only if flagged)} */ | ||
18 | __u32 request_attr; /* [i] {SCSI: task attribute} */ | 19 | __u32 request_attr; /* [i] {SCSI: task attribute} */ |
19 | __u32 request_tag; /* [i] {SCSI: task tag (only if flagged)} */ | ||
20 | __u32 request_priority; /* [i] {SCSI: task priority} */ | 20 | __u32 request_priority; /* [i] {SCSI: task priority} */ |
21 | __u32 request_extra; /* [i] {spare, for padding} */ | ||
21 | __u32 max_response_len; /* [i] in bytes */ | 22 | __u32 max_response_len; /* [i] in bytes */ |
22 | __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */ | 23 | __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */ |
23 | 24 | ||
24 | /* "din_" for data in (from device); "dout_" for data out (to device) */ | 25 | /* "dout_": data out (to device); "din_": data in (from device) */ |
26 | __u32 dout_iovec_count; /* [i] 0 -> "flat" dout transfer else | ||
27 | dout_xfer points to array of iovec */ | ||
25 | __u32 dout_xfer_len; /* [i] bytes to be transferred to device */ | 28 | __u32 dout_xfer_len; /* [i] bytes to be transferred to device */ |
29 | __u32 din_iovec_count; /* [i] 0 -> "flat" din transfer */ | ||
26 | __u32 din_xfer_len; /* [i] bytes to be transferred from device */ | 30 | __u32 din_xfer_len; /* [i] bytes to be transferred from device */ |
27 | __u64 dout_xferp; /* [i], [*i] */ | 31 | __u64 dout_xferp; /* [i], [*i] */ |
28 | __u64 din_xferp; /* [i], [*o] */ | 32 | __u64 din_xferp; /* [i], [*o] */ |
@@ -39,8 +43,9 @@ struct sg_io_v4 { | |||
39 | __u32 info; /* [o] additional information */ | 43 | __u32 info; /* [o] additional information */ |
40 | __u32 duration; /* [o] time to complete, in milliseconds */ | 44 | __u32 duration; /* [o] time to complete, in milliseconds */ |
41 | __u32 response_len; /* [o] bytes of response actually written */ | 45 | __u32 response_len; /* [o] bytes of response actually written */ |
42 | __s32 din_resid; /* [o] actual_din_xfer_len - din_xfer_len */ | 46 | __s32 din_resid; /* [o] din_xfer_len - actual_din_xfer_len */ |
43 | __u32 generated_tag; /* [o] {SCSI: task tag that transport chose} */ | 47 | __s32 dout_resid; /* [o] dout_xfer_len - actual_dout_xfer_len */ |
48 | __u64 generated_tag; /* [o] {SCSI: transport generated task tag} */ | ||
44 | __u32 spare_out; /* [o] */ | 49 | __u32 spare_out; /* [o] */ |
45 | 50 | ||
46 | __u32 padding; | 51 | __u32 padding; |