diff options
author | Christoph Hellwig <hch@lst.de> | 2017-01-31 10:57:31 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-01-31 16:00:44 -0500 |
commit | aebf526b53aea164508730427597d45f3e06b376 (patch) | |
tree | 98ab726d0f7feb610feee9830246c900c6919eea /drivers/cdrom | |
parent | 2f5a8e80f79dc82e00f4cca557dc9ceaf064b450 (diff) |
block: fold cmd_type into the REQ_OP_ space
Instead of keeping two levels of indirection for requests types, fold it
all into the operations. The little caveat here is that previously
cmd_type only applied to struct request, while the request and bio op
fields were set to plain REQ_OP_READ/WRITE even for passthrough
operations.
Instead this patch adds new REQ_OP_* for SCSI passthrough and driver
private requests, althought it has to add two for each so that we
can communicate the data in/out nature of the request.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/cdrom')
-rw-r--r-- | drivers/cdrom/cdrom.c | 2 | ||||
-rw-r--r-- | drivers/cdrom/gdrom.c | 29 |
2 files changed, 16 insertions, 15 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 36f5237a8a69..8f496b4f3dd1 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
@@ -2191,7 +2191,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2191 | 2191 | ||
2192 | len = nr * CD_FRAMESIZE_RAW; | 2192 | len = nr * CD_FRAMESIZE_RAW; |
2193 | 2193 | ||
2194 | rq = blk_get_request(q, READ, GFP_KERNEL); | 2194 | rq = blk_get_request(q, REQ_OP_SCSI_IN, GFP_KERNEL); |
2195 | if (IS_ERR(rq)) { | 2195 | if (IS_ERR(rq)) { |
2196 | ret = PTR_ERR(rq); | 2196 | ret = PTR_ERR(rq); |
2197 | break; | 2197 | break; |
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index 584bc3126403..b6f1a5d95bc5 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 | ||