diff options
author | Jens Axboe <axboe@fb.com> | 2017-02-17 16:08:19 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-02-17 16:08:19 -0500 |
commit | 818551e2b2c662a1b26de6b4f7d6b8411a838d18 (patch) | |
tree | f38b4c951df4d33db81ae7b7765a56bce491c2a8 /drivers/cdrom | |
parent | 6010720da8aab51f33beee63b73cf88016e9b250 (diff) | |
parent | 7520872c0cf4d3df6d74242c6edfb9e70a47df4d (diff) |
Merge branch 'for-4.11/next' into for-4.11/linus-merge
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/cdrom')
-rw-r--r-- | drivers/cdrom/cdrom.c | 34 | ||||
-rw-r--r-- | drivers/cdrom/gdrom.c | 29 |
2 files changed, 33 insertions, 30 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index bbbd3caa927c..87739649eac2 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; |
@@ -2170,6 +2170,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2170 | { | 2170 | { |
2171 | struct request_queue *q = cdi->disk->queue; | 2171 | struct request_queue *q = cdi->disk->queue; |
2172 | struct request *rq; | 2172 | struct request *rq; |
2173 | struct scsi_request *req; | ||
2173 | struct bio *bio; | 2174 | struct bio *bio; |
2174 | unsigned int len; | 2175 | unsigned int len; |
2175 | int nr, ret = 0; | 2176 | int nr, ret = 0; |
@@ -2188,12 +2189,13 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2188 | 2189 | ||
2189 | len = nr * CD_FRAMESIZE_RAW; | 2190 | len = nr * CD_FRAMESIZE_RAW; |
2190 | 2191 | ||
2191 | rq = blk_get_request(q, READ, GFP_KERNEL); | 2192 | rq = blk_get_request(q, REQ_OP_SCSI_IN, GFP_KERNEL); |
2192 | if (IS_ERR(rq)) { | 2193 | if (IS_ERR(rq)) { |
2193 | ret = PTR_ERR(rq); | 2194 | ret = PTR_ERR(rq); |
2194 | break; | 2195 | break; |
2195 | } | 2196 | } |
2196 | blk_rq_set_block_pc(rq); | 2197 | req = scsi_req(rq); |
2198 | scsi_req_init(rq); | ||
2197 | 2199 | ||
2198 | ret = blk_rq_map_user(q, rq, NULL, ubuf, len, GFP_KERNEL); | 2200 | ret = blk_rq_map_user(q, rq, NULL, ubuf, len, GFP_KERNEL); |
2199 | if (ret) { | 2201 | if (ret) { |
@@ -2201,23 +2203,23 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2201 | break; | 2203 | break; |
2202 | } | 2204 | } |
2203 | 2205 | ||
2204 | rq->cmd[0] = GPCMD_READ_CD; | 2206 | req->cmd[0] = GPCMD_READ_CD; |
2205 | rq->cmd[1] = 1 << 2; | 2207 | req->cmd[1] = 1 << 2; |
2206 | rq->cmd[2] = (lba >> 24) & 0xff; | 2208 | req->cmd[2] = (lba >> 24) & 0xff; |
2207 | rq->cmd[3] = (lba >> 16) & 0xff; | 2209 | req->cmd[3] = (lba >> 16) & 0xff; |
2208 | rq->cmd[4] = (lba >> 8) & 0xff; | 2210 | req->cmd[4] = (lba >> 8) & 0xff; |
2209 | rq->cmd[5] = lba & 0xff; | 2211 | req->cmd[5] = lba & 0xff; |
2210 | rq->cmd[6] = (nr >> 16) & 0xff; | 2212 | req->cmd[6] = (nr >> 16) & 0xff; |
2211 | rq->cmd[7] = (nr >> 8) & 0xff; | 2213 | req->cmd[7] = (nr >> 8) & 0xff; |
2212 | rq->cmd[8] = nr & 0xff; | 2214 | req->cmd[8] = nr & 0xff; |
2213 | rq->cmd[9] = 0xf8; | 2215 | req->cmd[9] = 0xf8; |
2214 | 2216 | ||
2215 | rq->cmd_len = 12; | 2217 | req->cmd_len = 12; |
2216 | rq->timeout = 60 * HZ; | 2218 | rq->timeout = 60 * HZ; |
2217 | bio = rq->bio; | 2219 | bio = rq->bio; |
2218 | 2220 | ||
2219 | if (blk_execute_rq(q, cdi->disk, rq, 0)) { | 2221 | if (blk_execute_rq(q, cdi->disk, rq, 0)) { |
2220 | struct request_sense *s = rq->sense; | 2222 | struct request_sense *s = req->sense; |
2221 | ret = -EIO; | 2223 | ret = -EIO; |
2222 | cdi->last_sense = s->sense_key; | 2224 | cdi->last_sense = s->sense_key; |
2223 | } | 2225 | } |
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index 1afab6558d0c..1372763a948f 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c | |||
@@ -659,23 +659,24 @@ static void gdrom_request(struct request_queue *rq) | |||
659 | struct request *req; | 659 | struct request *req; |
660 | 660 | ||
661 | while ((req = blk_fetch_request(rq)) != NULL) { | 661 | while ((req = blk_fetch_request(rq)) != NULL) { |
662 | if (req->cmd_type != REQ_TYPE_FS) { | 662 | switch (req_op(req)) { |
663 | printk(KERN_DEBUG "gdrom: Non-fs request ignored\n"); | 663 | case REQ_OP_READ: |
664 | __blk_end_request_all(req, -EIO); | 664 | /* |
665 | continue; | 665 | * Add to list of deferred work and then schedule |
666 | } | 666 | * workqueue. |
667 | if (rq_data_dir(req) != READ) { | 667 | */ |
668 | list_add_tail(&req->queuelist, &gdrom_deferred); | ||
669 | schedule_work(&work); | ||
670 | break; | ||
671 | case REQ_OP_WRITE: | ||
668 | pr_notice("Read only device - write request ignored\n"); | 672 | pr_notice("Read only device - write request ignored\n"); |
669 | __blk_end_request_all(req, -EIO); | 673 | __blk_end_request_all(req, -EIO); |
670 | continue; | 674 | break; |
675 | default: | ||
676 | printk(KERN_DEBUG "gdrom: Non-fs request ignored\n"); | ||
677 | __blk_end_request_all(req, -EIO); | ||
678 | break; | ||
671 | } | 679 | } |
672 | |||
673 | /* | ||
674 | * Add to list of deferred work and then schedule | ||
675 | * workqueue. | ||
676 | */ | ||
677 | list_add_tail(&req->queuelist, &gdrom_deferred); | ||
678 | schedule_work(&work); | ||
679 | } | 680 | } |
680 | } | 681 | } |
681 | 682 | ||