summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-04-10 09:46:28 -0600
committerJens Axboe <axboe@fb.com>2014-04-15 14:03:02 -0600
commitb4f42e2831ff9b9fa19252265d7c8985d47eefb9 (patch)
tree6b4e9790eac3b9ca4b37eb140d7027f034411c8a /drivers/scsi/sd.c
parentf89e0dd9d1a72fdf6b8958bcadfa6abf84f3cae0 (diff)
downloadlinux-b4f42e2831ff9b9fa19252265d7c8985d47eefb9.tar.gz
linux-b4f42e2831ff9b9fa19252265d7c8985d47eefb9.tar.bz2
linux-b4f42e2831ff9b9fa19252265d7c8985d47eefb9.zip
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/sd.c')
-rw-r--r--drivers/scsi/sd.c10
1 files changed, 4 insertions, 6 deletions
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)
blk_add_request_payload(rq, page, len);
ret = scsi_setup_blk_pc_cmnd(sdp, rq);
- rq->buffer = page_address(page);
rq->__data_len = nr_bytes;
out:
- if (ret != BLKPREP_OK) {
+ if (ret != BLKPREP_OK)
__free_page(page);
- rq->buffer = NULL;
- }
return ret;
}
@@ -843,8 +840,9 @@ static void sd_unprep_fn(struct request_queue *q, struct request *rq)
struct scsi_cmnd *SCpnt = rq->special;
if (rq->cmd_flags & REQ_DISCARD) {
- free_page((unsigned long)rq->buffer);
- rq->buffer = NULL;
+ struct bio *bio = rq->bio;
+
+ __free_page(bio->bi_io_vec->bv_page);
}
if (SCpnt->cmnd != rq->cmd) {
mempool_free(SCpnt->cmnd, sd_cdb_pool);