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 | |
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')
42 files changed, 290 insertions, 269 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 53dc2971a3ba..f21c2f0c5ccd 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -3394,7 +3394,9 @@ static void do_cciss_request(struct request_queue *q) | |||
3394 | c->Header.SGList = h->max_cmd_sgentries; | 3394 | c->Header.SGList = h->max_cmd_sgentries; |
3395 | set_performant_mode(h, c); | 3395 | set_performant_mode(h, c); |
3396 | 3396 | ||
3397 | if (likely(creq->cmd_type == REQ_TYPE_FS)) { | 3397 | switch (req_op(creq)) { |
3398 | case REQ_OP_READ: | ||
3399 | case REQ_OP_WRITE: | ||
3398 | if(h->cciss_read == CCISS_READ_10) { | 3400 | if(h->cciss_read == CCISS_READ_10) { |
3399 | c->Request.CDB[1] = 0; | 3401 | c->Request.CDB[1] = 0; |
3400 | c->Request.CDB[2] = (start_blk >> 24) & 0xff; /* MSB */ | 3402 | c->Request.CDB[2] = (start_blk >> 24) & 0xff; /* MSB */ |
@@ -3424,13 +3426,16 @@ static void do_cciss_request(struct request_queue *q) | |||
3424 | c->Request.CDB[13]= blk_rq_sectors(creq) & 0xff; | 3426 | c->Request.CDB[13]= blk_rq_sectors(creq) & 0xff; |
3425 | c->Request.CDB[14] = c->Request.CDB[15] = 0; | 3427 | c->Request.CDB[14] = c->Request.CDB[15] = 0; |
3426 | } | 3428 | } |
3427 | } else if (creq->cmd_type == REQ_TYPE_BLOCK_PC) { | 3429 | break; |
3430 | case REQ_OP_SCSI_IN: | ||
3431 | case REQ_OP_SCSI_OUT: | ||
3428 | c->Request.CDBLen = scsi_req(creq)->cmd_len; | 3432 | c->Request.CDBLen = scsi_req(creq)->cmd_len; |
3429 | memcpy(c->Request.CDB, scsi_req(creq)->cmd, BLK_MAX_CDB); | 3433 | memcpy(c->Request.CDB, scsi_req(creq)->cmd, BLK_MAX_CDB); |
3430 | scsi_req(creq)->sense = c->err_info->SenseInfo; | 3434 | scsi_req(creq)->sense = c->err_info->SenseInfo; |
3431 | } else { | 3435 | break; |
3436 | default: | ||
3432 | dev_warn(&h->pdev->dev, "bad request type %d\n", | 3437 | dev_warn(&h->pdev->dev, "bad request type %d\n", |
3433 | creq->cmd_type); | 3438 | creq->cmd_flags); |
3434 | BUG(); | 3439 | BUG(); |
3435 | } | 3440 | } |
3436 | 3441 | ||
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 184887af4b9f..45b4384f650c 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -2900,8 +2900,8 @@ static void do_fd_request(struct request_queue *q) | |||
2900 | return; | 2900 | return; |
2901 | 2901 | ||
2902 | if (WARN(atomic_read(&usage_count) == 0, | 2902 | if (WARN(atomic_read(&usage_count) == 0, |
2903 | "warning: usage count=0, current_req=%p sect=%ld type=%x flags=%llx\n", | 2903 | "warning: usage count=0, current_req=%p sect=%ld flags=%llx\n", |
2904 | current_req, (long)blk_rq_pos(current_req), current_req->cmd_type, | 2904 | current_req, (long)blk_rq_pos(current_req), |
2905 | (unsigned long long) current_req->cmd_flags)) | 2905 | (unsigned long long) current_req->cmd_flags)) |
2906 | return; | 2906 | return; |
2907 | 2907 | ||
diff --git a/drivers/block/hd.c b/drivers/block/hd.c index a9b48ed7a3cd..6043648da1e8 100644 --- a/drivers/block/hd.c +++ b/drivers/block/hd.c | |||
@@ -626,30 +626,29 @@ repeat: | |||
626 | req_data_dir(req) == READ ? "read" : "writ", | 626 | req_data_dir(req) == READ ? "read" : "writ", |
627 | cyl, head, sec, nsect, bio_data(req->bio)); | 627 | cyl, head, sec, nsect, bio_data(req->bio)); |
628 | #endif | 628 | #endif |
629 | if (req->cmd_type == REQ_TYPE_FS) { | 629 | |
630 | switch (rq_data_dir(req)) { | 630 | switch (req_op(req)) { |
631 | case READ: | 631 | case REQ_OP_READ: |
632 | hd_out(disk, nsect, sec, head, cyl, ATA_CMD_PIO_READ, | 632 | hd_out(disk, nsect, sec, head, cyl, ATA_CMD_PIO_READ, |
633 | &read_intr); | 633 | &read_intr); |
634 | if (reset) | 634 | if (reset) |
635 | goto repeat; | 635 | goto repeat; |
636 | break; | 636 | break; |
637 | case WRITE: | 637 | case REQ_OP_WRITE: |
638 | hd_out(disk, nsect, sec, head, cyl, ATA_CMD_PIO_WRITE, | 638 | hd_out(disk, nsect, sec, head, cyl, ATA_CMD_PIO_WRITE, |
639 | &write_intr); | 639 | &write_intr); |
640 | if (reset) | 640 | if (reset) |
641 | goto repeat; | 641 | goto repeat; |
642 | if (wait_DRQ()) { | 642 | if (wait_DRQ()) { |
643 | bad_rw_intr(); | 643 | bad_rw_intr(); |
644 | goto repeat; | 644 | goto repeat; |
645 | } | ||
646 | outsw(HD_DATA, bio_data(req->bio), 256); | ||
647 | break; | ||
648 | default: | ||
649 | printk("unknown hd-command\n"); | ||
650 | hd_end_request_cur(-EIO); | ||
651 | break; | ||
652 | } | 645 | } |
646 | outsw(HD_DATA, bio_data(req->bio), 256); | ||
647 | break; | ||
648 | default: | ||
649 | printk("unknown hd-command\n"); | ||
650 | hd_end_request_cur(-EIO); | ||
651 | break; | ||
653 | } | 652 | } |
654 | } | 653 | } |
655 | 654 | ||
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c index e937fcf71769..286f276f586e 100644 --- a/drivers/block/mg_disk.c +++ b/drivers/block/mg_disk.c | |||
@@ -670,15 +670,17 @@ static void mg_request_poll(struct request_queue *q) | |||
670 | break; | 670 | break; |
671 | } | 671 | } |
672 | 672 | ||
673 | if (unlikely(host->req->cmd_type != REQ_TYPE_FS)) { | 673 | switch (req_op(host->req)) { |
674 | mg_end_request_cur(host, -EIO); | 674 | case REQ_OP_READ: |
675 | continue; | ||
676 | } | ||
677 | |||
678 | if (rq_data_dir(host->req) == READ) | ||
679 | mg_read(host->req); | 675 | mg_read(host->req); |
680 | else | 676 | break; |
677 | case REQ_OP_WRITE: | ||
681 | mg_write(host->req); | 678 | mg_write(host->req); |
679 | break; | ||
680 | default: | ||
681 | mg_end_request_cur(host, -EIO); | ||
682 | break; | ||
683 | } | ||
682 | } | 684 | } |
683 | } | 685 | } |
684 | 686 | ||
@@ -687,13 +689,15 @@ static unsigned int mg_issue_req(struct request *req, | |||
687 | unsigned int sect_num, | 689 | unsigned int sect_num, |
688 | unsigned int sect_cnt) | 690 | unsigned int sect_cnt) |
689 | { | 691 | { |
690 | if (rq_data_dir(req) == READ) { | 692 | switch (req_op(host->req)) { |
693 | case REQ_OP_READ: | ||
691 | if (mg_out(host, sect_num, sect_cnt, MG_CMD_RD, &mg_read_intr) | 694 | if (mg_out(host, sect_num, sect_cnt, MG_CMD_RD, &mg_read_intr) |
692 | != MG_ERR_NONE) { | 695 | != MG_ERR_NONE) { |
693 | mg_bad_rw_intr(host); | 696 | mg_bad_rw_intr(host); |
694 | return host->error; | 697 | return host->error; |
695 | } | 698 | } |
696 | } else { | 699 | break; |
700 | case REQ_OP_WRITE: | ||
697 | /* TODO : handler */ | 701 | /* TODO : handler */ |
698 | outb(ATA_NIEN, (unsigned long)host->dev_base + MG_REG_DRV_CTRL); | 702 | outb(ATA_NIEN, (unsigned long)host->dev_base + MG_REG_DRV_CTRL); |
699 | if (mg_out(host, sect_num, sect_cnt, MG_CMD_WR, &mg_write_intr) | 703 | if (mg_out(host, sect_num, sect_cnt, MG_CMD_WR, &mg_write_intr) |
@@ -712,6 +716,10 @@ static unsigned int mg_issue_req(struct request *req, | |||
712 | mod_timer(&host->timer, jiffies + 3 * HZ); | 716 | mod_timer(&host->timer, jiffies + 3 * HZ); |
713 | outb(MG_CMD_WR_CONF, (unsigned long)host->dev_base + | 717 | outb(MG_CMD_WR_CONF, (unsigned long)host->dev_base + |
714 | MG_REG_COMMAND); | 718 | MG_REG_COMMAND); |
719 | break; | ||
720 | default: | ||
721 | mg_end_request_cur(host, -EIO); | ||
722 | break; | ||
715 | } | 723 | } |
716 | return MG_ERR_NONE; | 724 | return MG_ERR_NONE; |
717 | } | 725 | } |
@@ -753,11 +761,6 @@ static void mg_request(struct request_queue *q) | |||
753 | continue; | 761 | continue; |
754 | } | 762 | } |
755 | 763 | ||
756 | if (unlikely(req->cmd_type != REQ_TYPE_FS)) { | ||
757 | mg_end_request_cur(host, -EIO); | ||
758 | continue; | ||
759 | } | ||
760 | |||
761 | if (!mg_issue_req(req, host, sect_num, sect_cnt)) | 764 | if (!mg_issue_req(req, host, sect_num, sect_cnt)) |
762 | return; | 765 | return; |
763 | } | 766 | } |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 8bce1c7c18d5..58296e4427b0 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -271,17 +271,22 @@ static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index) | |||
271 | u32 type; | 271 | u32 type; |
272 | u32 tag = blk_mq_unique_tag(req); | 272 | u32 tag = blk_mq_unique_tag(req); |
273 | 273 | ||
274 | if (req->cmd_type != REQ_TYPE_FS) | 274 | switch (req_op(req)) { |
275 | return -EIO; | 275 | case REQ_OP_DISCARD: |
276 | |||
277 | if (req_op(req) == REQ_OP_DISCARD) | ||
278 | type = NBD_CMD_TRIM; | 276 | type = NBD_CMD_TRIM; |
279 | else if (req_op(req) == REQ_OP_FLUSH) | 277 | break; |
278 | case REQ_OP_FLUSH: | ||
280 | type = NBD_CMD_FLUSH; | 279 | type = NBD_CMD_FLUSH; |
281 | else if (rq_data_dir(req) == WRITE) | 280 | break; |
281 | case REQ_OP_WRITE: | ||
282 | type = NBD_CMD_WRITE; | 282 | type = NBD_CMD_WRITE; |
283 | else | 283 | break; |
284 | case REQ_OP_READ: | ||
284 | type = NBD_CMD_READ; | 285 | type = NBD_CMD_READ; |
286 | break; | ||
287 | default: | ||
288 | return -EIO; | ||
289 | } | ||
285 | 290 | ||
286 | if (rq_data_dir(req) == WRITE && | 291 | if (rq_data_dir(req) == WRITE && |
287 | (nbd->flags & NBD_FLAG_READ_ONLY)) { | 292 | (nbd->flags & NBD_FLAG_READ_ONLY)) { |
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index c0e14e54909b..4335b84a565b 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c | |||
@@ -431,11 +431,11 @@ static int null_lnvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd) | |||
431 | struct request *rq; | 431 | struct request *rq; |
432 | struct bio *bio = rqd->bio; | 432 | struct bio *bio = rqd->bio; |
433 | 433 | ||
434 | rq = blk_mq_alloc_request(q, bio_data_dir(bio), 0); | 434 | rq = blk_mq_alloc_request(q, |
435 | op_is_write(bio_op(bio)) ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN, 0); | ||
435 | if (IS_ERR(rq)) | 436 | if (IS_ERR(rq)) |
436 | return -ENOMEM; | 437 | return -ENOMEM; |
437 | 438 | ||
438 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
439 | rq->__sector = bio->bi_iter.bi_sector; | 439 | rq->__sector = bio->bi_iter.bi_sector; |
440 | rq->ioprio = bio_prio(bio); | 440 | rq->ioprio = bio_prio(bio); |
441 | 441 | ||
diff --git a/drivers/block/osdblk.c b/drivers/block/osdblk.c index 92900f5f0b47..8127b8201a01 100644 --- a/drivers/block/osdblk.c +++ b/drivers/block/osdblk.c | |||
@@ -308,12 +308,6 @@ static void osdblk_rq_fn(struct request_queue *q) | |||
308 | if (!rq) | 308 | if (!rq) |
309 | break; | 309 | break; |
310 | 310 | ||
311 | /* filter out block requests we don't understand */ | ||
312 | if (rq->cmd_type != REQ_TYPE_FS) { | ||
313 | blk_end_request_all(rq, 0); | ||
314 | continue; | ||
315 | } | ||
316 | |||
317 | /* deduce our operation (read, write, flush) */ | 311 | /* deduce our operation (read, write, flush) */ |
318 | /* I wish the block layer simplified cmd_type/cmd_flags/cmd[] | 312 | /* I wish the block layer simplified cmd_type/cmd_flags/cmd[] |
319 | * into a clearly defined set of RPC commands: | 313 | * into a clearly defined set of RPC commands: |
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index c3ed2fc72daa..644ba0888bd4 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c | |||
@@ -439,18 +439,16 @@ static int pd_retries = 0; /* i/o error retry count */ | |||
439 | static int pd_block; /* address of next requested block */ | 439 | static int pd_block; /* address of next requested block */ |
440 | static int pd_count; /* number of blocks still to do */ | 440 | static int pd_count; /* number of blocks still to do */ |
441 | static int pd_run; /* sectors in current cluster */ | 441 | static int pd_run; /* sectors in current cluster */ |
442 | static int pd_cmd; /* current command READ/WRITE */ | ||
443 | static char *pd_buf; /* buffer for request in progress */ | 442 | static char *pd_buf; /* buffer for request in progress */ |
444 | 443 | ||
445 | static enum action do_pd_io_start(void) | 444 | static enum action do_pd_io_start(void) |
446 | { | 445 | { |
447 | if (pd_req->cmd_type == REQ_TYPE_DRV_PRIV) { | 446 | switch (req_op(pd_req)) { |
447 | case REQ_OP_DRV_IN: | ||
448 | phase = pd_special; | 448 | phase = pd_special; |
449 | return pd_special(); | 449 | return pd_special(); |
450 | } | 450 | case REQ_OP_READ: |
451 | 451 | case REQ_OP_WRITE: | |
452 | pd_cmd = rq_data_dir(pd_req); | ||
453 | if (pd_cmd == READ || pd_cmd == WRITE) { | ||
454 | pd_block = blk_rq_pos(pd_req); | 452 | pd_block = blk_rq_pos(pd_req); |
455 | pd_count = blk_rq_cur_sectors(pd_req); | 453 | pd_count = blk_rq_cur_sectors(pd_req); |
456 | if (pd_block + pd_count > get_capacity(pd_req->rq_disk)) | 454 | if (pd_block + pd_count > get_capacity(pd_req->rq_disk)) |
@@ -458,7 +456,7 @@ static enum action do_pd_io_start(void) | |||
458 | pd_run = blk_rq_sectors(pd_req); | 456 | pd_run = blk_rq_sectors(pd_req); |
459 | pd_buf = bio_data(pd_req->bio); | 457 | pd_buf = bio_data(pd_req->bio); |
460 | pd_retries = 0; | 458 | pd_retries = 0; |
461 | if (pd_cmd == READ) | 459 | if (req_op(pd_req) == REQ_OP_READ) |
462 | return do_pd_read_start(); | 460 | return do_pd_read_start(); |
463 | else | 461 | else |
464 | return do_pd_write_start(); | 462 | return do_pd_write_start(); |
@@ -723,11 +721,10 @@ static int pd_special_command(struct pd_unit *disk, | |||
723 | struct request *rq; | 721 | struct request *rq; |
724 | int err = 0; | 722 | int err = 0; |
725 | 723 | ||
726 | rq = blk_get_request(disk->gd->queue, READ, __GFP_RECLAIM); | 724 | rq = blk_get_request(disk->gd->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
727 | if (IS_ERR(rq)) | 725 | if (IS_ERR(rq)) |
728 | return PTR_ERR(rq); | 726 | return PTR_ERR(rq); |
729 | 727 | ||
730 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
731 | rq->special = func; | 728 | rq->special = func; |
732 | 729 | ||
733 | err = blk_execute_rq(disk->gd->queue, disk->gd, rq, 0); | 730 | err = blk_execute_rq(disk->gd->queue, disk->gd, rq, 0); |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 918a92ccd0c0..f4bd95943dc2 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -704,7 +704,7 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command * | |||
704 | int ret = 0; | 704 | int ret = 0; |
705 | 705 | ||
706 | rq = blk_get_request(q, (cgc->data_direction == CGC_DATA_WRITE) ? | 706 | rq = blk_get_request(q, (cgc->data_direction == CGC_DATA_WRITE) ? |
707 | WRITE : READ, __GFP_RECLAIM); | 707 | REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, __GFP_RECLAIM); |
708 | if (IS_ERR(rq)) | 708 | if (IS_ERR(rq)) |
709 | return PTR_ERR(rq); | 709 | return PTR_ERR(rq); |
710 | scsi_req_init(rq); | 710 | scsi_req_init(rq); |
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c index 76f33c84ce3d..a809e3e9feb8 100644 --- a/drivers/block/ps3disk.c +++ b/drivers/block/ps3disk.c | |||
@@ -196,16 +196,19 @@ static void ps3disk_do_request(struct ps3_storage_device *dev, | |||
196 | dev_dbg(&dev->sbd.core, "%s:%u\n", __func__, __LINE__); | 196 | dev_dbg(&dev->sbd.core, "%s:%u\n", __func__, __LINE__); |
197 | 197 | ||
198 | while ((req = blk_fetch_request(q))) { | 198 | while ((req = blk_fetch_request(q))) { |
199 | if (req_op(req) == REQ_OP_FLUSH) { | 199 | switch (req_op(req)) { |
200 | case REQ_OP_FLUSH: | ||
200 | if (ps3disk_submit_flush_request(dev, req)) | 201 | if (ps3disk_submit_flush_request(dev, req)) |
201 | break; | 202 | return; |
202 | } else if (req->cmd_type == REQ_TYPE_FS) { | 203 | break; |
204 | case REQ_OP_READ: | ||
205 | case REQ_OP_WRITE: | ||
203 | if (ps3disk_submit_request_sg(dev, req)) | 206 | if (ps3disk_submit_request_sg(dev, req)) |
204 | break; | 207 | return; |
205 | } else { | 208 | break; |
209 | default: | ||
206 | blk_dump_rq_flags(req, DEVICE_NAME " bad request"); | 210 | blk_dump_rq_flags(req, DEVICE_NAME " bad request"); |
207 | __blk_end_request_all(req, -EIO); | 211 | __blk_end_request_all(req, -EIO); |
208 | continue; | ||
209 | } | 212 | } |
210 | } | 213 | } |
211 | } | 214 | } |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 36d2b9f4e836..4d78cf605b21 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -4099,19 +4099,21 @@ static void rbd_queue_workfn(struct work_struct *work) | |||
4099 | bool must_be_locked; | 4099 | bool must_be_locked; |
4100 | int result; | 4100 | int result; |
4101 | 4101 | ||
4102 | if (rq->cmd_type != REQ_TYPE_FS) { | 4102 | switch (req_op(rq)) { |
4103 | dout("%s: non-fs request type %d\n", __func__, | 4103 | case REQ_OP_DISCARD: |
4104 | (int) rq->cmd_type); | ||
4105 | result = -EIO; | ||
4106 | goto err; | ||
4107 | } | ||
4108 | |||
4109 | if (req_op(rq) == REQ_OP_DISCARD) | ||
4110 | op_type = OBJ_OP_DISCARD; | 4104 | op_type = OBJ_OP_DISCARD; |
4111 | else if (req_op(rq) == REQ_OP_WRITE) | 4105 | break; |
4106 | case REQ_OP_WRITE: | ||
4112 | op_type = OBJ_OP_WRITE; | 4107 | op_type = OBJ_OP_WRITE; |
4113 | else | 4108 | break; |
4109 | case REQ_OP_READ: | ||
4114 | op_type = OBJ_OP_READ; | 4110 | op_type = OBJ_OP_READ; |
4111 | break; | ||
4112 | default: | ||
4113 | dout("%s: non-fs request type %d\n", __func__, req_op(rq)); | ||
4114 | result = -EIO; | ||
4115 | goto err; | ||
4116 | } | ||
4115 | 4117 | ||
4116 | /* Ignore/skip any zero-length requests */ | 4118 | /* Ignore/skip any zero-length requests */ |
4117 | 4119 | ||
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c index 0e93ad7b8511..c8e072caf56f 100644 --- a/drivers/block/sx8.c +++ b/drivers/block/sx8.c | |||
@@ -567,7 +567,7 @@ static struct carm_request *carm_get_special(struct carm_host *host) | |||
567 | if (!crq) | 567 | if (!crq) |
568 | return NULL; | 568 | return NULL; |
569 | 569 | ||
570 | rq = blk_get_request(host->oob_q, WRITE /* bogus */, GFP_KERNEL); | 570 | rq = blk_get_request(host->oob_q, REQ_OP_DRV_OUT, GFP_KERNEL); |
571 | if (IS_ERR(rq)) { | 571 | if (IS_ERR(rq)) { |
572 | spin_lock_irqsave(&host->lock, flags); | 572 | spin_lock_irqsave(&host->lock, flags); |
573 | carm_put_request(host, crq); | 573 | carm_put_request(host, crq); |
@@ -620,7 +620,6 @@ static int carm_array_info (struct carm_host *host, unsigned int array_idx) | |||
620 | spin_unlock_irq(&host->lock); | 620 | spin_unlock_irq(&host->lock); |
621 | 621 | ||
622 | DPRINTK("blk_execute_rq_nowait, tag == %u\n", idx); | 622 | DPRINTK("blk_execute_rq_nowait, tag == %u\n", idx); |
623 | crq->rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
624 | crq->rq->special = crq; | 623 | crq->rq->special = crq; |
625 | blk_execute_rq_nowait(host->oob_q, NULL, crq->rq, true, NULL); | 624 | blk_execute_rq_nowait(host->oob_q, NULL, crq->rq, true, NULL); |
626 | 625 | ||
@@ -661,7 +660,6 @@ static int carm_send_special (struct carm_host *host, carm_sspc_t func) | |||
661 | crq->msg_bucket = (u32) rc; | 660 | crq->msg_bucket = (u32) rc; |
662 | 661 | ||
663 | DPRINTK("blk_execute_rq_nowait, tag == %u\n", idx); | 662 | DPRINTK("blk_execute_rq_nowait, tag == %u\n", idx); |
664 | crq->rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
665 | crq->rq->special = crq; | 663 | crq->rq->special = crq; |
666 | blk_execute_rq_nowait(host->oob_q, NULL, crq->rq, true, NULL); | 664 | blk_execute_rq_nowait(host->oob_q, NULL, crq->rq, true, NULL); |
667 | 665 | ||
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index d9491bdd3ad3..a363170e45b1 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -175,11 +175,12 @@ static inline void virtblk_request_done(struct request *req) | |||
175 | struct virtblk_req *vbr = blk_mq_rq_to_pdu(req); | 175 | struct virtblk_req *vbr = blk_mq_rq_to_pdu(req); |
176 | int error = virtblk_result(vbr); | 176 | int error = virtblk_result(vbr); |
177 | 177 | ||
178 | switch (req->cmd_type) { | 178 | switch (req_op(req)) { |
179 | case REQ_TYPE_BLOCK_PC: | 179 | case REQ_OP_SCSI_IN: |
180 | case REQ_OP_SCSI_OUT: | ||
180 | virtblk_scsi_reques_done(req); | 181 | virtblk_scsi_reques_done(req); |
181 | break; | 182 | break; |
182 | case REQ_TYPE_DRV_PRIV: | 183 | case REQ_OP_DRV_IN: |
183 | req->errors = (error != 0); | 184 | req->errors = (error != 0); |
184 | break; | 185 | break; |
185 | } | 186 | } |
@@ -226,36 +227,35 @@ static int virtio_queue_rq(struct blk_mq_hw_ctx *hctx, | |||
226 | int qid = hctx->queue_num; | 227 | int qid = hctx->queue_num; |
227 | int err; | 228 | int err; |
228 | bool notify = false; | 229 | bool notify = false; |
230 | u32 type; | ||
229 | 231 | ||
230 | BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems); | 232 | BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems); |
231 | 233 | ||
232 | if (req_op(req) == REQ_OP_FLUSH) { | 234 | switch (req_op(req)) { |
233 | vbr->out_hdr.type = cpu_to_virtio32(vblk->vdev, VIRTIO_BLK_T_FLUSH); | 235 | case REQ_OP_READ: |
234 | vbr->out_hdr.sector = 0; | 236 | case REQ_OP_WRITE: |
235 | vbr->out_hdr.ioprio = cpu_to_virtio32(vblk->vdev, req_get_ioprio(req)); | 237 | type = 0; |
236 | } else { | 238 | break; |
237 | switch (req->cmd_type) { | 239 | case REQ_OP_FLUSH: |
238 | case REQ_TYPE_FS: | 240 | type = VIRTIO_BLK_T_FLUSH; |
239 | vbr->out_hdr.type = 0; | 241 | break; |
240 | vbr->out_hdr.sector = cpu_to_virtio64(vblk->vdev, blk_rq_pos(req)); | 242 | case REQ_OP_SCSI_IN: |
241 | vbr->out_hdr.ioprio = cpu_to_virtio32(vblk->vdev, req_get_ioprio(req)); | 243 | case REQ_OP_SCSI_OUT: |
242 | break; | 244 | type = VIRTIO_BLK_T_SCSI_CMD; |
243 | case REQ_TYPE_BLOCK_PC: | 245 | break; |
244 | vbr->out_hdr.type = cpu_to_virtio32(vblk->vdev, VIRTIO_BLK_T_SCSI_CMD); | 246 | case REQ_OP_DRV_IN: |
245 | vbr->out_hdr.sector = 0; | 247 | type = VIRTIO_BLK_T_GET_ID; |
246 | vbr->out_hdr.ioprio = cpu_to_virtio32(vblk->vdev, req_get_ioprio(req)); | 248 | break; |
247 | break; | 249 | default: |
248 | case REQ_TYPE_DRV_PRIV: | 250 | WARN_ON_ONCE(1); |
249 | vbr->out_hdr.type = cpu_to_virtio32(vblk->vdev, VIRTIO_BLK_T_GET_ID); | 251 | return BLK_MQ_RQ_QUEUE_ERROR; |
250 | vbr->out_hdr.sector = 0; | ||
251 | vbr->out_hdr.ioprio = cpu_to_virtio32(vblk->vdev, req_get_ioprio(req)); | ||
252 | break; | ||
253 | default: | ||
254 | /* We don't put anything else in the queue. */ | ||
255 | BUG(); | ||
256 | } | ||
257 | } | 252 | } |
258 | 253 | ||
254 | vbr->out_hdr.type = cpu_to_virtio32(vblk->vdev, type); | ||
255 | vbr->out_hdr.sector = type ? | ||
256 | 0 : cpu_to_virtio64(vblk->vdev, blk_rq_pos(req)); | ||
257 | vbr->out_hdr.ioprio = cpu_to_virtio32(vblk->vdev, req_get_ioprio(req)); | ||
258 | |||
259 | blk_mq_start_request(req); | 259 | blk_mq_start_request(req); |
260 | 260 | ||
261 | num = blk_rq_map_sg(hctx->queue, req, vbr->sg); | 261 | num = blk_rq_map_sg(hctx->queue, req, vbr->sg); |
@@ -267,7 +267,7 @@ static int virtio_queue_rq(struct blk_mq_hw_ctx *hctx, | |||
267 | } | 267 | } |
268 | 268 | ||
269 | spin_lock_irqsave(&vblk->vqs[qid].lock, flags); | 269 | spin_lock_irqsave(&vblk->vqs[qid].lock, flags); |
270 | if (req->cmd_type == REQ_TYPE_BLOCK_PC) | 270 | if (req_op(req) == REQ_OP_SCSI_IN || req_op(req) == REQ_OP_SCSI_OUT) |
271 | err = virtblk_add_req_scsi(vblk->vqs[qid].vq, vbr, vbr->sg, num); | 271 | err = virtblk_add_req_scsi(vblk->vqs[qid].vq, vbr, vbr->sg, num); |
272 | else | 272 | else |
273 | err = virtblk_add_req(vblk->vqs[qid].vq, vbr, vbr->sg, num); | 273 | err = virtblk_add_req(vblk->vqs[qid].vq, vbr, vbr->sg, num); |
@@ -300,10 +300,9 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) | |||
300 | struct request *req; | 300 | struct request *req; |
301 | int err; | 301 | int err; |
302 | 302 | ||
303 | req = blk_get_request(q, READ, GFP_KERNEL); | 303 | req = blk_get_request(q, REQ_OP_DRV_IN, GFP_KERNEL); |
304 | if (IS_ERR(req)) | 304 | if (IS_ERR(req)) |
305 | return PTR_ERR(req); | 305 | return PTR_ERR(req); |
306 | req->cmd_type = REQ_TYPE_DRV_PRIV; | ||
307 | 306 | ||
308 | err = blk_rq_map_kern(q, req, id_str, VIRTIO_BLK_ID_BYTES, GFP_KERNEL); | 307 | err = blk_rq_map_kern(q, req, id_str, VIRTIO_BLK_ID_BYTES, GFP_KERNEL); |
309 | if (err) | 308 | if (err) |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index b2bdfa81f929..9a8cb226cb3a 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -865,7 +865,7 @@ static inline void flush_requests(struct blkfront_ring_info *rinfo) | |||
865 | static inline bool blkif_request_flush_invalid(struct request *req, | 865 | static inline bool blkif_request_flush_invalid(struct request *req, |
866 | struct blkfront_info *info) | 866 | struct blkfront_info *info) |
867 | { | 867 | { |
868 | return ((req->cmd_type != REQ_TYPE_FS) || | 868 | return (blk_rq_is_passthrough(req) || |
869 | ((req_op(req) == REQ_OP_FLUSH) && | 869 | ((req_op(req) == REQ_OP_FLUSH) && |
870 | !info->feature_flush) || | 870 | !info->feature_flush) || |
871 | ((req->cmd_flags & REQ_FUA) && | 871 | ((req->cmd_flags & REQ_FUA) && |
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index c4328d9d9981..757dce2147e0 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -468,7 +468,7 @@ static struct request *ace_get_next_request(struct request_queue *q) | |||
468 | struct request *req; | 468 | struct request *req; |
469 | 469 | ||
470 | while ((req = blk_peek_request(q)) != NULL) { | 470 | while ((req = blk_peek_request(q)) != NULL) { |
471 | if (req->cmd_type == REQ_TYPE_FS) | 471 | if (!blk_rq_is_passthrough(req)) |
472 | break; | 472 | break; |
473 | blk_start_request(req); | 473 | blk_start_request(req); |
474 | __blk_end_request_all(req, -EIO); | 474 | __blk_end_request_all(req, -EIO); |
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 | ||
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index a8c650e8c92e..feb30061123b 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -92,9 +92,8 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, | |||
92 | struct request *rq; | 92 | struct request *rq; |
93 | int error; | 93 | int error; |
94 | 94 | ||
95 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 95 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
96 | scsi_req_init(rq); | 96 | scsi_req_init(rq); |
97 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
98 | ide_req(rq)->type = ATA_PRIV_MISC; | 97 | ide_req(rq)->type = ATA_PRIV_MISC; |
99 | rq->special = (char *)pc; | 98 | rq->special = (char *)pc; |
100 | 99 | ||
@@ -212,7 +211,7 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq) | |||
212 | } | 211 | } |
213 | 212 | ||
214 | sense_rq->rq_disk = rq->rq_disk; | 213 | sense_rq->rq_disk = rq->rq_disk; |
215 | sense_rq->cmd_type = REQ_TYPE_DRV_PRIV; | 214 | sense_rq->cmd_flags = REQ_OP_DRV_IN; |
216 | ide_req(sense_rq)->type = ATA_PRIV_SENSE; | 215 | ide_req(sense_rq)->type = ATA_PRIV_SENSE; |
217 | sense_rq->rq_flags |= RQF_PREEMPT; | 216 | sense_rq->rq_flags |= RQF_PREEMPT; |
218 | 217 | ||
@@ -312,19 +311,21 @@ EXPORT_SYMBOL_GPL(ide_cd_expiry); | |||
312 | 311 | ||
313 | int ide_cd_get_xferlen(struct request *rq) | 312 | int ide_cd_get_xferlen(struct request *rq) |
314 | { | 313 | { |
315 | switch (rq->cmd_type) { | 314 | switch (req_op(rq)) { |
316 | case REQ_TYPE_FS: | 315 | default: |
317 | return 32768; | 316 | return 32768; |
318 | case REQ_TYPE_BLOCK_PC: | 317 | case REQ_OP_SCSI_IN: |
318 | case REQ_OP_SCSI_OUT: | ||
319 | return blk_rq_bytes(rq); | 319 | return blk_rq_bytes(rq); |
320 | case REQ_TYPE_DRV_PRIV: | 320 | case REQ_OP_DRV_IN: |
321 | case REQ_OP_DRV_OUT: | ||
321 | switch (ide_req(rq)->type) { | 322 | switch (ide_req(rq)->type) { |
322 | case ATA_PRIV_PC: | 323 | case ATA_PRIV_PC: |
323 | case ATA_PRIV_SENSE: | 324 | case ATA_PRIV_SENSE: |
324 | return blk_rq_bytes(rq); | 325 | return blk_rq_bytes(rq); |
326 | default: | ||
327 | return 0; | ||
325 | } | 328 | } |
326 | default: | ||
327 | return 0; | ||
328 | } | 329 | } |
329 | } | 330 | } |
330 | EXPORT_SYMBOL_GPL(ide_cd_get_xferlen); | 331 | EXPORT_SYMBOL_GPL(ide_cd_get_xferlen); |
@@ -491,7 +492,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) | |||
491 | error = 0; | 492 | error = 0; |
492 | } else { | 493 | } else { |
493 | 494 | ||
494 | if (rq->cmd_type != REQ_TYPE_FS && uptodate <= 0) { | 495 | if (blk_rq_is_passthrough(rq) && uptodate <= 0) { |
495 | if (rq->errors == 0) | 496 | if (rq->errors == 0) |
496 | rq->errors = -EIO; | 497 | rq->errors = -EIO; |
497 | } | 498 | } |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 207af7816544..dc039d150357 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -176,7 +176,7 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
176 | if (!sense->valid) | 176 | if (!sense->valid) |
177 | break; | 177 | break; |
178 | if (failed_command == NULL || | 178 | if (failed_command == NULL || |
179 | failed_command->cmd_type != REQ_TYPE_FS) | 179 | blk_rq_is_passthrough(failed_command)) |
180 | break; | 180 | break; |
181 | sector = (sense->information[0] << 24) | | 181 | sector = (sense->information[0] << 24) | |
182 | (sense->information[1] << 16) | | 182 | (sense->information[1] << 16) | |
@@ -293,7 +293,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
293 | } | 293 | } |
294 | 294 | ||
295 | /* if we have an error, pass CHECK_CONDITION as the SCSI status byte */ | 295 | /* if we have an error, pass CHECK_CONDITION as the SCSI status byte */ |
296 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC && !rq->errors) | 296 | if (blk_rq_is_scsi(rq) && !rq->errors) |
297 | rq->errors = SAM_STAT_CHECK_CONDITION; | 297 | rq->errors = SAM_STAT_CHECK_CONDITION; |
298 | 298 | ||
299 | if (blk_noretry_request(rq)) | 299 | if (blk_noretry_request(rq)) |
@@ -301,13 +301,13 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
301 | 301 | ||
302 | switch (sense_key) { | 302 | switch (sense_key) { |
303 | case NOT_READY: | 303 | case NOT_READY: |
304 | if (rq->cmd_type == REQ_TYPE_FS && rq_data_dir(rq) == WRITE) { | 304 | if (req_op(rq) == REQ_OP_WRITE) { |
305 | if (ide_cd_breathe(drive, rq)) | 305 | if (ide_cd_breathe(drive, rq)) |
306 | return 1; | 306 | return 1; |
307 | } else { | 307 | } else { |
308 | cdrom_saw_media_change(drive); | 308 | cdrom_saw_media_change(drive); |
309 | 309 | ||
310 | if (rq->cmd_type == REQ_TYPE_FS && | 310 | if (!blk_rq_is_passthrough(rq) && |
311 | !(rq->rq_flags & RQF_QUIET)) | 311 | !(rq->rq_flags & RQF_QUIET)) |
312 | printk(KERN_ERR PFX "%s: tray open\n", | 312 | printk(KERN_ERR PFX "%s: tray open\n", |
313 | drive->name); | 313 | drive->name); |
@@ -317,7 +317,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
317 | case UNIT_ATTENTION: | 317 | case UNIT_ATTENTION: |
318 | cdrom_saw_media_change(drive); | 318 | cdrom_saw_media_change(drive); |
319 | 319 | ||
320 | if (rq->cmd_type != REQ_TYPE_FS) | 320 | if (blk_rq_is_passthrough(rq)) |
321 | return 0; | 321 | return 0; |
322 | 322 | ||
323 | /* | 323 | /* |
@@ -365,7 +365,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
365 | do_end_request = 1; | 365 | do_end_request = 1; |
366 | break; | 366 | break; |
367 | default: | 367 | default: |
368 | if (rq->cmd_type != REQ_TYPE_FS) | 368 | if (blk_rq_is_passthrough(rq)) |
369 | break; | 369 | break; |
370 | if (err & ~ATA_ABORTED) { | 370 | if (err & ~ATA_ABORTED) { |
371 | /* go to the default handler for other errors */ | 371 | /* go to the default handler for other errors */ |
@@ -376,7 +376,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
376 | do_end_request = 1; | 376 | do_end_request = 1; |
377 | } | 377 | } |
378 | 378 | ||
379 | if (rq->cmd_type != REQ_TYPE_FS) { | 379 | if (blk_rq_is_passthrough(rq)) { |
380 | rq->rq_flags |= RQF_FAILED; | 380 | rq->rq_flags |= RQF_FAILED; |
381 | do_end_request = 1; | 381 | do_end_request = 1; |
382 | } | 382 | } |
@@ -435,10 +435,10 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, | |||
435 | int error; | 435 | int error; |
436 | bool delay = false; | 436 | bool delay = false; |
437 | 437 | ||
438 | rq = blk_get_request(drive->queue, write, __GFP_RECLAIM); | 438 | rq = blk_get_request(drive->queue, |
439 | write ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN, __GFP_RECLAIM); | ||
439 | scsi_req_init(rq); | 440 | scsi_req_init(rq); |
440 | memcpy(scsi_req(rq)->cmd, cmd, BLK_MAX_CDB); | 441 | memcpy(scsi_req(rq)->cmd, cmd, BLK_MAX_CDB); |
441 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
442 | ide_req(rq)->type = ATA_PRIV_PC; | 442 | ide_req(rq)->type = ATA_PRIV_PC; |
443 | rq->rq_flags |= rq_flags; | 443 | rq->rq_flags |= rq_flags; |
444 | rq->timeout = timeout; | 444 | rq->timeout = timeout; |
@@ -564,7 +564,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
564 | 564 | ||
565 | ide_read_bcount_and_ireason(drive, &len, &ireason); | 565 | ide_read_bcount_and_ireason(drive, &len, &ireason); |
566 | 566 | ||
567 | thislen = (rq->cmd_type == REQ_TYPE_FS) ? len : cmd->nleft; | 567 | thislen = !blk_rq_is_passthrough(rq) ? len : cmd->nleft; |
568 | if (thislen > len) | 568 | if (thislen > len) |
569 | thislen = len; | 569 | thislen = len; |
570 | 570 | ||
@@ -573,7 +573,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
573 | 573 | ||
574 | /* If DRQ is clear, the command has completed. */ | 574 | /* If DRQ is clear, the command has completed. */ |
575 | if ((stat & ATA_DRQ) == 0) { | 575 | if ((stat & ATA_DRQ) == 0) { |
576 | if (rq->cmd_type == REQ_TYPE_FS) { | 576 | switch (req_op(rq)) { |
577 | default: | ||
577 | /* | 578 | /* |
578 | * If we're not done reading/writing, complain. | 579 | * If we're not done reading/writing, complain. |
579 | * Otherwise, complete the command normally. | 580 | * Otherwise, complete the command normally. |
@@ -587,7 +588,9 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
587 | rq->rq_flags |= RQF_FAILED; | 588 | rq->rq_flags |= RQF_FAILED; |
588 | uptodate = 0; | 589 | uptodate = 0; |
589 | } | 590 | } |
590 | } else if (rq->cmd_type != REQ_TYPE_BLOCK_PC) { | 591 | goto out_end; |
592 | case REQ_OP_DRV_IN: | ||
593 | case REQ_OP_DRV_OUT: | ||
591 | ide_cd_request_sense_fixup(drive, cmd); | 594 | ide_cd_request_sense_fixup(drive, cmd); |
592 | 595 | ||
593 | uptodate = cmd->nleft ? 0 : 1; | 596 | uptodate = cmd->nleft ? 0 : 1; |
@@ -603,8 +606,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
603 | 606 | ||
604 | if (!uptodate) | 607 | if (!uptodate) |
605 | rq->rq_flags |= RQF_FAILED; | 608 | rq->rq_flags |= RQF_FAILED; |
609 | goto out_end; | ||
610 | case REQ_OP_SCSI_IN: | ||
611 | case REQ_OP_SCSI_OUT: | ||
612 | goto out_end; | ||
606 | } | 613 | } |
607 | goto out_end; | ||
608 | } | 614 | } |
609 | 615 | ||
610 | rc = ide_check_ireason(drive, rq, len, ireason, write); | 616 | rc = ide_check_ireason(drive, rq, len, ireason, write); |
@@ -636,7 +642,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
636 | 642 | ||
637 | /* pad, if necessary */ | 643 | /* pad, if necessary */ |
638 | if (len > 0) { | 644 | if (len > 0) { |
639 | if (rq->cmd_type != REQ_TYPE_FS || write == 0) | 645 | if (blk_rq_is_passthrough(rq) || write == 0) |
640 | ide_pad_transfer(drive, write, len); | 646 | ide_pad_transfer(drive, write, len); |
641 | else { | 647 | else { |
642 | printk(KERN_ERR PFX "%s: confused, missing data\n", | 648 | printk(KERN_ERR PFX "%s: confused, missing data\n", |
@@ -645,12 +651,18 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
645 | } | 651 | } |
646 | } | 652 | } |
647 | 653 | ||
648 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { | 654 | switch (req_op(rq)) { |
655 | case REQ_OP_SCSI_IN: | ||
656 | case REQ_OP_SCSI_OUT: | ||
649 | timeout = rq->timeout; | 657 | timeout = rq->timeout; |
650 | } else { | 658 | break; |
659 | case REQ_OP_DRV_IN: | ||
660 | case REQ_OP_DRV_OUT: | ||
661 | expiry = ide_cd_expiry; | ||
662 | /*FALLTHRU*/ | ||
663 | default: | ||
651 | timeout = ATAPI_WAIT_PC; | 664 | timeout = ATAPI_WAIT_PC; |
652 | if (rq->cmd_type != REQ_TYPE_FS) | 665 | break; |
653 | expiry = ide_cd_expiry; | ||
654 | } | 666 | } |
655 | 667 | ||
656 | hwif->expiry = expiry; | 668 | hwif->expiry = expiry; |
@@ -658,7 +670,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
658 | return ide_started; | 670 | return ide_started; |
659 | 671 | ||
660 | out_end: | 672 | out_end: |
661 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC && rc == 0) { | 673 | if (blk_rq_is_scsi(rq) && rc == 0) { |
662 | scsi_req(rq)->resid_len = 0; | 674 | scsi_req(rq)->resid_len = 0; |
663 | blk_end_request_all(rq, 0); | 675 | blk_end_request_all(rq, 0); |
664 | hwif->rq = NULL; | 676 | hwif->rq = NULL; |
@@ -666,7 +678,7 @@ out_end: | |||
666 | if (sense && uptodate) | 678 | if (sense && uptodate) |
667 | ide_cd_complete_failed_rq(drive, rq); | 679 | ide_cd_complete_failed_rq(drive, rq); |
668 | 680 | ||
669 | if (rq->cmd_type == REQ_TYPE_FS) { | 681 | if (!blk_rq_is_passthrough(rq)) { |
670 | if (cmd->nleft == 0) | 682 | if (cmd->nleft == 0) |
671 | uptodate = 1; | 683 | uptodate = 1; |
672 | } else { | 684 | } else { |
@@ -679,7 +691,7 @@ out_end: | |||
679 | return ide_stopped; | 691 | return ide_stopped; |
680 | 692 | ||
681 | /* make sure it's fully ended */ | 693 | /* make sure it's fully ended */ |
682 | if (rq->cmd_type != REQ_TYPE_FS) { | 694 | if (blk_rq_is_passthrough(rq)) { |
683 | scsi_req(rq)->resid_len -= cmd->nbytes - cmd->nleft; | 695 | scsi_req(rq)->resid_len -= cmd->nbytes - cmd->nleft; |
684 | if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) | 696 | if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) |
685 | scsi_req(rq)->resid_len += cmd->last_xfer_len; | 697 | scsi_req(rq)->resid_len += cmd->last_xfer_len; |
@@ -739,7 +751,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | |||
739 | ide_debug_log(IDE_DBG_PC, "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x", | 751 | ide_debug_log(IDE_DBG_PC, "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x", |
740 | rq->cmd[0], rq->cmd_type); | 752 | rq->cmd[0], rq->cmd_type); |
741 | 753 | ||
742 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) | 754 | if (blk_rq_is_scsi(rq)) |
743 | rq->rq_flags |= RQF_QUIET; | 755 | rq->rq_flags |= RQF_QUIET; |
744 | else | 756 | else |
745 | rq->rq_flags &= ~RQF_FAILED; | 757 | rq->rq_flags &= ~RQF_FAILED; |
@@ -781,18 +793,20 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
781 | if (drive->debug_mask & IDE_DBG_RQ) | 793 | if (drive->debug_mask & IDE_DBG_RQ) |
782 | blk_dump_rq_flags(rq, "ide_cd_do_request"); | 794 | blk_dump_rq_flags(rq, "ide_cd_do_request"); |
783 | 795 | ||
784 | switch (rq->cmd_type) { | 796 | switch (req_op(rq)) { |
785 | case REQ_TYPE_FS: | 797 | default: |
786 | if (cdrom_start_rw(drive, rq) == ide_stopped) | 798 | if (cdrom_start_rw(drive, rq) == ide_stopped) |
787 | goto out_end; | 799 | goto out_end; |
788 | break; | 800 | break; |
789 | case REQ_TYPE_BLOCK_PC: | 801 | case REQ_OP_SCSI_IN: |
802 | case REQ_OP_SCSI_OUT: | ||
790 | handle_pc: | 803 | handle_pc: |
791 | if (!rq->timeout) | 804 | if (!rq->timeout) |
792 | rq->timeout = ATAPI_WAIT_PC; | 805 | rq->timeout = ATAPI_WAIT_PC; |
793 | cdrom_do_block_pc(drive, rq); | 806 | cdrom_do_block_pc(drive, rq); |
794 | break; | 807 | break; |
795 | case REQ_TYPE_DRV_PRIV: | 808 | case REQ_OP_DRV_IN: |
809 | case REQ_OP_DRV_OUT: | ||
796 | switch (ide_req(rq)->type) { | 810 | switch (ide_req(rq)->type) { |
797 | case ATA_PRIV_MISC: | 811 | case ATA_PRIV_MISC: |
798 | /* right now this can only be a reset... */ | 812 | /* right now this can only be a reset... */ |
@@ -801,9 +815,9 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
801 | case ATA_PRIV_SENSE: | 815 | case ATA_PRIV_SENSE: |
802 | case ATA_PRIV_PC: | 816 | case ATA_PRIV_PC: |
803 | goto handle_pc; | 817 | goto handle_pc; |
818 | default: | ||
819 | BUG(); | ||
804 | } | 820 | } |
805 | default: | ||
806 | BUG(); | ||
807 | } | 821 | } |
808 | 822 | ||
809 | /* prepare sense request for this command */ | 823 | /* prepare sense request for this command */ |
@@ -816,7 +830,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
816 | 830 | ||
817 | cmd.rq = rq; | 831 | cmd.rq = rq; |
818 | 832 | ||
819 | if (rq->cmd_type == REQ_TYPE_FS || blk_rq_bytes(rq)) { | 833 | if (!blk_rq_is_passthrough(rq) || blk_rq_bytes(rq)) { |
820 | ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); | 834 | ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); |
821 | ide_map_sg(drive, &cmd); | 835 | ide_map_sg(drive, &cmd); |
822 | } | 836 | } |
@@ -1373,9 +1387,9 @@ static int ide_cdrom_prep_pc(struct request *rq) | |||
1373 | 1387 | ||
1374 | static int ide_cdrom_prep_fn(struct request_queue *q, struct request *rq) | 1388 | static int ide_cdrom_prep_fn(struct request_queue *q, struct request *rq) |
1375 | { | 1389 | { |
1376 | if (rq->cmd_type == REQ_TYPE_FS) | 1390 | if (!blk_rq_is_passthrough(rq)) |
1377 | return ide_cdrom_prep_fs(q, rq); | 1391 | return ide_cdrom_prep_fs(q, rq); |
1378 | else if (rq->cmd_type == REQ_TYPE_BLOCK_PC) | 1392 | else if (blk_rq_is_scsi(rq)) |
1379 | return ide_cdrom_prep_pc(rq); | 1393 | return ide_cdrom_prep_pc(rq); |
1380 | 1394 | ||
1381 | return 0; | 1395 | return 0; |
diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c index 3f03eed0ff78..9fcefbc8425e 100644 --- a/drivers/ide/ide-cd_ioctl.c +++ b/drivers/ide/ide-cd_ioctl.c | |||
@@ -303,9 +303,8 @@ int ide_cdrom_reset(struct cdrom_device_info *cdi) | |||
303 | struct request *rq; | 303 | struct request *rq; |
304 | int ret; | 304 | int ret; |
305 | 305 | ||
306 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 306 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
307 | scsi_req_init(rq); | 307 | scsi_req_init(rq); |
308 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
309 | ide_req(rq)->type = ATA_PRIV_MISC; | 308 | ide_req(rq)->type = ATA_PRIV_MISC; |
310 | rq->rq_flags = RQF_QUIET; | 309 | rq->rq_flags = RQF_QUIET; |
311 | ret = blk_execute_rq(drive->queue, cd->disk, rq, 0); | 310 | ret = blk_execute_rq(drive->queue, cd->disk, rq, 0); |
diff --git a/drivers/ide/ide-devsets.c b/drivers/ide/ide-devsets.c index c040b9de2b4e..a45dda5386e4 100644 --- a/drivers/ide/ide-devsets.c +++ b/drivers/ide/ide-devsets.c | |||
@@ -165,9 +165,8 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting, | |||
165 | if (!(setting->flags & DS_SYNC)) | 165 | if (!(setting->flags & DS_SYNC)) |
166 | return setting->set(drive, arg); | 166 | return setting->set(drive, arg); |
167 | 167 | ||
168 | rq = blk_get_request(q, READ, __GFP_RECLAIM); | 168 | rq = blk_get_request(q, REQ_OP_DRV_IN, __GFP_RECLAIM); |
169 | scsi_req_init(rq); | 169 | scsi_req_init(rq); |
170 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
171 | ide_req(rq)->type = ATA_PRIV_MISC; | 170 | ide_req(rq)->type = ATA_PRIV_MISC; |
172 | scsi_req(rq)->cmd_len = 5; | 171 | scsi_req(rq)->cmd_len = 5; |
173 | scsi_req(rq)->cmd[0] = REQ_DEVSET_EXEC; | 172 | scsi_req(rq)->cmd[0] = REQ_DEVSET_EXEC; |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 69cf71729841..186159715b71 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -184,7 +184,7 @@ static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
184 | ide_hwif_t *hwif = drive->hwif; | 184 | ide_hwif_t *hwif = drive->hwif; |
185 | 185 | ||
186 | BUG_ON(drive->dev_flags & IDE_DFLAG_BLOCKED); | 186 | BUG_ON(drive->dev_flags & IDE_DFLAG_BLOCKED); |
187 | BUG_ON(rq->cmd_type != REQ_TYPE_FS); | 187 | BUG_ON(blk_rq_is_passthrough(rq)); |
188 | 188 | ||
189 | ledtrig_disk_activity(); | 189 | ledtrig_disk_activity(); |
190 | 190 | ||
@@ -452,8 +452,8 @@ static int idedisk_prep_fn(struct request_queue *q, struct request *rq) | |||
452 | cmd->valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; | 452 | cmd->valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
453 | cmd->tf_flags = IDE_TFLAG_DYN; | 453 | cmd->tf_flags = IDE_TFLAG_DYN; |
454 | cmd->protocol = ATA_PROT_NODATA; | 454 | cmd->protocol = ATA_PROT_NODATA; |
455 | 455 | rq->cmd_flags &= ~REQ_OP_MASK; | |
456 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | 456 | rq->cmd_flags |= REQ_OP_DRV_OUT; |
457 | ide_req(rq)->type = ATA_PRIV_TASKFILE; | 457 | ide_req(rq)->type = ATA_PRIV_TASKFILE; |
458 | rq->special = cmd; | 458 | rq->special = cmd; |
459 | cmd->rq = rq; | 459 | cmd->rq = rq; |
@@ -478,9 +478,8 @@ static int set_multcount(ide_drive_t *drive, int arg) | |||
478 | if (drive->special_flags & IDE_SFLAG_SET_MULTMODE) | 478 | if (drive->special_flags & IDE_SFLAG_SET_MULTMODE) |
479 | return -EBUSY; | 479 | return -EBUSY; |
480 | 480 | ||
481 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 481 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
482 | scsi_req_init(rq); | 482 | scsi_req_init(rq); |
483 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
484 | ide_req(rq)->type = ATA_PRIV_TASKFILE; | 483 | ide_req(rq)->type = ATA_PRIV_TASKFILE; |
485 | 484 | ||
486 | drive->mult_req = arg; | 485 | drive->mult_req = arg; |
diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c index 1e4b1476e559..cf3af6840368 100644 --- a/drivers/ide/ide-eh.c +++ b/drivers/ide/ide-eh.c | |||
@@ -123,7 +123,7 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat) | |||
123 | return ide_stopped; | 123 | return ide_stopped; |
124 | 124 | ||
125 | /* retry only "normal" I/O: */ | 125 | /* retry only "normal" I/O: */ |
126 | if (rq->cmd_type != REQ_TYPE_FS) { | 126 | if (blk_rq_is_passthrough(rq)) { |
127 | if (ata_taskfile_request(rq)) { | 127 | if (ata_taskfile_request(rq)) { |
128 | struct ide_cmd *cmd = rq->special; | 128 | struct ide_cmd *cmd = rq->special; |
129 | 129 | ||
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 24c6d363b3a4..a69e8013f1df 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -72,7 +72,7 @@ static int ide_floppy_callback(ide_drive_t *drive, int dsc) | |||
72 | drive->failed_pc = NULL; | 72 | drive->failed_pc = NULL; |
73 | 73 | ||
74 | if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 || | 74 | if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 || |
75 | rq->cmd_type == REQ_TYPE_BLOCK_PC) | 75 | (req_op(rq) == REQ_OP_SCSI_IN || req_op(rq) == REQ_OP_SCSI_OUT)) |
76 | uptodate = 1; /* FIXME */ | 76 | uptodate = 1; /* FIXME */ |
77 | else if (pc->c[0] == GPCMD_REQUEST_SENSE) { | 77 | else if (pc->c[0] == GPCMD_REQUEST_SENSE) { |
78 | 78 | ||
@@ -254,8 +254,8 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, | |||
254 | goto out_end; | 254 | goto out_end; |
255 | } | 255 | } |
256 | 256 | ||
257 | switch (rq->cmd_type) { | 257 | switch (req_op(rq)) { |
258 | case REQ_TYPE_FS: | 258 | default: |
259 | if (((long)blk_rq_pos(rq) % floppy->bs_factor) || | 259 | if (((long)blk_rq_pos(rq) % floppy->bs_factor) || |
260 | (blk_rq_sectors(rq) % floppy->bs_factor)) { | 260 | (blk_rq_sectors(rq) % floppy->bs_factor)) { |
261 | printk(KERN_ERR PFX "%s: unsupported r/w rq size\n", | 261 | printk(KERN_ERR PFX "%s: unsupported r/w rq size\n", |
@@ -265,11 +265,13 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, | |||
265 | pc = &floppy->queued_pc; | 265 | pc = &floppy->queued_pc; |
266 | idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block); | 266 | idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block); |
267 | break; | 267 | break; |
268 | case REQ_TYPE_BLOCK_PC: | 268 | case REQ_OP_SCSI_IN: |
269 | case REQ_OP_SCSI_OUT: | ||
269 | pc = &floppy->queued_pc; | 270 | pc = &floppy->queued_pc; |
270 | idefloppy_blockpc_cmd(floppy, pc, rq); | 271 | idefloppy_blockpc_cmd(floppy, pc, rq); |
271 | break; | 272 | break; |
272 | case REQ_TYPE_DRV_PRIV: | 273 | case REQ_OP_DRV_IN: |
274 | case REQ_OP_DRV_OUT: | ||
273 | switch (ide_req(rq)->type) { | 275 | switch (ide_req(rq)->type) { |
274 | case ATA_PRIV_MISC: | 276 | case ATA_PRIV_MISC: |
275 | case ATA_PRIV_SENSE: | 277 | case ATA_PRIV_SENSE: |
@@ -278,9 +280,6 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, | |||
278 | default: | 280 | default: |
279 | BUG(); | 281 | BUG(); |
280 | } | 282 | } |
281 | break; | ||
282 | default: | ||
283 | BUG(); | ||
284 | } | 283 | } |
285 | 284 | ||
286 | ide_prep_sense(drive, rq); | 285 | ide_prep_sense(drive, rq); |
@@ -292,7 +291,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, | |||
292 | 291 | ||
293 | cmd.rq = rq; | 292 | cmd.rq = rq; |
294 | 293 | ||
295 | if (rq->cmd_type == REQ_TYPE_FS || blk_rq_bytes(rq)) { | 294 | if (!blk_rq_is_passthrough(rq) || blk_rq_bytes(rq)) { |
296 | ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); | 295 | ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); |
297 | ide_map_sg(drive, &cmd); | 296 | ide_map_sg(drive, &cmd); |
298 | } | 297 | } |
@@ -302,7 +301,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, | |||
302 | return ide_floppy_issue_pc(drive, &cmd, pc); | 301 | return ide_floppy_issue_pc(drive, &cmd, pc); |
303 | out_end: | 302 | out_end: |
304 | drive->failed_pc = NULL; | 303 | drive->failed_pc = NULL; |
305 | if (rq->cmd_type != REQ_TYPE_FS && rq->errors == 0) | 304 | if (blk_rq_is_passthrough(rq) && rq->errors == 0) |
306 | rq->errors = -EIO; | 305 | rq->errors = -EIO; |
307 | ide_complete_rq(drive, -EIO, blk_rq_bytes(rq)); | 306 | ide_complete_rq(drive, -EIO, blk_rq_bytes(rq)); |
308 | return ide_stopped; | 307 | return ide_stopped; |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 6735c92b8da7..043b1fb963cb 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -145,7 +145,7 @@ void ide_kill_rq(ide_drive_t *drive, struct request *rq) | |||
145 | } else { | 145 | } else { |
146 | if (media == ide_tape) | 146 | if (media == ide_tape) |
147 | rq->errors = IDE_DRV_ERROR_GENERAL; | 147 | rq->errors = IDE_DRV_ERROR_GENERAL; |
148 | else if (rq->cmd_type != REQ_TYPE_FS && rq->errors == 0) | 148 | else if (blk_rq_is_passthrough(rq) && rq->errors == 0) |
149 | rq->errors = -EIO; | 149 | rq->errors = -EIO; |
150 | } | 150 | } |
151 | 151 | ||
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c index fc19e842deef..248a3e0ceb46 100644 --- a/drivers/ide/ide-ioctls.c +++ b/drivers/ide/ide-ioctls.c | |||
@@ -125,9 +125,8 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg) | |||
125 | if (NULL == (void *) arg) { | 125 | if (NULL == (void *) arg) { |
126 | struct request *rq; | 126 | struct request *rq; |
127 | 127 | ||
128 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 128 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
129 | scsi_req_init(rq); | 129 | scsi_req_init(rq); |
130 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
131 | ide_req(rq)->type = ATA_PRIV_TASKFILE; | 130 | ide_req(rq)->type = ATA_PRIV_TASKFILE; |
132 | err = blk_execute_rq(drive->queue, NULL, rq, 0); | 131 | err = blk_execute_rq(drive->queue, NULL, rq, 0); |
133 | blk_put_request(rq); | 132 | blk_put_request(rq); |
@@ -223,9 +222,8 @@ static int generic_drive_reset(ide_drive_t *drive) | |||
223 | struct request *rq; | 222 | struct request *rq; |
224 | int ret = 0; | 223 | int ret = 0; |
225 | 224 | ||
226 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 225 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
227 | scsi_req_init(rq); | 226 | scsi_req_init(rq); |
228 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
229 | ide_req(rq)->type = ATA_PRIV_MISC; | 227 | ide_req(rq)->type = ATA_PRIV_MISC; |
230 | scsi_req(rq)->cmd_len = 1; | 228 | scsi_req(rq)->cmd_len = 1; |
231 | scsi_req(rq)->cmd[0] = REQ_DRIVE_RESET; | 229 | scsi_req(rq)->cmd[0] = REQ_DRIVE_RESET; |
diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c index fc3c944ca4be..101aed9a61ca 100644 --- a/drivers/ide/ide-park.c +++ b/drivers/ide/ide-park.c | |||
@@ -31,11 +31,10 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) | |||
31 | } | 31 | } |
32 | spin_unlock_irq(&hwif->lock); | 32 | spin_unlock_irq(&hwif->lock); |
33 | 33 | ||
34 | rq = blk_get_request(q, READ, __GFP_RECLAIM); | 34 | rq = blk_get_request(q, REQ_OP_DRV_IN, __GFP_RECLAIM); |
35 | scsi_req_init(rq); | 35 | scsi_req_init(rq); |
36 | scsi_req(rq)->cmd[0] = REQ_PARK_HEADS; | 36 | scsi_req(rq)->cmd[0] = REQ_PARK_HEADS; |
37 | scsi_req(rq)->cmd_len = 1; | 37 | scsi_req(rq)->cmd_len = 1; |
38 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
39 | ide_req(rq)->type = ATA_PRIV_MISC; | 38 | ide_req(rq)->type = ATA_PRIV_MISC; |
40 | rq->special = &timeout; | 39 | rq->special = &timeout; |
41 | rc = blk_execute_rq(q, NULL, rq, 1); | 40 | rc = blk_execute_rq(q, NULL, rq, 1); |
@@ -47,14 +46,13 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) | |||
47 | * Make sure that *some* command is sent to the drive after the | 46 | * Make sure that *some* command is sent to the drive after the |
48 | * timeout has expired, so power management will be reenabled. | 47 | * timeout has expired, so power management will be reenabled. |
49 | */ | 48 | */ |
50 | rq = blk_get_request(q, READ, GFP_NOWAIT); | 49 | rq = blk_get_request(q, REQ_OP_DRV_IN, GFP_NOWAIT); |
51 | scsi_req_init(rq); | 50 | scsi_req_init(rq); |
52 | if (IS_ERR(rq)) | 51 | if (IS_ERR(rq)) |
53 | goto out; | 52 | goto out; |
54 | 53 | ||
55 | scsi_req(rq)->cmd[0] = REQ_UNPARK_HEADS; | 54 | scsi_req(rq)->cmd[0] = REQ_UNPARK_HEADS; |
56 | scsi_req(rq)->cmd_len = 1; | 55 | scsi_req(rq)->cmd_len = 1; |
57 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
58 | ide_req(rq)->type = ATA_PRIV_MISC; | 56 | ide_req(rq)->type = ATA_PRIV_MISC; |
59 | elv_add_request(q, rq, ELEVATOR_INSERT_FRONT); | 57 | elv_add_request(q, rq, ELEVATOR_INSERT_FRONT); |
60 | 58 | ||
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c index 0c1296815dfa..ec951be4b0c8 100644 --- a/drivers/ide/ide-pm.c +++ b/drivers/ide/ide-pm.c | |||
@@ -18,9 +18,8 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) | |||
18 | } | 18 | } |
19 | 19 | ||
20 | memset(&rqpm, 0, sizeof(rqpm)); | 20 | memset(&rqpm, 0, sizeof(rqpm)); |
21 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 21 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
22 | scsi_req_init(rq); | 22 | scsi_req_init(rq); |
23 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
24 | ide_req(rq)->type = ATA_PRIV_PM_SUSPEND; | 23 | ide_req(rq)->type = ATA_PRIV_PM_SUSPEND; |
25 | rq->special = &rqpm; | 24 | rq->special = &rqpm; |
26 | rqpm.pm_step = IDE_PM_START_SUSPEND; | 25 | rqpm.pm_step = IDE_PM_START_SUSPEND; |
@@ -90,9 +89,8 @@ int generic_ide_resume(struct device *dev) | |||
90 | } | 89 | } |
91 | 90 | ||
92 | memset(&rqpm, 0, sizeof(rqpm)); | 91 | memset(&rqpm, 0, sizeof(rqpm)); |
93 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 92 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
94 | scsi_req_init(rq); | 93 | scsi_req_init(rq); |
95 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
96 | ide_req(rq)->type = ATA_PRIV_PM_RESUME; | 94 | ide_req(rq)->type = ATA_PRIV_PM_RESUME; |
97 | rq->rq_flags |= RQF_PREEMPT; | 95 | rq->rq_flags |= RQF_PREEMPT; |
98 | rq->special = &rqpm; | 96 | rq->special = &rqpm; |
@@ -244,12 +242,12 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq) | |||
244 | { | 242 | { |
245 | struct ide_pm_state *pm = rq->special; | 243 | struct ide_pm_state *pm = rq->special; |
246 | 244 | ||
247 | if (rq->cmd_type == REQ_TYPE_DRV_PRIV && | 245 | if (blk_rq_is_private(rq) && |
248 | ide_req(rq)->type == ATA_PRIV_PM_SUSPEND && | 246 | ide_req(rq)->type == ATA_PRIV_PM_SUSPEND && |
249 | pm->pm_step == IDE_PM_START_SUSPEND) | 247 | pm->pm_step == IDE_PM_START_SUSPEND) |
250 | /* Mark drive blocked when starting the suspend sequence. */ | 248 | /* Mark drive blocked when starting the suspend sequence. */ |
251 | drive->dev_flags |= IDE_DFLAG_BLOCKED; | 249 | drive->dev_flags |= IDE_DFLAG_BLOCKED; |
252 | else if (rq->cmd_type == REQ_TYPE_DRV_PRIV && | 250 | else if (blk_rq_is_private(rq) && |
253 | ide_req(rq)->type == ATA_PRIV_PM_RESUME && | 251 | ide_req(rq)->type == ATA_PRIV_PM_RESUME && |
254 | pm->pm_step == IDE_PM_START_RESUME) { | 252 | pm->pm_step == IDE_PM_START_RESUME) { |
255 | /* | 253 | /* |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 37c7beabaacc..3c1b7974d66d 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -577,7 +577,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
577 | req->cmd[0], (unsigned long long)blk_rq_pos(rq), | 577 | req->cmd[0], (unsigned long long)blk_rq_pos(rq), |
578 | blk_rq_sectors(rq)); | 578 | blk_rq_sectors(rq)); |
579 | 579 | ||
580 | BUG_ON(rq->cmd_type != REQ_TYPE_DRV_PRIV); | 580 | BUG_ON(!blk_rq_is_private(rq)); |
581 | BUG_ON(ide_req(rq)->type != ATA_PRIV_MISC && | 581 | BUG_ON(ide_req(rq)->type != ATA_PRIV_MISC && |
582 | ide_req(rq)->type != ATA_PRIV_SENSE); | 582 | ide_req(rq)->type != ATA_PRIV_SENSE); |
583 | 583 | ||
@@ -854,9 +854,8 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int size) | |||
854 | BUG_ON(cmd != REQ_IDETAPE_READ && cmd != REQ_IDETAPE_WRITE); | 854 | BUG_ON(cmd != REQ_IDETAPE_READ && cmd != REQ_IDETAPE_WRITE); |
855 | BUG_ON(size < 0 || size % tape->blk_size); | 855 | BUG_ON(size < 0 || size % tape->blk_size); |
856 | 856 | ||
857 | rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); | 857 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); |
858 | scsi_req_init(rq); | 858 | scsi_req_init(rq); |
859 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
860 | ide_req(rq)->type = ATA_PRIV_MISC; | 859 | ide_req(rq)->type = ATA_PRIV_MISC; |
861 | scsi_req(rq)->cmd[13] = cmd; | 860 | scsi_req(rq)->cmd[13] = cmd; |
862 | rq->rq_disk = tape->disk; | 861 | rq->rq_disk = tape->disk; |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 9ccc1d573393..247b9faccce1 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -428,11 +428,11 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf, | |||
428 | { | 428 | { |
429 | struct request *rq; | 429 | struct request *rq; |
430 | int error; | 430 | int error; |
431 | int rw = !(cmd->tf_flags & IDE_TFLAG_WRITE) ? READ : WRITE; | ||
432 | 431 | ||
433 | rq = blk_get_request(drive->queue, rw, __GFP_RECLAIM); | 432 | rq = blk_get_request(drive->queue, |
433 | (cmd->tf_flags & IDE_TFLAG_WRITE) ? | ||
434 | REQ_OP_DRV_OUT : REQ_OP_DRV_IN, __GFP_RECLAIM); | ||
434 | scsi_req_init(rq); | 435 | scsi_req_init(rq); |
435 | rq->cmd_type = REQ_TYPE_DRV_PRIV; | ||
436 | ide_req(rq)->type = ATA_PRIV_TASKFILE; | 436 | ide_req(rq)->type = ATA_PRIV_TASKFILE; |
437 | 437 | ||
438 | /* | 438 | /* |
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index df8a5ef334c0..6b8d5cd7dbf6 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c | |||
@@ -84,9 +84,6 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr, | |||
84 | nsect = blk_rq_cur_bytes(req) >> tr->blkshift; | 84 | nsect = blk_rq_cur_bytes(req) >> tr->blkshift; |
85 | buf = bio_data(req->bio); | 85 | buf = bio_data(req->bio); |
86 | 86 | ||
87 | if (req->cmd_type != REQ_TYPE_FS) | ||
88 | return -EIO; | ||
89 | |||
90 | if (req_op(req) == REQ_OP_FLUSH) | 87 | if (req_op(req) == REQ_OP_FLUSH) |
91 | return tr->flush(dev); | 88 | return tr->flush(dev); |
92 | 89 | ||
@@ -94,16 +91,16 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr, | |||
94 | get_capacity(req->rq_disk)) | 91 | get_capacity(req->rq_disk)) |
95 | return -EIO; | 92 | return -EIO; |
96 | 93 | ||
97 | if (req_op(req) == REQ_OP_DISCARD) | 94 | switch (req_op(req)) { |
95 | case REQ_OP_DISCARD: | ||
98 | return tr->discard(dev, block, nsect); | 96 | return tr->discard(dev, block, nsect); |
99 | 97 | case REQ_OP_READ: | |
100 | if (rq_data_dir(req) == READ) { | ||
101 | for (; nsect > 0; nsect--, block++, buf += tr->blksize) | 98 | for (; nsect > 0; nsect--, block++, buf += tr->blksize) |
102 | if (tr->readsect(dev, block, buf)) | 99 | if (tr->readsect(dev, block, buf)) |
103 | return -EIO; | 100 | return -EIO; |
104 | rq_flush_dcache_pages(req); | 101 | rq_flush_dcache_pages(req); |
105 | return 0; | 102 | return 0; |
106 | } else { | 103 | case REQ_OP_WRITE: |
107 | if (!tr->writesect) | 104 | if (!tr->writesect) |
108 | return -EIO; | 105 | return -EIO; |
109 | 106 | ||
@@ -112,6 +109,8 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr, | |||
112 | if (tr->writesect(dev, block, buf)) | 109 | if (tr->writesect(dev, block, buf)) |
113 | return -EIO; | 110 | return -EIO; |
114 | return 0; | 111 | return 0; |
112 | default: | ||
113 | return -EIO; | ||
115 | } | 114 | } |
116 | } | 115 | } |
117 | 116 | ||
diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c index d1e6931c132f..c80869e60909 100644 --- a/drivers/mtd/ubi/block.c +++ b/drivers/mtd/ubi/block.c | |||
@@ -323,16 +323,15 @@ static int ubiblock_queue_rq(struct blk_mq_hw_ctx *hctx, | |||
323 | struct ubiblock *dev = hctx->queue->queuedata; | 323 | struct ubiblock *dev = hctx->queue->queuedata; |
324 | struct ubiblock_pdu *pdu = blk_mq_rq_to_pdu(req); | 324 | struct ubiblock_pdu *pdu = blk_mq_rq_to_pdu(req); |
325 | 325 | ||
326 | if (req->cmd_type != REQ_TYPE_FS) | 326 | switch (req_op(req)) { |
327 | case REQ_OP_READ: | ||
328 | ubi_sgl_init(&pdu->usgl); | ||
329 | queue_work(dev->wq, &pdu->work); | ||
330 | return BLK_MQ_RQ_QUEUE_OK; | ||
331 | default: | ||
327 | return BLK_MQ_RQ_QUEUE_ERROR; | 332 | return BLK_MQ_RQ_QUEUE_ERROR; |
333 | } | ||
328 | 334 | ||
329 | if (rq_data_dir(req) != READ) | ||
330 | return BLK_MQ_RQ_QUEUE_ERROR; /* Write not implemented */ | ||
331 | |||
332 | ubi_sgl_init(&pdu->usgl); | ||
333 | queue_work(dev->wq, &pdu->work); | ||
334 | |||
335 | return BLK_MQ_RQ_QUEUE_OK; | ||
336 | } | 335 | } |
337 | 336 | ||
338 | static int ubiblock_init_request(void *data, struct request *req, | 337 | static int ubiblock_init_request(void *data, struct request *req, |
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 8a3c3e32a704..1640a5c8abbb 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c | |||
@@ -208,18 +208,18 @@ EXPORT_SYMBOL_GPL(nvme_requeue_req); | |||
208 | struct request *nvme_alloc_request(struct request_queue *q, | 208 | struct request *nvme_alloc_request(struct request_queue *q, |
209 | struct nvme_command *cmd, unsigned int flags, int qid) | 209 | struct nvme_command *cmd, unsigned int flags, int qid) |
210 | { | 210 | { |
211 | unsigned op = nvme_is_write(cmd) ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN; | ||
211 | struct request *req; | 212 | struct request *req; |
212 | 213 | ||
213 | if (qid == NVME_QID_ANY) { | 214 | if (qid == NVME_QID_ANY) { |
214 | req = blk_mq_alloc_request(q, nvme_is_write(cmd), flags); | 215 | req = blk_mq_alloc_request(q, op, flags); |
215 | } else { | 216 | } else { |
216 | req = blk_mq_alloc_request_hctx(q, nvme_is_write(cmd), flags, | 217 | req = blk_mq_alloc_request_hctx(q, op, flags, |
217 | qid ? qid - 1 : 0); | 218 | qid ? qid - 1 : 0); |
218 | } | 219 | } |
219 | if (IS_ERR(req)) | 220 | if (IS_ERR(req)) |
220 | return req; | 221 | return req; |
221 | 222 | ||
222 | req->cmd_type = REQ_TYPE_DRV_PRIV; | ||
223 | req->cmd_flags |= REQ_FAILFAST_DRIVER; | 223 | req->cmd_flags |= REQ_FAILFAST_DRIVER; |
224 | nvme_req(req)->cmd = cmd; | 224 | nvme_req(req)->cmd = cmd; |
225 | 225 | ||
@@ -309,17 +309,27 @@ int nvme_setup_cmd(struct nvme_ns *ns, struct request *req, | |||
309 | { | 309 | { |
310 | int ret = BLK_MQ_RQ_QUEUE_OK; | 310 | int ret = BLK_MQ_RQ_QUEUE_OK; |
311 | 311 | ||
312 | if (req->cmd_type == REQ_TYPE_DRV_PRIV) | 312 | switch (req_op(req)) { |
313 | case REQ_OP_DRV_IN: | ||
314 | case REQ_OP_DRV_OUT: | ||
313 | memcpy(cmd, nvme_req(req)->cmd, sizeof(*cmd)); | 315 | memcpy(cmd, nvme_req(req)->cmd, sizeof(*cmd)); |
314 | else if (req_op(req) == REQ_OP_FLUSH) | 316 | break; |
317 | case REQ_OP_FLUSH: | ||
315 | nvme_setup_flush(ns, cmd); | 318 | nvme_setup_flush(ns, cmd); |
316 | else if (req_op(req) == REQ_OP_DISCARD) | 319 | break; |
320 | case REQ_OP_DISCARD: | ||
317 | ret = nvme_setup_discard(ns, req, cmd); | 321 | ret = nvme_setup_discard(ns, req, cmd); |
318 | else | 322 | break; |
323 | case REQ_OP_READ: | ||
324 | case REQ_OP_WRITE: | ||
319 | nvme_setup_rw(ns, req, cmd); | 325 | nvme_setup_rw(ns, req, cmd); |
326 | break; | ||
327 | default: | ||
328 | WARN_ON_ONCE(1); | ||
329 | return BLK_MQ_RQ_QUEUE_ERROR; | ||
330 | } | ||
320 | 331 | ||
321 | cmd->common.command_id = req->tag; | 332 | cmd->common.command_id = req->tag; |
322 | |||
323 | return ret; | 333 | return ret; |
324 | } | 334 | } |
325 | EXPORT_SYMBOL_GPL(nvme_setup_cmd); | 335 | EXPORT_SYMBOL_GPL(nvme_setup_cmd); |
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index ecc79b2fcfaf..a75e95d42b3f 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c | |||
@@ -1471,7 +1471,7 @@ static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx, | |||
1471 | ib_dma_sync_single_for_device(dev, sqe->dma, | 1471 | ib_dma_sync_single_for_device(dev, sqe->dma, |
1472 | sizeof(struct nvme_command), DMA_TO_DEVICE); | 1472 | sizeof(struct nvme_command), DMA_TO_DEVICE); |
1473 | 1473 | ||
1474 | if (rq->cmd_type == REQ_TYPE_FS && req_op(rq) == REQ_OP_FLUSH) | 1474 | if (req_op(rq) == REQ_OP_FLUSH) |
1475 | flush = true; | 1475 | flush = true; |
1476 | ret = nvme_rdma_post_send(queue, sqe, req->sge, req->num_sge, | 1476 | ret = nvme_rdma_post_send(queue, sqe, req->sge, req->num_sge, |
1477 | req->mr->need_inval ? &req->reg_wr.wr : NULL, flush); | 1477 | req->mr->need_inval ? &req->reg_wr.wr : NULL, flush); |
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index fcb040eebf47..30b905080c61 100644 --- a/drivers/scsi/osd/osd_initiator.c +++ b/drivers/scsi/osd/osd_initiator.c | |||
@@ -1565,7 +1565,8 @@ static struct request *_make_request(struct request_queue *q, bool has_write, | |||
1565 | struct bio *bio = oii->bio; | 1565 | struct bio *bio = oii->bio; |
1566 | int ret; | 1566 | int ret; |
1567 | 1567 | ||
1568 | req = blk_get_request(q, has_write ? WRITE : READ, flags); | 1568 | req = blk_get_request(q, has_write ? REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, |
1569 | flags); | ||
1569 | if (IS_ERR(req)) | 1570 | if (IS_ERR(req)) |
1570 | return req; | 1571 | return req; |
1571 | scsi_req_init(req); | 1572 | scsi_req_init(req); |
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index d314aa5c71cf..451de6c5e3c9 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -367,7 +367,8 @@ static int osst_execute(struct osst_request *SRpnt, const unsigned char *cmd, | |||
367 | int err = 0; | 367 | int err = 0; |
368 | int write = (data_direction == DMA_TO_DEVICE); | 368 | int write = (data_direction == DMA_TO_DEVICE); |
369 | 369 | ||
370 | req = blk_get_request(SRpnt->stp->device->request_queue, write, GFP_KERNEL); | 370 | req = blk_get_request(SRpnt->stp->device->request_queue, |
371 | write ? REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, GFP_KERNEL); | ||
371 | if (IS_ERR(req)) | 372 | if (IS_ERR(req)) |
372 | return DRIVER_ERROR << 24; | 373 | return DRIVER_ERROR << 24; |
373 | 374 | ||
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index b4ce7bb5d2a9..9e82fa5715bc 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -1974,7 +1974,7 @@ static void scsi_eh_lock_door(struct scsi_device *sdev) | |||
1974 | * blk_get_request with GFP_KERNEL (__GFP_RECLAIM) sleeps until a | 1974 | * blk_get_request with GFP_KERNEL (__GFP_RECLAIM) sleeps until a |
1975 | * request becomes available | 1975 | * request becomes available |
1976 | */ | 1976 | */ |
1977 | req = blk_get_request(sdev->request_queue, READ, GFP_KERNEL); | 1977 | req = blk_get_request(sdev->request_queue, REQ_OP_SCSI_IN, GFP_KERNEL); |
1978 | if (IS_ERR(req)) | 1978 | if (IS_ERR(req)) |
1979 | return; | 1979 | return; |
1980 | rq = scsi_req(req); | 1980 | rq = scsi_req(req); |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 31629a7b728d..90f65c8f487a 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -219,11 +219,12 @@ static int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, | |||
219 | req_flags_t rq_flags, int *resid) | 219 | req_flags_t rq_flags, int *resid) |
220 | { | 220 | { |
221 | struct request *req; | 221 | struct request *req; |
222 | int write = (data_direction == DMA_TO_DEVICE); | ||
223 | struct scsi_request *rq; | 222 | struct scsi_request *rq; |
224 | int ret = DRIVER_ERROR << 24; | 223 | int ret = DRIVER_ERROR << 24; |
225 | 224 | ||
226 | req = blk_get_request(sdev->request_queue, write, __GFP_RECLAIM); | 225 | req = blk_get_request(sdev->request_queue, |
226 | data_direction == DMA_TO_DEVICE ? | ||
227 | REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, __GFP_RECLAIM); | ||
227 | if (IS_ERR(req)) | 228 | if (IS_ERR(req)) |
228 | return ret; | 229 | return ret; |
229 | rq = scsi_req(req); | 230 | rq = scsi_req(req); |
@@ -839,8 +840,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
839 | } | 840 | } |
840 | } else if (blk_rq_bytes(req) == 0 && result && !sense_deferred) { | 841 | } else if (blk_rq_bytes(req) == 0 && result && !sense_deferred) { |
841 | /* | 842 | /* |
842 | * Certain non BLOCK_PC requests are commands that don't | 843 | * Flush commands do not transfers any data, and thus cannot use |
843 | * actually transfer anything (FLUSH), so cannot use | ||
844 | * good_bytes != blk_rq_bytes(req) as the signal for an error. | 844 | * good_bytes != blk_rq_bytes(req) as the signal for an error. |
845 | * This sets the error explicitly for the problem case. | 845 | * This sets the error explicitly for the problem case. |
846 | */ | 846 | */ |
@@ -859,8 +859,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
859 | blk_rq_sectors(req), good_bytes)); | 859 | blk_rq_sectors(req), good_bytes)); |
860 | 860 | ||
861 | /* | 861 | /* |
862 | * Recovered errors need reporting, but they're always treated | 862 | * Recovered errors need reporting, but they're always treated as |
863 | * as success, so fiddle the result code here. For BLOCK_PC | 863 | * success, so fiddle the result code here. For passthrough requests |
864 | * we already took a copy of the original into rq->errors which | 864 | * we already took a copy of the original into rq->errors which |
865 | * is what gets returned to the user | 865 | * is what gets returned to the user |
866 | */ | 866 | */ |
@@ -874,7 +874,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
874 | else if (!(req->rq_flags & RQF_QUIET)) | 874 | else if (!(req->rq_flags & RQF_QUIET)) |
875 | scsi_print_sense(cmd); | 875 | scsi_print_sense(cmd); |
876 | result = 0; | 876 | result = 0; |
877 | /* BLOCK_PC may have set error */ | 877 | /* for passthrough error may be set */ |
878 | error = 0; | 878 | error = 0; |
879 | } | 879 | } |
880 | 880 | ||
@@ -1179,12 +1179,12 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd) | |||
1179 | spin_unlock_irqrestore(&dev->list_lock, flags); | 1179 | spin_unlock_irqrestore(&dev->list_lock, flags); |
1180 | } | 1180 | } |
1181 | 1181 | ||
1182 | static int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req) | 1182 | static int scsi_setup_scsi_cmnd(struct scsi_device *sdev, struct request *req) |
1183 | { | 1183 | { |
1184 | struct scsi_cmnd *cmd = req->special; | 1184 | struct scsi_cmnd *cmd = req->special; |
1185 | 1185 | ||
1186 | /* | 1186 | /* |
1187 | * BLOCK_PC requests may transfer data, in which case they must | 1187 | * Passthrough requests may transfer data, in which case they must |
1188 | * a bio attached to them. Or they might contain a SCSI command | 1188 | * a bio attached to them. Or they might contain a SCSI command |
1189 | * that does not transfer data, in which case they may optionally | 1189 | * that does not transfer data, in which case they may optionally |
1190 | * submit a request without an attached bio. | 1190 | * submit a request without an attached bio. |
@@ -1207,7 +1207,7 @@ static int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req) | |||
1207 | } | 1207 | } |
1208 | 1208 | ||
1209 | /* | 1209 | /* |
1210 | * Setup a REQ_TYPE_FS command. These are simple request from filesystems | 1210 | * Setup a normal block command. These are simple request from filesystems |
1211 | * that still need to be translated to SCSI CDBs from the ULD. | 1211 | * that still need to be translated to SCSI CDBs from the ULD. |
1212 | */ | 1212 | */ |
1213 | static int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req) | 1213 | static int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req) |
@@ -1236,14 +1236,10 @@ static int scsi_setup_cmnd(struct scsi_device *sdev, struct request *req) | |||
1236 | else | 1236 | else |
1237 | cmd->sc_data_direction = DMA_FROM_DEVICE; | 1237 | cmd->sc_data_direction = DMA_FROM_DEVICE; |
1238 | 1238 | ||
1239 | switch (req->cmd_type) { | 1239 | if (blk_rq_is_scsi(req)) |
1240 | case REQ_TYPE_FS: | 1240 | return scsi_setup_scsi_cmnd(sdev, req); |
1241 | else | ||
1241 | return scsi_setup_fs_cmnd(sdev, req); | 1242 | return scsi_setup_fs_cmnd(sdev, req); |
1242 | case REQ_TYPE_BLOCK_PC: | ||
1243 | return scsi_setup_blk_pc_cmnd(sdev, req); | ||
1244 | default: | ||
1245 | return BLKPREP_KILL; | ||
1246 | } | ||
1247 | } | 1243 | } |
1248 | 1244 | ||
1249 | static int | 1245 | static int |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 226a8def7a8b..e0e308b7e01a 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1698,7 +1698,8 @@ sg_start_req(Sg_request *srp, unsigned char *cmd) | |||
1698 | * With scsi-mq disabled, blk_get_request() with GFP_KERNEL usually | 1698 | * With scsi-mq disabled, blk_get_request() with GFP_KERNEL usually |
1699 | * does not sleep except under memory pressure. | 1699 | * does not sleep except under memory pressure. |
1700 | */ | 1700 | */ |
1701 | rq = blk_get_request(q, rw, GFP_KERNEL); | 1701 | rq = blk_get_request(q, hp->dxfer_direction == SG_DXFER_TO_DEV ? |
1702 | REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, GFP_KERNEL); | ||
1702 | if (IS_ERR(rq)) { | 1703 | if (IS_ERR(rq)) { |
1703 | kfree(long_cmdp); | 1704 | kfree(long_cmdp); |
1704 | return PTR_ERR(rq); | 1705 | return PTR_ERR(rq); |
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 94352e4df831..2e1d910092d8 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
@@ -437,14 +437,17 @@ static int sr_init_command(struct scsi_cmnd *SCpnt) | |||
437 | goto out; | 437 | goto out; |
438 | } | 438 | } |
439 | 439 | ||
440 | if (rq_data_dir(rq) == WRITE) { | 440 | switch (req_op(rq)) { |
441 | case REQ_OP_WRITE: | ||
441 | if (!cd->writeable) | 442 | if (!cd->writeable) |
442 | goto out; | 443 | goto out; |
443 | SCpnt->cmnd[0] = WRITE_10; | 444 | SCpnt->cmnd[0] = WRITE_10; |
444 | cd->cdi.media_written = 1; | 445 | cd->cdi.media_written = 1; |
445 | } else if (rq_data_dir(rq) == READ) { | 446 | break; |
447 | case REQ_OP_READ: | ||
446 | SCpnt->cmnd[0] = READ_10; | 448 | SCpnt->cmnd[0] = READ_10; |
447 | } else { | 449 | break; |
450 | default: | ||
448 | blk_dump_rq_flags(rq, "Unknown sr command"); | 451 | blk_dump_rq_flags(rq, "Unknown sr command"); |
449 | goto out; | 452 | goto out; |
450 | } | 453 | } |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 4af900100a24..81212d4bd9bf 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -541,11 +541,11 @@ static int st_scsi_execute(struct st_request *SRpnt, const unsigned char *cmd, | |||
541 | struct scsi_request *rq; | 541 | struct scsi_request *rq; |
542 | struct rq_map_data *mdata = &SRpnt->stp->buffer->map_data; | 542 | struct rq_map_data *mdata = &SRpnt->stp->buffer->map_data; |
543 | int err = 0; | 543 | int err = 0; |
544 | int write = (data_direction == DMA_TO_DEVICE); | ||
545 | struct scsi_tape *STp = SRpnt->stp; | 544 | struct scsi_tape *STp = SRpnt->stp; |
546 | 545 | ||
547 | req = blk_get_request(SRpnt->stp->device->request_queue, write, | 546 | req = blk_get_request(SRpnt->stp->device->request_queue, |
548 | GFP_KERNEL); | 547 | data_direction == DMA_TO_DEVICE ? |
548 | REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, GFP_KERNEL); | ||
549 | if (IS_ERR(req)) | 549 | if (IS_ERR(req)) |
550 | return DRIVER_ERROR << 24; | 550 | return DRIVER_ERROR << 24; |
551 | rq = scsi_req(req); | 551 | rq = scsi_req(req); |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index e52f4e1a4675..a8f8e53f2f57 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
@@ -1005,7 +1005,8 @@ pscsi_execute_cmd(struct se_cmd *cmd) | |||
1005 | scsi_command_size(cmd->t_task_cdb)); | 1005 | scsi_command_size(cmd->t_task_cdb)); |
1006 | 1006 | ||
1007 | req = blk_get_request(pdv->pdv_sd->request_queue, | 1007 | req = blk_get_request(pdv->pdv_sd->request_queue, |
1008 | (cmd->data_direction == DMA_TO_DEVICE), | 1008 | cmd->data_direction == DMA_TO_DEVICE ? |
1009 | REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, | ||
1009 | GFP_KERNEL); | 1010 | GFP_KERNEL); |
1010 | if (IS_ERR(req)) { | 1011 | if (IS_ERR(req)) { |
1011 | pr_err("PSCSI: blk_get_request() failed\n"); | 1012 | pr_err("PSCSI: blk_get_request() failed\n"); |