aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-04-10 11:46:28 -0400
committerJens Axboe <axboe@fb.com>2014-04-15 16:03:02 -0400
commitb4f42e2831ff9b9fa19252265d7c8985d47eefb9 (patch)
tree6b4e9790eac3b9ca4b37eb140d7027f034411c8a /drivers/scsi
parentf89e0dd9d1a72fdf6b8958bcadfa6abf84f3cae0 (diff)
block: remove struct request buffer member
This was used in the olden days, back when onions were proper yellow. Basically it mapped to the current buffer to be transferred. With highmem being added more than a decade ago, most drivers map pages out of a bio, and rq->buffer isn't pointing at anything valid. Convert old style drivers to just use bio_data(). For the discard payload use case, just reference the page in the bio. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/scsi_lib.c3
-rw-r--r--drivers/scsi/sd.c10
2 files changed, 4 insertions, 9 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 0f3bddcb6b1a..3cc82d3dec78 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1018,8 +1018,6 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb,
1018 return BLKPREP_DEFER; 1018 return BLKPREP_DEFER;
1019 } 1019 }
1020 1020
1021 req->buffer = NULL;
1022
1023 /* 1021 /*
1024 * Next, walk the list, and fill in the addresses and sizes of 1022 * Next, walk the list, and fill in the addresses and sizes of
1025 * each segment. 1023 * each segment.
@@ -1156,7 +1154,6 @@ int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req)
1156 BUG_ON(blk_rq_bytes(req)); 1154 BUG_ON(blk_rq_bytes(req));
1157 1155
1158 memset(&cmd->sdb, 0, sizeof(cmd->sdb)); 1156 memset(&cmd->sdb, 0, sizeof(cmd->sdb));
1159 req->buffer = NULL;
1160 } 1157 }
1161 1158
1162 cmd->cmd_len = req->cmd_len; 1159 cmd->cmd_len = req->cmd_len;
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index efcbcd182863..06d154d20faa 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -739,14 +739,11 @@ static int sd_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq)
739 739
740 blk_add_request_payload(rq, page, len); 740 blk_add_request_payload(rq, page, len);
741 ret = scsi_setup_blk_pc_cmnd(sdp, rq); 741 ret = scsi_setup_blk_pc_cmnd(sdp, rq);
742 rq->buffer = page_address(page);
743 rq->__data_len = nr_bytes; 742 rq->__data_len = nr_bytes;
744 743
745out: 744out:
746 if (ret != BLKPREP_OK) { 745 if (ret != BLKPREP_OK)
747 __free_page(page); 746 __free_page(page);
748 rq->buffer = NULL;
749 }
750 return ret; 747 return ret;
751} 748}
752 749
@@ -843,8 +840,9 @@ static void sd_unprep_fn(struct request_queue *q, struct request *rq)
843 struct scsi_cmnd *SCpnt = rq->special; 840 struct scsi_cmnd *SCpnt = rq->special;
844 841
845 if (rq->cmd_flags & REQ_DISCARD) { 842 if (rq->cmd_flags & REQ_DISCARD) {
846 free_page((unsigned long)rq->buffer); 843 struct bio *bio = rq->bio;
847 rq->buffer = NULL; 844
845 __free_page(bio->bi_io_vec->bv_page);
848 } 846 }
849 if (SCpnt->cmnd != rq->cmd) { 847 if (SCpnt->cmnd != rq->cmd) {
850 mempool_free(SCpnt->cmnd, sd_cdb_pool); 848 mempool_free(SCpnt->cmnd, sd_cdb_pool);