diff options
-rw-r--r-- | block/blk-core.c | 2 | ||||
-rw-r--r-- | block/blk-map.c | 2 | ||||
-rw-r--r-- | block/blk-merge.c | 1 | ||||
-rw-r--r-- | block/bsg.c | 8 | ||||
-rw-r--r-- | block/scsi_ioctl.c | 3 | ||||
-rw-r--r-- | drivers/scsi/scsi_lib.c | 8 | ||||
-rw-r--r-- | include/linux/blkdev.h | 1 |
7 files changed, 16 insertions, 9 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index c013ca22eb67..775c8516abf5 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -127,6 +127,7 @@ void rq_init(struct request_queue *q, struct request *rq) | |||
127 | rq->nr_hw_segments = 0; | 127 | rq->nr_hw_segments = 0; |
128 | rq->ioprio = 0; | 128 | rq->ioprio = 0; |
129 | rq->special = NULL; | 129 | rq->special = NULL; |
130 | rq->raw_data_len = 0; | ||
130 | rq->buffer = NULL; | 131 | rq->buffer = NULL; |
131 | rq->tag = -1; | 132 | rq->tag = -1; |
132 | rq->errors = 0; | 133 | rq->errors = 0; |
@@ -2015,6 +2016,7 @@ void blk_rq_bio_prep(struct request_queue *q, struct request *rq, | |||
2015 | rq->hard_cur_sectors = rq->current_nr_sectors; | 2016 | rq->hard_cur_sectors = rq->current_nr_sectors; |
2016 | rq->hard_nr_sectors = rq->nr_sectors = bio_sectors(bio); | 2017 | rq->hard_nr_sectors = rq->nr_sectors = bio_sectors(bio); |
2017 | rq->buffer = bio_data(bio); | 2018 | rq->buffer = bio_data(bio); |
2019 | rq->raw_data_len = bio->bi_size; | ||
2018 | rq->data_len = bio->bi_size; | 2020 | rq->data_len = bio->bi_size; |
2019 | 2021 | ||
2020 | rq->bio = rq->biotail = bio; | 2022 | rq->bio = rq->biotail = bio; |
diff --git a/block/blk-map.c b/block/blk-map.c index a7cf63ccb5cf..09f7fd0bcb73 100644 --- a/block/blk-map.c +++ b/block/blk-map.c | |||
@@ -19,6 +19,7 @@ int blk_rq_append_bio(struct request_queue *q, struct request *rq, | |||
19 | rq->biotail->bi_next = bio; | 19 | rq->biotail->bi_next = bio; |
20 | rq->biotail = bio; | 20 | rq->biotail = bio; |
21 | 21 | ||
22 | rq->raw_data_len += bio->bi_size; | ||
22 | rq->data_len += bio->bi_size; | 23 | rq->data_len += bio->bi_size; |
23 | } | 24 | } |
24 | return 0; | 25 | return 0; |
@@ -154,6 +155,7 @@ int blk_rq_map_user(struct request_queue *q, struct request *rq, | |||
154 | 155 | ||
155 | bio->bi_io_vec[bio->bi_vcnt - 1].bv_len += pad_len; | 156 | bio->bi_io_vec[bio->bi_vcnt - 1].bv_len += pad_len; |
156 | bio->bi_size += pad_len; | 157 | bio->bi_size += pad_len; |
158 | rq->data_len += pad_len; | ||
157 | } | 159 | } |
158 | 160 | ||
159 | rq->buffer = rq->data = NULL; | 161 | rq->buffer = rq->data = NULL; |
diff --git a/block/blk-merge.c b/block/blk-merge.c index d3b84bbb776a..39f2e077a014 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
@@ -228,6 +228,7 @@ new_segment: | |||
228 | ((unsigned long)q->dma_drain_buffer) & | 228 | ((unsigned long)q->dma_drain_buffer) & |
229 | (PAGE_SIZE - 1)); | 229 | (PAGE_SIZE - 1)); |
230 | nsegs++; | 230 | nsegs++; |
231 | rq->data_len += q->dma_drain_size; | ||
231 | } | 232 | } |
232 | 233 | ||
233 | if (sg) | 234 | if (sg) |
diff --git a/block/bsg.c b/block/bsg.c index 8917c5174dc2..7f3c09549e4b 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
@@ -437,14 +437,14 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr, | |||
437 | } | 437 | } |
438 | 438 | ||
439 | if (rq->next_rq) { | 439 | if (rq->next_rq) { |
440 | hdr->dout_resid = rq->data_len; | 440 | hdr->dout_resid = rq->raw_data_len; |
441 | hdr->din_resid = rq->next_rq->data_len; | 441 | hdr->din_resid = rq->next_rq->raw_data_len; |
442 | blk_rq_unmap_user(bidi_bio); | 442 | blk_rq_unmap_user(bidi_bio); |
443 | blk_put_request(rq->next_rq); | 443 | blk_put_request(rq->next_rq); |
444 | } else if (rq_data_dir(rq) == READ) | 444 | } else if (rq_data_dir(rq) == READ) |
445 | hdr->din_resid = rq->data_len; | 445 | hdr->din_resid = rq->raw_data_len; |
446 | else | 446 | else |
447 | hdr->dout_resid = rq->data_len; | 447 | hdr->dout_resid = rq->raw_data_len; |
448 | 448 | ||
449 | /* | 449 | /* |
450 | * If the request generated a negative error number, return it | 450 | * If the request generated a negative error number, return it |
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 9675b34638d4..e993cac4911d 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -266,7 +266,7 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr, | |||
266 | hdr->info = 0; | 266 | hdr->info = 0; |
267 | if (hdr->masked_status || hdr->host_status || hdr->driver_status) | 267 | if (hdr->masked_status || hdr->host_status || hdr->driver_status) |
268 | hdr->info |= SG_INFO_CHECK; | 268 | hdr->info |= SG_INFO_CHECK; |
269 | hdr->resid = rq->data_len; | 269 | hdr->resid = rq->raw_data_len; |
270 | hdr->sb_len_wr = 0; | 270 | hdr->sb_len_wr = 0; |
271 | 271 | ||
272 | if (rq->sense_len && hdr->sbp) { | 272 | if (rq->sense_len && hdr->sbp) { |
@@ -528,6 +528,7 @@ static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk, | |||
528 | rq = blk_get_request(q, WRITE, __GFP_WAIT); | 528 | rq = blk_get_request(q, WRITE, __GFP_WAIT); |
529 | rq->cmd_type = REQ_TYPE_BLOCK_PC; | 529 | rq->cmd_type = REQ_TYPE_BLOCK_PC; |
530 | rq->data = NULL; | 530 | rq->data = NULL; |
531 | rq->raw_data_len = 0; | ||
531 | rq->data_len = 0; | 532 | rq->data_len = 0; |
532 | rq->timeout = BLK_DEFAULT_SG_TIMEOUT; | 533 | rq->timeout = BLK_DEFAULT_SG_TIMEOUT; |
533 | memset(rq->cmd, 0, sizeof(rq->cmd)); | 534 | memset(rq->cmd, 0, sizeof(rq->cmd)); |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 135c1d054701..ba21d97d1855 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1014,10 +1014,6 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb, | |||
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | req->buffer = NULL; | 1016 | req->buffer = NULL; |
1017 | if (blk_pc_request(req)) | ||
1018 | sdb->length = req->data_len; | ||
1019 | else | ||
1020 | sdb->length = req->nr_sectors << 9; | ||
1021 | 1017 | ||
1022 | /* | 1018 | /* |
1023 | * Next, walk the list, and fill in the addresses and sizes of | 1019 | * Next, walk the list, and fill in the addresses and sizes of |
@@ -1026,6 +1022,10 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb, | |||
1026 | count = blk_rq_map_sg(req->q, req, sdb->table.sgl); | 1022 | count = blk_rq_map_sg(req->q, req, sdb->table.sgl); |
1027 | BUG_ON(count > sdb->table.nents); | 1023 | BUG_ON(count > sdb->table.nents); |
1028 | sdb->table.nents = count; | 1024 | sdb->table.nents = count; |
1025 | if (blk_pc_request(req)) | ||
1026 | sdb->length = req->data_len; | ||
1027 | else | ||
1028 | sdb->length = req->nr_sectors << 9; | ||
1029 | return BLKPREP_OK; | 1029 | return BLKPREP_OK; |
1030 | } | 1030 | } |
1031 | 1031 | ||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index e1888cc5b8ae..f1fe9fbf1c0e 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -216,6 +216,7 @@ struct request { | |||
216 | unsigned int cmd_len; | 216 | unsigned int cmd_len; |
217 | unsigned char cmd[BLK_MAX_CDB]; | 217 | unsigned char cmd[BLK_MAX_CDB]; |
218 | 218 | ||
219 | unsigned int raw_data_len; | ||
219 | unsigned int data_len; | 220 | unsigned int data_len; |
220 | unsigned int sense_len; | 221 | unsigned int sense_len; |
221 | void *data; | 222 | void *data; |