diff options
author | Christoph Hellwig <hch@lst.de> | 2017-01-27 03:46:29 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-01-27 17:08:35 -0500 |
commit | 82ed4db499b8598f16f8871261bff088d6b0597f (patch) | |
tree | e1cc0a433bf5ae2b9723837291617bdfeeb61816 /drivers/cdrom/cdrom.c | |
parent | 8ae94eb65be9425af4d57a4f4cfebfdf03081e93 (diff) |
block: split scsi_request out of struct request
And require all drivers that want to support BLOCK_PC to allocate it
as the first thing of their private data. To support this the legacy
IDE and BSG code is switched to set cmd_size on their queues to let
the block layer allocate the additional space.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/cdrom/cdrom.c')
-rw-r--r-- | drivers/cdrom/cdrom.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 59cca72647a6..36f5237a8a69 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
@@ -281,8 +281,8 @@ | |||
281 | #include <linux/fcntl.h> | 281 | #include <linux/fcntl.h> |
282 | #include <linux/blkdev.h> | 282 | #include <linux/blkdev.h> |
283 | #include <linux/times.h> | 283 | #include <linux/times.h> |
284 | |||
285 | #include <linux/uaccess.h> | 284 | #include <linux/uaccess.h> |
285 | #include <scsi/scsi_request.h> | ||
286 | 286 | ||
287 | /* used to tell the module to turn on full debugging messages */ | 287 | /* used to tell the module to turn on full debugging messages */ |
288 | static bool debug; | 288 | static bool debug; |
@@ -2172,6 +2172,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2172 | { | 2172 | { |
2173 | struct request_queue *q = cdi->disk->queue; | 2173 | struct request_queue *q = cdi->disk->queue; |
2174 | struct request *rq; | 2174 | struct request *rq; |
2175 | struct scsi_request *req; | ||
2175 | struct bio *bio; | 2176 | struct bio *bio; |
2176 | unsigned int len; | 2177 | unsigned int len; |
2177 | int nr, ret = 0; | 2178 | int nr, ret = 0; |
@@ -2195,7 +2196,8 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2195 | ret = PTR_ERR(rq); | 2196 | ret = PTR_ERR(rq); |
2196 | break; | 2197 | break; |
2197 | } | 2198 | } |
2198 | blk_rq_set_block_pc(rq); | 2199 | req = scsi_req(rq); |
2200 | scsi_req_init(rq); | ||
2199 | 2201 | ||
2200 | ret = blk_rq_map_user(q, rq, NULL, ubuf, len, GFP_KERNEL); | 2202 | ret = blk_rq_map_user(q, rq, NULL, ubuf, len, GFP_KERNEL); |
2201 | if (ret) { | 2203 | if (ret) { |
@@ -2203,23 +2205,23 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2203 | break; | 2205 | break; |
2204 | } | 2206 | } |
2205 | 2207 | ||
2206 | rq->cmd[0] = GPCMD_READ_CD; | 2208 | req->cmd[0] = GPCMD_READ_CD; |
2207 | rq->cmd[1] = 1 << 2; | 2209 | req->cmd[1] = 1 << 2; |
2208 | rq->cmd[2] = (lba >> 24) & 0xff; | 2210 | req->cmd[2] = (lba >> 24) & 0xff; |
2209 | rq->cmd[3] = (lba >> 16) & 0xff; | 2211 | req->cmd[3] = (lba >> 16) & 0xff; |
2210 | rq->cmd[4] = (lba >> 8) & 0xff; | 2212 | req->cmd[4] = (lba >> 8) & 0xff; |
2211 | rq->cmd[5] = lba & 0xff; | 2213 | req->cmd[5] = lba & 0xff; |
2212 | rq->cmd[6] = (nr >> 16) & 0xff; | 2214 | req->cmd[6] = (nr >> 16) & 0xff; |
2213 | rq->cmd[7] = (nr >> 8) & 0xff; | 2215 | req->cmd[7] = (nr >> 8) & 0xff; |
2214 | rq->cmd[8] = nr & 0xff; | 2216 | req->cmd[8] = nr & 0xff; |
2215 | rq->cmd[9] = 0xf8; | 2217 | req->cmd[9] = 0xf8; |
2216 | 2218 | ||
2217 | rq->cmd_len = 12; | 2219 | req->cmd_len = 12; |
2218 | rq->timeout = 60 * HZ; | 2220 | rq->timeout = 60 * HZ; |
2219 | bio = rq->bio; | 2221 | bio = rq->bio; |
2220 | 2222 | ||
2221 | if (blk_execute_rq(q, cdi->disk, rq, 0)) { | 2223 | if (blk_execute_rq(q, cdi->disk, rq, 0)) { |
2222 | struct request_sense *s = rq->sense; | 2224 | struct request_sense *s = req->sense; |
2223 | ret = -EIO; | 2225 | ret = -EIO; |
2224 | cdi->last_sense = s->sense_key; | 2226 | cdi->last_sense = s->sense_key; |
2225 | } | 2227 | } |