aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-barrier.c7
-rw-r--r--block/blk-core.c13
-rw-r--r--block/blk-exec.c2
-rw-r--r--block/blk-merge.c4
-rw-r--r--block/blk.h6
-rw-r--r--block/cfq-iosched.c19
-rw-r--r--block/elevator.c16
-rw-r--r--drivers/ata/libata-scsi.c2
-rw-r--r--drivers/block/cciss.c49
-rw-r--r--drivers/block/hd.c2
-rw-r--r--drivers/block/mg_disk.c4
-rw-r--r--drivers/block/nbd.c2
-rw-r--r--drivers/block/osdblk.c3
-rw-r--r--drivers/block/paride/pd.c2
-rw-r--r--drivers/block/ps3disk.c2
-rw-r--r--drivers/block/ub.c8
-rw-r--r--drivers/block/viodasd.c2
-rw-r--r--drivers/block/virtio_blk.c15
-rw-r--r--drivers/block/xd.c2
-rw-r--r--drivers/block/xen-blkfront.c4
-rw-r--r--drivers/block/xsysace.c2
-rw-r--r--drivers/cdrom/gdrom.c2
-rw-r--r--drivers/cdrom/viocd.c2
-rw-r--r--drivers/ide/ide-atapi.c17
-rw-r--r--drivers/ide/ide-cd.c66
-rw-r--r--drivers/ide/ide-disk.c2
-rw-r--r--drivers/ide/ide-eh.c5
-rw-r--r--drivers/ide/ide-floppy.c25
-rw-r--r--drivers/ide/ide-io.c8
-rw-r--r--drivers/ide/ide-pm.c8
-rw-r--r--drivers/ide/ide-tape.c3
-rw-r--r--drivers/md/dm.c10
-rw-r--r--drivers/memstick/core/mspro_block.c3
-rw-r--r--drivers/message/i2o/i2o_block.c2
-rw-r--r--drivers/mmc/card/queue.c2
-rw-r--r--drivers/mtd/mtd_blkdevs.c4
-rw-r--r--drivers/scsi/scsi_error.c10
-rw-r--r--drivers/scsi/scsi_lib.c5
-rw-r--r--drivers/scsi/sd.c12
-rw-r--r--drivers/scsi/sun3_NCR5380.c2
-rw-r--r--drivers/scsi/sun3_scsi.c2
-rw-r--r--drivers/scsi/sun3_scsi_vme.c2
-rw-r--r--drivers/staging/hv/blkvsc_drv.c8
-rw-r--r--include/linux/blkdev.h41
-rw-r--r--include/linux/blktrace_api.h2
-rw-r--r--include/trace/events/block.h15
-rw-r--r--kernel/trace/blktrace.c10
47 files changed, 236 insertions, 198 deletions
diff --git a/block/blk-barrier.c b/block/blk-barrier.c
index 0d710c9d403b..74e404393172 100644
--- a/block/blk-barrier.c
+++ b/block/blk-barrier.c
@@ -79,7 +79,7 @@ unsigned blk_ordered_req_seq(struct request *rq)
79 * 79 *
80 * http://thread.gmane.org/gmane.linux.kernel/537473 80 * http://thread.gmane.org/gmane.linux.kernel/537473
81 */ 81 */
82 if (!blk_fs_request(rq)) 82 if (rq->cmd_type != REQ_TYPE_FS)
83 return QUEUE_ORDSEQ_DRAIN; 83 return QUEUE_ORDSEQ_DRAIN;
84 84
85 if ((rq->cmd_flags & REQ_ORDERED_COLOR) == 85 if ((rq->cmd_flags & REQ_ORDERED_COLOR) ==
@@ -236,7 +236,8 @@ static inline bool start_ordered(struct request_queue *q, struct request **rqp)
236bool blk_do_ordered(struct request_queue *q, struct request **rqp) 236bool blk_do_ordered(struct request_queue *q, struct request **rqp)
237{ 237{
238 struct request *rq = *rqp; 238 struct request *rq = *rqp;
239 const int is_barrier = blk_fs_request(rq) && blk_barrier_rq(rq); 239 const int is_barrier = rq->cmd_type == REQ_TYPE_FS &&
240 (rq->cmd_flags & REQ_HARDBARRIER);
240 241
241 if (!q->ordseq) { 242 if (!q->ordseq) {
242 if (!is_barrier) 243 if (!is_barrier)
@@ -261,7 +262,7 @@ bool blk_do_ordered(struct request_queue *q, struct request **rqp)
261 */ 262 */
262 263
263 /* Special requests are not subject to ordering rules. */ 264 /* Special requests are not subject to ordering rules. */
264 if (!blk_fs_request(rq) && 265 if (rq->cmd_type != REQ_TYPE_FS &&
265 rq != &q->pre_flush_rq && rq != &q->post_flush_rq) 266 rq != &q->pre_flush_rq && rq != &q->post_flush_rq)
266 return true; 267 return true;
267 268
diff --git a/block/blk-core.c b/block/blk-core.c
index b4131d29148c..dca43a31e725 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -184,7 +184,7 @@ void blk_dump_rq_flags(struct request *rq, char *msg)
184 printk(KERN_INFO " bio %p, biotail %p, buffer %p, len %u\n", 184 printk(KERN_INFO " bio %p, biotail %p, buffer %p, len %u\n",
185 rq->bio, rq->biotail, rq->buffer, blk_rq_bytes(rq)); 185 rq->bio, rq->biotail, rq->buffer, blk_rq_bytes(rq));
186 186
187 if (blk_pc_request(rq)) { 187 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
188 printk(KERN_INFO " cdb: "); 188 printk(KERN_INFO " cdb: ");
189 for (bit = 0; bit < BLK_MAX_CDB; bit++) 189 for (bit = 0; bit < BLK_MAX_CDB; bit++)
190 printk("%02x ", rq->cmd[bit]); 190 printk("%02x ", rq->cmd[bit]);
@@ -1796,7 +1796,7 @@ struct request *blk_peek_request(struct request_queue *q)
1796 * sees this request (possibly after 1796 * sees this request (possibly after
1797 * requeueing). Notify IO scheduler. 1797 * requeueing). Notify IO scheduler.
1798 */ 1798 */
1799 if (blk_sorted_rq(rq)) 1799 if (rq->cmd_flags & REQ_SORTED)
1800 elv_activate_rq(q, rq); 1800 elv_activate_rq(q, rq);
1801 1801
1802 /* 1802 /*
@@ -1984,10 +1984,11 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
1984 * TODO: tj: This is too subtle. It would be better to let 1984 * TODO: tj: This is too subtle. It would be better to let
1985 * low level drivers do what they see fit. 1985 * low level drivers do what they see fit.
1986 */ 1986 */
1987 if (blk_fs_request(req)) 1987 if (req->cmd_type == REQ_TYPE_FS)
1988 req->errors = 0; 1988 req->errors = 0;
1989 1989
1990 if (error && (blk_fs_request(req) && !(req->cmd_flags & REQ_QUIET))) { 1990 if (error && req->cmd_type == REQ_TYPE_FS &&
1991 !(req->cmd_flags & REQ_QUIET)) {
1991 printk(KERN_ERR "end_request: I/O error, dev %s, sector %llu\n", 1992 printk(KERN_ERR "end_request: I/O error, dev %s, sector %llu\n",
1992 req->rq_disk ? req->rq_disk->disk_name : "?", 1993 req->rq_disk ? req->rq_disk->disk_name : "?",
1993 (unsigned long long)blk_rq_pos(req)); 1994 (unsigned long long)blk_rq_pos(req));
@@ -2074,7 +2075,7 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
2074 req->buffer = bio_data(req->bio); 2075 req->buffer = bio_data(req->bio);
2075 2076
2076 /* update sector only for requests with clear definition of sector */ 2077 /* update sector only for requests with clear definition of sector */
2077 if (blk_fs_request(req) || blk_discard_rq(req)) 2078 if (req->cmd_type == REQ_TYPE_FS || (req->cmd_flags & REQ_DISCARD))
2078 req->__sector += total_bytes >> 9; 2079 req->__sector += total_bytes >> 9;
2079 2080
2080 /* mixed attributes always follow the first bio */ 2081 /* mixed attributes always follow the first bio */
@@ -2127,7 +2128,7 @@ static void blk_finish_request(struct request *req, int error)
2127 2128
2128 BUG_ON(blk_queued_rq(req)); 2129 BUG_ON(blk_queued_rq(req));
2129 2130
2130 if (unlikely(laptop_mode) && blk_fs_request(req)) 2131 if (unlikely(laptop_mode) && req->cmd_type == REQ_TYPE_FS)
2131 laptop_io_completion(&req->q->backing_dev_info); 2132 laptop_io_completion(&req->q->backing_dev_info);
2132 2133
2133 blk_delete_timer(req); 2134 blk_delete_timer(req);
diff --git a/block/blk-exec.c b/block/blk-exec.c
index 49557e91f0da..e1672f14840e 100644
--- a/block/blk-exec.c
+++ b/block/blk-exec.c
@@ -57,7 +57,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
57 __elv_add_request(q, rq, where, 1); 57 __elv_add_request(q, rq, where, 1);
58 __generic_unplug_device(q); 58 __generic_unplug_device(q);
59 /* the queue is stopped so it won't be plugged+unplugged */ 59 /* the queue is stopped so it won't be plugged+unplugged */
60 if (blk_pm_resume_request(rq)) 60 if (rq->cmd_type == REQ_TYPE_PM_RESUME)
61 q->request_fn(q); 61 q->request_fn(q);
62 spin_unlock_irq(q->queue_lock); 62 spin_unlock_irq(q->queue_lock);
63} 63}
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 5e7dc9973458..87e4fb7d0e98 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -226,7 +226,7 @@ int ll_back_merge_fn(struct request_queue *q, struct request *req,
226{ 226{
227 unsigned short max_sectors; 227 unsigned short max_sectors;
228 228
229 if (unlikely(blk_pc_request(req))) 229 if (unlikely(req->cmd_type == REQ_TYPE_BLOCK_PC))
230 max_sectors = queue_max_hw_sectors(q); 230 max_sectors = queue_max_hw_sectors(q);
231 else 231 else
232 max_sectors = queue_max_sectors(q); 232 max_sectors = queue_max_sectors(q);
@@ -250,7 +250,7 @@ int ll_front_merge_fn(struct request_queue *q, struct request *req,
250{ 250{
251 unsigned short max_sectors; 251 unsigned short max_sectors;
252 252
253 if (unlikely(blk_pc_request(req))) 253 if (unlikely(req->cmd_type == REQ_TYPE_BLOCK_PC))
254 max_sectors = queue_max_hw_sectors(q); 254 max_sectors = queue_max_hw_sectors(q);
255 else 255 else
256 max_sectors = queue_max_sectors(q); 256 max_sectors = queue_max_sectors(q);
diff --git a/block/blk.h b/block/blk.h
index 5ee3d7e72feb..6e7dc87141e4 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -161,8 +161,10 @@ static inline int blk_cpu_to_group(int cpu)
161 */ 161 */
162static inline int blk_do_io_stat(struct request *rq) 162static inline int blk_do_io_stat(struct request *rq)
163{ 163{
164 return rq->rq_disk && blk_rq_io_stat(rq) && 164 return rq->rq_disk &&
165 (blk_fs_request(rq) || blk_discard_rq(rq)); 165 (rq->cmd_flags & REQ_IO_STAT) &&
166 (rq->cmd_type == REQ_TYPE_FS ||
167 (rq->cmd_flags & REQ_DISCARD));
166} 168}
167 169
168#endif 170#endif
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 7982b830db58..d4edeb8fceb8 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -646,9 +646,10 @@ cfq_choose_req(struct cfq_data *cfqd, struct request *rq1, struct request *rq2,
646 return rq1; 646 return rq1;
647 else if (rq_is_sync(rq2) && !rq_is_sync(rq1)) 647 else if (rq_is_sync(rq2) && !rq_is_sync(rq1))
648 return rq2; 648 return rq2;
649 if (rq_is_meta(rq1) && !rq_is_meta(rq2)) 649 if ((rq1->cmd_flags & REQ_RW_META) && !(rq2->cmd_flags & REQ_RW_META))
650 return rq1; 650 return rq1;
651 else if (rq_is_meta(rq2) && !rq_is_meta(rq1)) 651 else if ((rq2->cmd_flags & REQ_RW_META) &&
652 !(rq1->cmd_flags & REQ_RW_META))
652 return rq2; 653 return rq2;
653 654
654 s1 = blk_rq_pos(rq1); 655 s1 = blk_rq_pos(rq1);
@@ -1484,7 +1485,7 @@ static void cfq_remove_request(struct request *rq)
1484 cfqq->cfqd->rq_queued--; 1485 cfqq->cfqd->rq_queued--;
1485 cfq_blkiocg_update_io_remove_stats(&(RQ_CFQG(rq))->blkg, 1486 cfq_blkiocg_update_io_remove_stats(&(RQ_CFQG(rq))->blkg,
1486 rq_data_dir(rq), rq_is_sync(rq)); 1487 rq_data_dir(rq), rq_is_sync(rq));
1487 if (rq_is_meta(rq)) { 1488 if (rq->cmd_flags & REQ_RW_META) {
1488 WARN_ON(!cfqq->meta_pending); 1489 WARN_ON(!cfqq->meta_pending);
1489 cfqq->meta_pending--; 1490 cfqq->meta_pending--;
1490 } 1491 }
@@ -3176,7 +3177,7 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
3176 * So both queues are sync. Let the new request get disk time if 3177 * So both queues are sync. Let the new request get disk time if
3177 * it's a metadata request and the current queue is doing regular IO. 3178 * it's a metadata request and the current queue is doing regular IO.
3178 */ 3179 */
3179 if (rq_is_meta(rq) && !cfqq->meta_pending) 3180 if ((rq->cmd_flags & REQ_RW_META) && !cfqq->meta_pending)
3180 return true; 3181 return true;
3181 3182
3182 /* 3183 /*
@@ -3230,7 +3231,7 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
3230 struct cfq_io_context *cic = RQ_CIC(rq); 3231 struct cfq_io_context *cic = RQ_CIC(rq);
3231 3232
3232 cfqd->rq_queued++; 3233 cfqd->rq_queued++;
3233 if (rq_is_meta(rq)) 3234 if (rq->cmd_flags & REQ_RW_META)
3234 cfqq->meta_pending++; 3235 cfqq->meta_pending++;
3235 3236
3236 cfq_update_io_thinktime(cfqd, cic); 3237 cfq_update_io_thinktime(cfqd, cic);
@@ -3365,7 +3366,8 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq)
3365 unsigned long now; 3366 unsigned long now;
3366 3367
3367 now = jiffies; 3368 now = jiffies;
3368 cfq_log_cfqq(cfqd, cfqq, "complete rqnoidle %d", !!rq_noidle(rq)); 3369 cfq_log_cfqq(cfqd, cfqq, "complete rqnoidle %d",
3370 !!(rq->cmd_flags & REQ_NOIDLE));
3369 3371
3370 cfq_update_hw_tag(cfqd); 3372 cfq_update_hw_tag(cfqd);
3371 3373
@@ -3419,11 +3421,12 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq)
3419 cfq_slice_expired(cfqd, 1); 3421 cfq_slice_expired(cfqd, 1);
3420 else if (sync && cfqq_empty && 3422 else if (sync && cfqq_empty &&
3421 !cfq_close_cooperator(cfqd, cfqq)) { 3423 !cfq_close_cooperator(cfqd, cfqq)) {
3422 cfqd->noidle_tree_requires_idle |= !rq_noidle(rq); 3424 cfqd->noidle_tree_requires_idle |=
3425 !(rq->cmd_flags & REQ_NOIDLE);
3423 /* 3426 /*
3424 * Idling is enabled for SYNC_WORKLOAD. 3427 * Idling is enabled for SYNC_WORKLOAD.
3425 * SYNC_NOIDLE_WORKLOAD idles at the end of the tree 3428 * SYNC_NOIDLE_WORKLOAD idles at the end of the tree
3426 * only if we processed at least one !rq_noidle request 3429 * only if we processed at least one !REQ_NOIDLE request
3427 */ 3430 */
3428 if (cfqd->serving_type == SYNC_WORKLOAD 3431 if (cfqd->serving_type == SYNC_WORKLOAD
3429 || cfqd->noidle_tree_requires_idle 3432 || cfqd->noidle_tree_requires_idle
diff --git a/block/elevator.c b/block/elevator.c
index 923a9139106c..aa99b59c03d6 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -428,7 +428,8 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq)
428 list_for_each_prev(entry, &q->queue_head) { 428 list_for_each_prev(entry, &q->queue_head) {
429 struct request *pos = list_entry_rq(entry); 429 struct request *pos = list_entry_rq(entry);
430 430
431 if (blk_discard_rq(rq) != blk_discard_rq(pos)) 431 if ((rq->cmd_flags & REQ_DISCARD) !=
432 (pos->cmd_flags & REQ_DISCARD))
432 break; 433 break;
433 if (rq_data_dir(rq) != rq_data_dir(pos)) 434 if (rq_data_dir(rq) != rq_data_dir(pos))
434 break; 435 break;
@@ -558,7 +559,7 @@ void elv_requeue_request(struct request_queue *q, struct request *rq)
558 */ 559 */
559 if (blk_account_rq(rq)) { 560 if (blk_account_rq(rq)) {
560 q->in_flight[rq_is_sync(rq)]--; 561 q->in_flight[rq_is_sync(rq)]--;
561 if (blk_sorted_rq(rq)) 562 if (rq->cmd_flags & REQ_SORTED)
562 elv_deactivate_rq(q, rq); 563 elv_deactivate_rq(q, rq);
563 } 564 }
564 565
@@ -644,7 +645,8 @@ void elv_insert(struct request_queue *q, struct request *rq, int where)
644 break; 645 break;
645 646
646 case ELEVATOR_INSERT_SORT: 647 case ELEVATOR_INSERT_SORT:
647 BUG_ON(!blk_fs_request(rq) && !blk_discard_rq(rq)); 648 BUG_ON(rq->cmd_type != REQ_TYPE_FS &&
649 !(rq->cmd_flags & REQ_DISCARD));
648 rq->cmd_flags |= REQ_SORTED; 650 rq->cmd_flags |= REQ_SORTED;
649 q->nr_sorted++; 651 q->nr_sorted++;
650 if (rq_mergeable(rq)) { 652 if (rq_mergeable(rq)) {
@@ -716,7 +718,7 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where,
716 /* 718 /*
717 * toggle ordered color 719 * toggle ordered color
718 */ 720 */
719 if (blk_barrier_rq(rq)) 721 if (rq->cmd_flags & REQ_HARDBARRIER)
720 q->ordcolor ^= 1; 722 q->ordcolor ^= 1;
721 723
722 /* 724 /*
@@ -729,7 +731,8 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where,
729 * this request is scheduling boundary, update 731 * this request is scheduling boundary, update
730 * end_sector 732 * end_sector
731 */ 733 */
732 if (blk_fs_request(rq) || blk_discard_rq(rq)) { 734 if (rq->cmd_type == REQ_TYPE_FS ||
735 (rq->cmd_flags & REQ_DISCARD)) {
733 q->end_sector = rq_end_sector(rq); 736 q->end_sector = rq_end_sector(rq);
734 q->boundary_rq = rq; 737 q->boundary_rq = rq;
735 } 738 }
@@ -843,7 +846,8 @@ void elv_completed_request(struct request_queue *q, struct request *rq)
843 */ 846 */
844 if (blk_account_rq(rq)) { 847 if (blk_account_rq(rq)) {
845 q->in_flight[rq_is_sync(rq)]--; 848 q->in_flight[rq_is_sync(rq)]--;
846 if (blk_sorted_rq(rq) && e->ops->elevator_completed_req_fn) 849 if ((rq->cmd_flags & REQ_SORTED) &&
850 e->ops->elevator_completed_req_fn)
847 e->ops->elevator_completed_req_fn(q, rq); 851 e->ops->elevator_completed_req_fn(q, rq);
848 } 852 }
849 853
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index a54273d2c3c6..a5c08b082edb 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1111,7 +1111,7 @@ static void ata_scsi_sdev_config(struct scsi_device *sdev)
1111 */ 1111 */
1112static int atapi_drain_needed(struct request *rq) 1112static int atapi_drain_needed(struct request *rq)
1113{ 1113{
1114 if (likely(!blk_pc_request(rq))) 1114 if (likely(rq->cmd_type != REQ_TYPE_BLOCK_PC))
1115 return 0; 1115 return 0;
1116 1116
1117 if (!blk_rq_bytes(rq) || (rq->cmd_flags & REQ_RW)) 1117 if (!blk_rq_bytes(rq) || (rq->cmd_flags & REQ_RW))
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 10a0268a1f92..11b377762b8e 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1783,7 +1783,7 @@ static void cciss_softirq_done(struct request *rq)
1783#endif /* CCISS_DEBUG */ 1783#endif /* CCISS_DEBUG */
1784 1784
1785 /* set the residual count for pc requests */ 1785 /* set the residual count for pc requests */
1786 if (blk_pc_request(rq)) 1786 if (rq->cmd_type == REQ_TYPE_BLOCK_PC)
1787 rq->resid_len = cmd->err_info->ResidualCnt; 1787 rq->resid_len = cmd->err_info->ResidualCnt;
1788 1788
1789 blk_end_request_all(rq, (rq->errors == 0) ? 0 : -EIO); 1789 blk_end_request_all(rq, (rq->errors == 0) ? 0 : -EIO);
@@ -2983,7 +2983,7 @@ static inline int evaluate_target_status(ctlr_info_t *h,
2983 driver_byte = DRIVER_OK; 2983 driver_byte = DRIVER_OK;
2984 msg_byte = cmd->err_info->CommandStatus; /* correct? seems too device specific */ 2984 msg_byte = cmd->err_info->CommandStatus; /* correct? seems too device specific */
2985 2985
2986 if (blk_pc_request(cmd->rq)) 2986 if (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC)
2987 host_byte = DID_PASSTHROUGH; 2987 host_byte = DID_PASSTHROUGH;
2988 else 2988 else
2989 host_byte = DID_OK; 2989 host_byte = DID_OK;
@@ -2992,7 +2992,7 @@ static inline int evaluate_target_status(ctlr_info_t *h,
2992 host_byte, driver_byte); 2992 host_byte, driver_byte);
2993 2993
2994 if (cmd->err_info->ScsiStatus != SAM_STAT_CHECK_CONDITION) { 2994 if (cmd->err_info->ScsiStatus != SAM_STAT_CHECK_CONDITION) {
2995 if (!blk_pc_request(cmd->rq)) 2995 if (cmd->rq->cmd_type != REQ_TYPE_BLOCK_PC)
2996 printk(KERN_WARNING "cciss: cmd %p " 2996 printk(KERN_WARNING "cciss: cmd %p "
2997 "has SCSI Status 0x%x\n", 2997 "has SCSI Status 0x%x\n",
2998 cmd, cmd->err_info->ScsiStatus); 2998 cmd, cmd->err_info->ScsiStatus);
@@ -3002,15 +3002,17 @@ static inline int evaluate_target_status(ctlr_info_t *h,
3002 /* check the sense key */ 3002 /* check the sense key */
3003 sense_key = 0xf & cmd->err_info->SenseInfo[2]; 3003 sense_key = 0xf & cmd->err_info->SenseInfo[2];
3004 /* no status or recovered error */ 3004 /* no status or recovered error */
3005 if (((sense_key == 0x0) || (sense_key == 0x1)) && !blk_pc_request(cmd->rq)) 3005 if (((sense_key == 0x0) || (sense_key == 0x1)) &&
3006 (cmd->rq->cmd_type != REQ_TYPE_BLOCK_PC))
3006 error_value = 0; 3007 error_value = 0;
3007 3008
3008 if (check_for_unit_attention(h, cmd)) { 3009 if (check_for_unit_attention(h, cmd)) {
3009 *retry_cmd = !blk_pc_request(cmd->rq); 3010 *retry_cmd = !(cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC);
3010 return 0; 3011 return 0;
3011 } 3012 }
3012 3013
3013 if (!blk_pc_request(cmd->rq)) { /* Not SG_IO or similar? */ 3014 /* Not SG_IO or similar? */
3015 if (cmd->rq->cmd_type != REQ_TYPE_BLOCK_PC) {
3014 if (error_value != 0) 3016 if (error_value != 0)
3015 printk(KERN_WARNING "cciss: cmd %p has CHECK CONDITION" 3017 printk(KERN_WARNING "cciss: cmd %p has CHECK CONDITION"
3016 " sense key = 0x%x\n", cmd, sense_key); 3018 " sense key = 0x%x\n", cmd, sense_key);
@@ -3052,7 +3054,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3052 rq->errors = evaluate_target_status(h, cmd, &retry_cmd); 3054 rq->errors = evaluate_target_status(h, cmd, &retry_cmd);
3053 break; 3055 break;
3054 case CMD_DATA_UNDERRUN: 3056 case CMD_DATA_UNDERRUN:
3055 if (blk_fs_request(cmd->rq)) { 3057 if (cmd->rq->cmd_type == REQ_TYPE_FS) {
3056 printk(KERN_WARNING "cciss: cmd %p has" 3058 printk(KERN_WARNING "cciss: cmd %p has"
3057 " completed with data underrun " 3059 " completed with data underrun "
3058 "reported\n", cmd); 3060 "reported\n", cmd);
@@ -3060,7 +3062,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3060 } 3062 }
3061 break; 3063 break;
3062 case CMD_DATA_OVERRUN: 3064 case CMD_DATA_OVERRUN:
3063 if (blk_fs_request(cmd->rq)) 3065 if (cmd->rq->cmd_type == REQ_TYPE_FS)
3064 printk(KERN_WARNING "cciss: cmd %p has" 3066 printk(KERN_WARNING "cciss: cmd %p has"
3065 " completed with data overrun " 3067 " completed with data overrun "
3066 "reported\n", cmd); 3068 "reported\n", cmd);
@@ -3070,42 +3072,48 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3070 "reported invalid\n", cmd); 3072 "reported invalid\n", cmd);
3071 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3073 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3072 cmd->err_info->CommandStatus, DRIVER_OK, 3074 cmd->err_info->CommandStatus, DRIVER_OK,
3073 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); 3075 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3076 DID_PASSTHROUGH : DID_ERROR);
3074 break; 3077 break;
3075 case CMD_PROTOCOL_ERR: 3078 case CMD_PROTOCOL_ERR:
3076 printk(KERN_WARNING "cciss: cmd %p has " 3079 printk(KERN_WARNING "cciss: cmd %p has "
3077 "protocol error \n", cmd); 3080 "protocol error \n", cmd);
3078 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3081 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3079 cmd->err_info->CommandStatus, DRIVER_OK, 3082 cmd->err_info->CommandStatus, DRIVER_OK,
3080 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); 3083 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3084 DID_PASSTHROUGH : DID_ERROR);
3081 break; 3085 break;
3082 case CMD_HARDWARE_ERR: 3086 case CMD_HARDWARE_ERR:
3083 printk(KERN_WARNING "cciss: cmd %p had " 3087 printk(KERN_WARNING "cciss: cmd %p had "
3084 " hardware error\n", cmd); 3088 " hardware error\n", cmd);
3085 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3089 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3086 cmd->err_info->CommandStatus, DRIVER_OK, 3090 cmd->err_info->CommandStatus, DRIVER_OK,
3087 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); 3091 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3092 DID_PASSTHROUGH : DID_ERROR);
3088 break; 3093 break;
3089 case CMD_CONNECTION_LOST: 3094 case CMD_CONNECTION_LOST:
3090 printk(KERN_WARNING "cciss: cmd %p had " 3095 printk(KERN_WARNING "cciss: cmd %p had "
3091 "connection lost\n", cmd); 3096 "connection lost\n", cmd);
3092 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3097 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3093 cmd->err_info->CommandStatus, DRIVER_OK, 3098 cmd->err_info->CommandStatus, DRIVER_OK,
3094 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); 3099 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3100 DID_PASSTHROUGH : DID_ERROR);
3095 break; 3101 break;
3096 case CMD_ABORTED: 3102 case CMD_ABORTED:
3097 printk(KERN_WARNING "cciss: cmd %p was " 3103 printk(KERN_WARNING "cciss: cmd %p was "
3098 "aborted\n", cmd); 3104 "aborted\n", cmd);
3099 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3105 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3100 cmd->err_info->CommandStatus, DRIVER_OK, 3106 cmd->err_info->CommandStatus, DRIVER_OK,
3101 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ABORT); 3107 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3108 DID_PASSTHROUGH : DID_ABORT);
3102 break; 3109 break;
3103 case CMD_ABORT_FAILED: 3110 case CMD_ABORT_FAILED:
3104 printk(KERN_WARNING "cciss: cmd %p reports " 3111 printk(KERN_WARNING "cciss: cmd %p reports "
3105 "abort failed\n", cmd); 3112 "abort failed\n", cmd);
3106 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3113 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3107 cmd->err_info->CommandStatus, DRIVER_OK, 3114 cmd->err_info->CommandStatus, DRIVER_OK,
3108 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); 3115 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3116 DID_PASSTHROUGH : DID_ERROR);
3109 break; 3117 break;
3110 case CMD_UNSOLICITED_ABORT: 3118 case CMD_UNSOLICITED_ABORT:
3111 printk(KERN_WARNING "cciss%d: unsolicited " 3119 printk(KERN_WARNING "cciss%d: unsolicited "
@@ -3121,13 +3129,15 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3121 "many times\n", h->ctlr, cmd); 3129 "many times\n", h->ctlr, cmd);
3122 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3130 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3123 cmd->err_info->CommandStatus, DRIVER_OK, 3131 cmd->err_info->CommandStatus, DRIVER_OK,
3124 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ABORT); 3132 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3133 DID_PASSTHROUGH : DID_ABORT);
3125 break; 3134 break;
3126 case CMD_TIMEOUT: 3135 case CMD_TIMEOUT:
3127 printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd); 3136 printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd);
3128 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3137 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3129 cmd->err_info->CommandStatus, DRIVER_OK, 3138 cmd->err_info->CommandStatus, DRIVER_OK,
3130 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); 3139 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3140 DID_PASSTHROUGH : DID_ERROR);
3131 break; 3141 break;
3132 default: 3142 default:
3133 printk(KERN_WARNING "cciss: cmd %p returned " 3143 printk(KERN_WARNING "cciss: cmd %p returned "
@@ -3135,7 +3145,8 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
3135 cmd->err_info->CommandStatus); 3145 cmd->err_info->CommandStatus);
3136 rq->errors = make_status_bytes(SAM_STAT_GOOD, 3146 rq->errors = make_status_bytes(SAM_STAT_GOOD,
3137 cmd->err_info->CommandStatus, DRIVER_OK, 3147 cmd->err_info->CommandStatus, DRIVER_OK,
3138 blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); 3148 (cmd->rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
3149 DID_PASSTHROUGH : DID_ERROR);
3139 } 3150 }
3140 3151
3141after_error_processing: 3152after_error_processing:
@@ -3294,7 +3305,7 @@ static void do_cciss_request(struct request_queue *q)
3294 c->Header.SGList = h->max_cmd_sgentries; 3305 c->Header.SGList = h->max_cmd_sgentries;
3295 set_performant_mode(h, c); 3306 set_performant_mode(h, c);
3296 3307
3297 if (likely(blk_fs_request(creq))) { 3308 if (likely(creq->cmd_type == REQ_TYPE_FS)) {
3298 if(h->cciss_read == CCISS_READ_10) { 3309 if(h->cciss_read == CCISS_READ_10) {
3299 c->Request.CDB[1] = 0; 3310 c->Request.CDB[1] = 0;
3300 c->Request.CDB[2] = (start_blk >> 24) & 0xff; /* MSB */ 3311 c->Request.CDB[2] = (start_blk >> 24) & 0xff; /* MSB */
@@ -3324,7 +3335,7 @@ static void do_cciss_request(struct request_queue *q)
3324 c->Request.CDB[13]= blk_rq_sectors(creq) & 0xff; 3335 c->Request.CDB[13]= blk_rq_sectors(creq) & 0xff;
3325 c->Request.CDB[14] = c->Request.CDB[15] = 0; 3336 c->Request.CDB[14] = c->Request.CDB[15] = 0;
3326 } 3337 }
3327 } else if (blk_pc_request(creq)) { 3338 } else if (creq->cmd_type == REQ_TYPE_BLOCK_PC) {
3328 c->Request.CDBLen = creq->cmd_len; 3339 c->Request.CDBLen = creq->cmd_len;
3329 memcpy(c->Request.CDB, creq->cmd, BLK_MAX_CDB); 3340 memcpy(c->Request.CDB, creq->cmd, BLK_MAX_CDB);
3330 } else { 3341 } else {
diff --git a/drivers/block/hd.c b/drivers/block/hd.c
index 81c78b3ce2df..30ec6b37424e 100644
--- a/drivers/block/hd.c
+++ b/drivers/block/hd.c
@@ -627,7 +627,7 @@ repeat:
627 req_data_dir(req) == READ ? "read" : "writ", 627 req_data_dir(req) == READ ? "read" : "writ",
628 cyl, head, sec, nsect, req->buffer); 628 cyl, head, sec, nsect, req->buffer);
629#endif 629#endif
630 if (blk_fs_request(req)) { 630 if (req->cmd_type == REQ_TYPE_FS) {
631 switch (rq_data_dir(req)) { 631 switch (rq_data_dir(req)) {
632 case READ: 632 case READ:
633 hd_out(disk, nsect, sec, head, cyl, ATA_CMD_PIO_READ, 633 hd_out(disk, nsect, sec, head, cyl, ATA_CMD_PIO_READ,
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index 28db925dbdad..b82c5ce5e9df 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -670,7 +670,7 @@ static void mg_request_poll(struct request_queue *q)
670 break; 670 break;
671 } 671 }
672 672
673 if (unlikely(!blk_fs_request(host->req))) { 673 if (unlikely(host->req->cmd_type != REQ_TYPE_FS)) {
674 mg_end_request_cur(host, -EIO); 674 mg_end_request_cur(host, -EIO);
675 continue; 675 continue;
676 } 676 }
@@ -756,7 +756,7 @@ static void mg_request(struct request_queue *q)
756 continue; 756 continue;
757 } 757 }
758 758
759 if (unlikely(!blk_fs_request(req))) { 759 if (unlikely(req->cmd_type != REQ_TYPE_FS)) {
760 mg_end_request_cur(host, -EIO); 760 mg_end_request_cur(host, -EIO);
761 continue; 761 continue;
762 } 762 }
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 218d091f3c52..2e74e7d475ca 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -448,7 +448,7 @@ static void nbd_clear_que(struct nbd_device *lo)
448 448
449static void nbd_handle_req(struct nbd_device *lo, struct request *req) 449static void nbd_handle_req(struct nbd_device *lo, struct request *req)
450{ 450{
451 if (!blk_fs_request(req)) 451 if (req->cmd_type != REQ_TYPE_FS)
452 goto error_out; 452 goto error_out;
453 453
454 nbd_cmd(req) = NBD_CMD_READ; 454 nbd_cmd(req) = NBD_CMD_READ;
diff --git a/drivers/block/osdblk.c b/drivers/block/osdblk.c
index 6cd8b705b11b..819002ba3433 100644
--- a/drivers/block/osdblk.c
+++ b/drivers/block/osdblk.c
@@ -310,7 +310,8 @@ static void osdblk_rq_fn(struct request_queue *q)
310 break; 310 break;
311 311
312 /* filter out block requests we don't understand */ 312 /* filter out block requests we don't understand */
313 if (!blk_fs_request(rq) && !blk_barrier_rq(rq)) { 313 if (rq->cmd_type != REQ_TYPE_FS &&
314 !(rq->cmd_flags & REQ_HARDBARRIER)) {
314 blk_end_request_all(rq, 0); 315 blk_end_request_all(rq, 0);
315 continue; 316 continue;
316 } 317 }
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index c1e5cd029b23..4e8b9bff3abe 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -439,7 +439,7 @@ static char *pd_buf; /* buffer for request in progress */
439 439
440static enum action do_pd_io_start(void) 440static enum action do_pd_io_start(void)
441{ 441{
442 if (blk_special_request(pd_req)) { 442 if (pd_req->cmd_type == REQ_TYPE_SPECIAL) {
443 phase = pd_special; 443 phase = pd_special;
444 return pd_special(); 444 return pd_special();
445 } 445 }
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index 3b419e3fffa1..5f208c0bf156 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -196,7 +196,7 @@ 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 (blk_fs_request(req)) { 199 if (req->cmd_type == REQ_TYPE_FS) {
200 if (ps3disk_submit_request_sg(dev, req)) 200 if (ps3disk_submit_request_sg(dev, req))
201 break; 201 break;
202 } else if (req->cmd_type == REQ_TYPE_LINUX_BLOCK && 202 } else if (req->cmd_type == REQ_TYPE_LINUX_BLOCK &&
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 0536b5b29adc..034b34440ffa 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -648,7 +648,7 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq)
648 return 0; 648 return 0;
649 } 649 }
650 650
651 if (lun->changed && !blk_pc_request(rq)) { 651 if (lun->changed && rq->cmd_type != REQ_TYPE_BLOCK_PC)
652 blk_start_request(rq); 652 blk_start_request(rq);
653 ub_end_rq(rq, SAM_STAT_CHECK_CONDITION); 653 ub_end_rq(rq, SAM_STAT_CHECK_CONDITION);
654 return 0; 654 return 0;
@@ -684,7 +684,7 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq)
684 } 684 }
685 urq->nsg = n_elem; 685 urq->nsg = n_elem;
686 686
687 if (blk_pc_request(rq)) { 687 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
688 ub_cmd_build_packet(sc, lun, cmd, urq); 688 ub_cmd_build_packet(sc, lun, cmd, urq);
689 } else { 689 } else {
690 ub_cmd_build_block(sc, lun, cmd, urq); 690 ub_cmd_build_block(sc, lun, cmd, urq);
@@ -781,7 +781,7 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
781 rq = urq->rq; 781 rq = urq->rq;
782 782
783 if (cmd->error == 0) { 783 if (cmd->error == 0) {
784 if (blk_pc_request(rq)) { 784 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
785 if (cmd->act_len >= rq->resid_len) 785 if (cmd->act_len >= rq->resid_len)
786 rq->resid_len = 0; 786 rq->resid_len = 0;
787 else 787 else
@@ -795,7 +795,7 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
795 } 795 }
796 } 796 }
797 } else { 797 } else {
798 if (blk_pc_request(rq)) { 798 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
799 /* UB_SENSE_SIZE is smaller than SCSI_SENSE_BUFFERSIZE */ 799 /* UB_SENSE_SIZE is smaller than SCSI_SENSE_BUFFERSIZE */
800 memcpy(rq->sense, sc->top_sense, UB_SENSE_SIZE); 800 memcpy(rq->sense, sc->top_sense, UB_SENSE_SIZE);
801 rq->sense_len = UB_SENSE_SIZE; 801 rq->sense_len = UB_SENSE_SIZE;
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index 788d93882ab9..5663d3c284c8 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -361,7 +361,7 @@ static void do_viodasd_request(struct request_queue *q)
361 if (req == NULL) 361 if (req == NULL)
362 return; 362 return;
363 /* check that request contains a valid command */ 363 /* check that request contains a valid command */
364 if (!blk_fs_request(req)) { 364 if (req->cmd_type != REQ_TYPE_FS) {
365 viodasd_end_request(req, -EIO, blk_rq_sectors(req)); 365 viodasd_end_request(req, -EIO, blk_rq_sectors(req));
366 continue; 366 continue;
367 } 367 }
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 258bc2ae2885..774144334ece 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -65,13 +65,16 @@ static void blk_done(struct virtqueue *vq)
65 break; 65 break;
66 } 66 }
67 67
68 if (blk_pc_request(vbr->req)) { 68 switch (vbr->req->cmd_type) {
69 case REQ_TYPE_BLOCK_PC:
69 vbr->req->resid_len = vbr->in_hdr.residual; 70 vbr->req->resid_len = vbr->in_hdr.residual;
70 vbr->req->sense_len = vbr->in_hdr.sense_len; 71 vbr->req->sense_len = vbr->in_hdr.sense_len;
71 vbr->req->errors = vbr->in_hdr.errors; 72 vbr->req->errors = vbr->in_hdr.errors;
72 } 73 break;
73 if (blk_special_request(vbr->req)) 74 case REQ_TYPE_SPECIAL:
74 vbr->req->errors = (error != 0); 75 vbr->req->errors = (error != 0);
76 break;
77 }
75 78
76 __blk_end_request_all(vbr->req, error); 79 __blk_end_request_all(vbr->req, error);
77 list_del(&vbr->list); 80 list_del(&vbr->list);
@@ -123,7 +126,7 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
123 BUG(); 126 BUG();
124 } 127 }
125 128
126 if (blk_barrier_rq(vbr->req)) 129 if (vbr->req->cmd_flags & REQ_HARDBARRIER)
127 vbr->out_hdr.type |= VIRTIO_BLK_T_BARRIER; 130 vbr->out_hdr.type |= VIRTIO_BLK_T_BARRIER;
128 131
129 sg_set_buf(&vblk->sg[out++], &vbr->out_hdr, sizeof(vbr->out_hdr)); 132 sg_set_buf(&vblk->sg[out++], &vbr->out_hdr, sizeof(vbr->out_hdr));
@@ -134,12 +137,12 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
134 * block, and before the normal inhdr we put the sense data and the 137 * block, and before the normal inhdr we put the sense data and the
135 * inhdr with additional status information before the normal inhdr. 138 * inhdr with additional status information before the normal inhdr.
136 */ 139 */
137 if (blk_pc_request(vbr->req)) 140 if (vbr->req->cmd_type == REQ_TYPE_BLOCK_PC)
138 sg_set_buf(&vblk->sg[out++], vbr->req->cmd, vbr->req->cmd_len); 141 sg_set_buf(&vblk->sg[out++], vbr->req->cmd, vbr->req->cmd_len);
139 142
140 num = blk_rq_map_sg(q, vbr->req, vblk->sg + out); 143 num = blk_rq_map_sg(q, vbr->req, vblk->sg + out);
141 144
142 if (blk_pc_request(vbr->req)) { 145 if (vbr->req->cmd_type == REQ_TYPE_BLOCK_PC) {
143 sg_set_buf(&vblk->sg[num + out + in++], vbr->req->sense, 96); 146 sg_set_buf(&vblk->sg[num + out + in++], vbr->req->sense, 96);
144 sg_set_buf(&vblk->sg[num + out + in++], &vbr->in_hdr, 147 sg_set_buf(&vblk->sg[num + out + in++], &vbr->in_hdr,
145 sizeof(vbr->in_hdr)); 148 sizeof(vbr->in_hdr));
diff --git a/drivers/block/xd.c b/drivers/block/xd.c
index 18a80ff57ce8..4dc298376098 100644
--- a/drivers/block/xd.c
+++ b/drivers/block/xd.c
@@ -322,7 +322,7 @@ static void do_xd_request (struct request_queue * q)
322 int res = -EIO; 322 int res = -EIO;
323 int retry; 323 int retry;
324 324
325 if (!blk_fs_request(req)) 325 if (req->cmd_type != REQ_TYPE_FS) {
326 goto done; 326 goto done;
327 if (block + count > get_capacity(req->rq_disk)) 327 if (block + count > get_capacity(req->rq_disk))
328 goto done; 328 goto done;
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 82ed403147c0..495533e66542 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -238,7 +238,7 @@ static int blkif_queue_request(struct request *req)
238 238
239 ring_req->operation = rq_data_dir(req) ? 239 ring_req->operation = rq_data_dir(req) ?
240 BLKIF_OP_WRITE : BLKIF_OP_READ; 240 BLKIF_OP_WRITE : BLKIF_OP_READ;
241 if (blk_barrier_rq(req)) 241 if (req->cmd_flags & REQ_HARDBARRIER)
242 ring_req->operation = BLKIF_OP_WRITE_BARRIER; 242 ring_req->operation = BLKIF_OP_WRITE_BARRIER;
243 243
244 ring_req->nr_segments = blk_rq_map_sg(req->q, req, info->sg); 244 ring_req->nr_segments = blk_rq_map_sg(req->q, req, info->sg);
@@ -309,7 +309,7 @@ static void do_blkif_request(struct request_queue *rq)
309 309
310 blk_start_request(req); 310 blk_start_request(req);
311 311
312 if (!blk_fs_request(req)) { 312 if (req->cmd_type != REQ_TYPE_FS) {
313 __blk_end_request_all(req, -EIO); 313 __blk_end_request_all(req, -EIO);
314 continue; 314 continue;
315 } 315 }
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index a7b83c0a7eb5..ac278ac908d5 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -465,7 +465,7 @@ struct request *ace_get_next_request(struct request_queue * q)
465 struct request *req; 465 struct request *req;
466 466
467 while ((req = blk_peek_request(q)) != NULL) { 467 while ((req = blk_peek_request(q)) != NULL) {
468 if (blk_fs_request(req)) 468 if (req->cmd_type == REQ_TYPE_FS)
469 break; 469 break;
470 blk_start_request(req); 470 blk_start_request(req);
471 __blk_end_request_all(req, -EIO); 471 __blk_end_request_all(req, -EIO);
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index 03c71f7698cb..7c05ddc63ae8 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -643,7 +643,7 @@ static void gdrom_request(struct request_queue *rq)
643 struct request *req; 643 struct request *req;
644 644
645 while ((req = blk_fetch_request(rq)) != NULL) { 645 while ((req = blk_fetch_request(rq)) != NULL) {
646 if (!blk_fs_request(req)) { 646 if (req->cmd_type != REQ_TYPE_FS) {
647 printk(KERN_DEBUG "GDROM: Non-fs request ignored\n"); 647 printk(KERN_DEBUG "GDROM: Non-fs request ignored\n");
648 __blk_end_request_all(req, -EIO); 648 __blk_end_request_all(req, -EIO);
649 continue; 649 continue;
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index 451cd7071b1d..14e420168764 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -298,7 +298,7 @@ static void do_viocd_request(struct request_queue *q)
298 struct request *req; 298 struct request *req;
299 299
300 while ((rwreq == 0) && ((req = blk_fetch_request(q)) != NULL)) { 300 while ((rwreq == 0) && ((req = blk_fetch_request(q)) != NULL)) {
301 if (!blk_fs_request(req)) 301 if (req->cmd_type != REQ_TYPE_FS)
302 __blk_end_request_all(req, -EIO); 302 __blk_end_request_all(req, -EIO);
303 else if (send_request(req) < 0) { 303 else if (send_request(req) < 0) {
304 printk(VIOCD_KERN_WARNING 304 printk(VIOCD_KERN_WARNING
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index f9daffd7d0e3..3117a894d20e 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -190,7 +190,7 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq)
190 190
191 BUG_ON(sense_len > sizeof(*sense)); 191 BUG_ON(sense_len > sizeof(*sense));
192 192
193 if (blk_sense_request(rq) || drive->sense_rq_armed) 193 if (rq->cmd_type == REQ_TYPE_SENSE || drive->sense_rq_armed)
194 return; 194 return;
195 195
196 memset(sense, 0, sizeof(*sense)); 196 memset(sense, 0, sizeof(*sense));
@@ -307,13 +307,16 @@ EXPORT_SYMBOL_GPL(ide_cd_expiry);
307 307
308int ide_cd_get_xferlen(struct request *rq) 308int ide_cd_get_xferlen(struct request *rq)
309{ 309{
310 if (blk_fs_request(rq)) 310 switch (rq->cmd_type)
311 case REQ_TYPE_FS:
311 return 32768; 312 return 32768;
312 else if (blk_sense_request(rq) || blk_pc_request(rq) || 313 case REQ_TYPE_SENSE:
313 rq->cmd_type == REQ_TYPE_ATA_PC) 314 case REQ_TYPE_BLOCK_PC:
315 case REQ_TYPE_ATA_PC:
314 return blk_rq_bytes(rq); 316 return blk_rq_bytes(rq);
315 else 317 default:
316 return 0; 318 return 0;
319 }
317} 320}
318EXPORT_SYMBOL_GPL(ide_cd_get_xferlen); 321EXPORT_SYMBOL_GPL(ide_cd_get_xferlen);
319 322
@@ -474,12 +477,12 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
474 if (uptodate == 0) 477 if (uptodate == 0)
475 drive->failed_pc = NULL; 478 drive->failed_pc = NULL;
476 479
477 if (blk_special_request(rq)) { 480 if (rq->cmd_type == REQ_TYPE_SPECIAL)
478 rq->errors = 0; 481 rq->errors = 0;
479 error = 0; 482 error = 0;
480 } else { 483 } else {
481 484
482 if (blk_fs_request(rq) == 0 && uptodate <= 0) { 485 if (req->cmd_type != REQ_TYPE_FS && uptodate <= 0) {
483 if (rq->errors == 0) 486 if (rq->errors == 0)
484 rq->errors = -EIO; 487 rq->errors = -EIO;
485 } 488 }
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 64207df8da82..26a3688de467 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 !blk_fs_request(failed_command)) 179 failed_command->cmd_type != REQ_TYPE_FS)
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) |
@@ -292,7 +292,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
292 "stat 0x%x", 292 "stat 0x%x",
293 rq->cmd[0], rq->cmd_type, err, stat); 293 rq->cmd[0], rq->cmd_type, err, stat);
294 294
295 if (blk_sense_request(rq)) { 295 if (rq->cmd_type == REQ_TYPE_SENSE) {
296 /* 296 /*
297 * We got an error trying to get sense info from the drive 297 * We got an error trying to get sense info from the drive
298 * (probably while trying to recover from a former error). 298 * (probably while trying to recover from a former error).
@@ -303,7 +303,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
303 } 303 }
304 304
305 /* if we have an error, pass CHECK_CONDITION as the SCSI status byte */ 305 /* if we have an error, pass CHECK_CONDITION as the SCSI status byte */
306 if (blk_pc_request(rq) && !rq->errors) 306 if (rq->cmd_type == REQ_TYPE_BLOCK_PC && !rq->errors)
307 rq->errors = SAM_STAT_CHECK_CONDITION; 307 rq->errors = SAM_STAT_CHECK_CONDITION;
308 308
309 if (blk_noretry_request(rq)) 309 if (blk_noretry_request(rq))
@@ -311,13 +311,14 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
311 311
312 switch (sense_key) { 312 switch (sense_key) {
313 case NOT_READY: 313 case NOT_READY:
314 if (blk_fs_request(rq) && rq_data_dir(rq) == WRITE) { 314 if (rq->cmd_type == REQ_TYPE_FS && rq_data_dir(rq) == WRITE) {
315 if (ide_cd_breathe(drive, rq)) 315 if (ide_cd_breathe(drive, rq))
316 return 1; 316 return 1;
317 } else { 317 } else {
318 cdrom_saw_media_change(drive); 318 cdrom_saw_media_change(drive);
319 319
320 if (blk_fs_request(rq) && !blk_rq_quiet(rq)) 320 if (rq->cmd_type == REQ_TYPE_FS &&
321 !(rq->cmd_flags & REQ_QUIET)) {
321 printk(KERN_ERR PFX "%s: tray open\n", 322 printk(KERN_ERR PFX "%s: tray open\n",
322 drive->name); 323 drive->name);
323 } 324 }
@@ -326,7 +327,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
326 case UNIT_ATTENTION: 327 case UNIT_ATTENTION:
327 cdrom_saw_media_change(drive); 328 cdrom_saw_media_change(drive);
328 329
329 if (blk_fs_request(rq) == 0) 330 if (rq->cmd_type != REQ_TYPE_FS)
330 return 0; 331 return 0;
331 332
332 /* 333 /*
@@ -352,7 +353,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
352 * No point in retrying after an illegal request or data 353 * No point in retrying after an illegal request or data
353 * protect error. 354 * protect error.
354 */ 355 */
355 if (!blk_rq_quiet(rq)) 356 if (!(rq->cmd_flags & REQ_QUIET))
356 ide_dump_status(drive, "command error", stat); 357 ide_dump_status(drive, "command error", stat);
357 do_end_request = 1; 358 do_end_request = 1;
358 break; 359 break;
@@ -361,20 +362,20 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
361 * No point in re-trying a zillion times on a bad sector. 362 * No point in re-trying a zillion times on a bad sector.
362 * If we got here the error is not correctable. 363 * If we got here the error is not correctable.
363 */ 364 */
364 if (!blk_rq_quiet(rq)) 365 if (!(rq->cmd_flags & REQ_QUIET))
365 ide_dump_status(drive, "media error " 366 ide_dump_status(drive, "media error "
366 "(bad sector)", stat); 367 "(bad sector)", stat);
367 do_end_request = 1; 368 do_end_request = 1;
368 break; 369 break;
369 case BLANK_CHECK: 370 case BLANK_CHECK:
370 /* disk appears blank? */ 371 /* disk appears blank? */
371 if (!blk_rq_quiet(rq)) 372 if (!(rq->cmd_flags & REQ_QUIET))
372 ide_dump_status(drive, "media error (blank)", 373 ide_dump_status(drive, "media error (blank)",
373 stat); 374 stat);
374 do_end_request = 1; 375 do_end_request = 1;
375 break; 376 break;
376 default: 377 default:
377 if (blk_fs_request(rq) == 0) 378 if (req->cmd_type != REQ_TYPE_FS)
378 break; 379 break;
379 if (err & ~ATA_ABORTED) { 380 if (err & ~ATA_ABORTED) {
380 /* go to the default handler for other errors */ 381 /* go to the default handler for other errors */
@@ -385,7 +386,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
385 do_end_request = 1; 386 do_end_request = 1;
386 } 387 }
387 388
388 if (blk_fs_request(rq) == 0) { 389 if (rq->cmd_type != REQ_TYPE_FS) {
389 rq->cmd_flags |= REQ_FAILED; 390 rq->cmd_flags |= REQ_FAILED;
390 do_end_request = 1; 391 do_end_request = 1;
391 } 392 }
@@ -525,7 +526,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
525 ide_expiry_t *expiry = NULL; 526 ide_expiry_t *expiry = NULL;
526 int dma_error = 0, dma, thislen, uptodate = 0; 527 int dma_error = 0, dma, thislen, uptodate = 0;
527 int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0; 528 int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0;
528 int sense = blk_sense_request(rq); 529 int sense = (rq->cmd_type == REQ_TYPE_SENSE);
529 unsigned int timeout; 530 unsigned int timeout;
530 u16 len; 531 u16 len;
531 u8 ireason, stat; 532 u8 ireason, stat;
@@ -568,7 +569,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
568 569
569 ide_read_bcount_and_ireason(drive, &len, &ireason); 570 ide_read_bcount_and_ireason(drive, &len, &ireason);
570 571
571 thislen = blk_fs_request(rq) ? len : cmd->nleft; 572 thislen = (rq->cmd_type == REQ_TYPE_FS) ? len : cmd->nleft;
572 if (thislen > len) 573 if (thislen > len)
573 thislen = len; 574 thislen = len;
574 575
@@ -577,7 +578,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
577 578
578 /* If DRQ is clear, the command has completed. */ 579 /* If DRQ is clear, the command has completed. */
579 if ((stat & ATA_DRQ) == 0) { 580 if ((stat & ATA_DRQ) == 0) {
580 if (blk_fs_request(rq)) { 581 if (rq->cmd_type == REQ_TYPE_FS) {
581 /* 582 /*
582 * If we're not done reading/writing, complain. 583 * If we're not done reading/writing, complain.
583 * Otherwise, complete the command normally. 584 * Otherwise, complete the command normally.
@@ -591,7 +592,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
591 rq->cmd_flags |= REQ_FAILED; 592 rq->cmd_flags |= REQ_FAILED;
592 uptodate = 0; 593 uptodate = 0;
593 } 594 }
594 } else if (!blk_pc_request(rq)) { 595 } else if (rq->cmd_type != REQ_TYPE_BLOCK_PC) {
595 ide_cd_request_sense_fixup(drive, cmd); 596 ide_cd_request_sense_fixup(drive, cmd);
596 597
597 uptodate = cmd->nleft ? 0 : 1; 598 uptodate = cmd->nleft ? 0 : 1;
@@ -640,7 +641,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
640 641
641 /* pad, if necessary */ 642 /* pad, if necessary */
642 if (len > 0) { 643 if (len > 0) {
643 if (blk_fs_request(rq) == 0 || write == 0) 644 if (rq->cmd_type != REQ_TYPE_FS || write == 0)
644 ide_pad_transfer(drive, write, len); 645 ide_pad_transfer(drive, write, len);
645 else { 646 else {
646 printk(KERN_ERR PFX "%s: confused, missing data\n", 647 printk(KERN_ERR PFX "%s: confused, missing data\n",
@@ -649,11 +650,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
649 } 650 }
650 } 651 }
651 652
652 if (blk_pc_request(rq)) { 653 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
653 timeout = rq->timeout; 654 timeout = rq->timeout;
654 } else { 655 } else {
655 timeout = ATAPI_WAIT_PC; 656 timeout = ATAPI_WAIT_PC;
656 if (!blk_fs_request(rq)) 657 if (rq->cmd_type != REQ_TYPE_FS)
657 expiry = ide_cd_expiry; 658 expiry = ide_cd_expiry;
658 } 659 }
659 660
@@ -662,7 +663,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
662 return ide_started; 663 return ide_started;
663 664
664out_end: 665out_end:
665 if (blk_pc_request(rq) && rc == 0) { 666 if (rq->cmd_type == REQ_TYPE_BLOCK_PC && rc == 0) {
666 rq->resid_len = 0; 667 rq->resid_len = 0;
667 blk_end_request_all(rq, 0); 668 blk_end_request_all(rq, 0);
668 hwif->rq = NULL; 669 hwif->rq = NULL;
@@ -670,7 +671,7 @@ out_end:
670 if (sense && uptodate) 671 if (sense && uptodate)
671 ide_cd_complete_failed_rq(drive, rq); 672 ide_cd_complete_failed_rq(drive, rq);
672 673
673 if (blk_fs_request(rq)) { 674 if (rq->cmd_type == REQ_TYPE_FS) {
674 if (cmd->nleft == 0) 675 if (cmd->nleft == 0)
675 uptodate = 1; 676 uptodate = 1;
676 } else { 677 } else {
@@ -682,7 +683,7 @@ out_end:
682 ide_cd_error_cmd(drive, cmd); 683 ide_cd_error_cmd(drive, cmd);
683 684
684 /* make sure it's fully ended */ 685 /* make sure it's fully ended */
685 if (blk_fs_request(rq) == 0) { 686 if (rq->cmd_type != REQ_TYPE_FS) {
686 rq->resid_len -= cmd->nbytes - cmd->nleft; 687 rq->resid_len -= cmd->nbytes - cmd->nleft;
687 if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) 688 if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE))
688 rq->resid_len += cmd->last_xfer_len; 689 rq->resid_len += cmd->last_xfer_len;
@@ -742,7 +743,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
742 ide_debug_log(IDE_DBG_PC, "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x", 743 ide_debug_log(IDE_DBG_PC, "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x",
743 rq->cmd[0], rq->cmd_type); 744 rq->cmd[0], rq->cmd_type);
744 745
745 if (blk_pc_request(rq)) 746 if (rq->cmd_type == REQ_TYPE_BLOCK_PC)
746 rq->cmd_flags |= REQ_QUIET; 747 rq->cmd_flags |= REQ_QUIET;
747 else 748 else
748 rq->cmd_flags &= ~REQ_FAILED; 749 rq->cmd_flags &= ~REQ_FAILED;
@@ -783,21 +784,26 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
783 if (drive->debug_mask & IDE_DBG_RQ) 784 if (drive->debug_mask & IDE_DBG_RQ)
784 blk_dump_rq_flags(rq, "ide_cd_do_request"); 785 blk_dump_rq_flags(rq, "ide_cd_do_request");
785 786
786 if (blk_fs_request(rq)) { 787 switch (rq->cmd_type) {
788 case REQ_TYPE_FS:
787 if (cdrom_start_rw(drive, rq) == ide_stopped) 789 if (cdrom_start_rw(drive, rq) == ide_stopped)
788 goto out_end; 790 goto out_end;
789 } else if (blk_sense_request(rq) || blk_pc_request(rq) || 791 break;
790 rq->cmd_type == REQ_TYPE_ATA_PC) { 792 case REQ_TYPE_SENSE:
793 case REQ_TYPE_BLOCK_PC:
794 case REQ_TYPE_ATA_PC:
791 if (!rq->timeout) 795 if (!rq->timeout)
792 rq->timeout = ATAPI_WAIT_PC; 796 rq->timeout = ATAPI_WAIT_PC;
793 797
794 cdrom_do_block_pc(drive, rq); 798 cdrom_do_block_pc(drive, rq);
795 } else if (blk_special_request(rq)) { 799 break;
800 case REQ_TYPE_SPECIAL:
796 /* right now this can only be a reset... */ 801 /* right now this can only be a reset... */
797 uptodate = 1; 802 uptodate = 1;
798 goto out_end; 803 goto out_end;
799 } else 804 default:
800 BUG(); 805 BUG();
806 }
801 807
802 /* prepare sense request for this command */ 808 /* prepare sense request for this command */
803 ide_prep_sense(drive, rq); 809 ide_prep_sense(drive, rq);
@@ -809,7 +815,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
809 815
810 cmd.rq = rq; 816 cmd.rq = rq;
811 817
812 if (blk_fs_request(rq) || blk_rq_bytes(rq)) { 818 if (rq->cmd_type == REQ_TYPE_FS || blk_rq_bytes(rq)) {
813 ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); 819 ide_init_sg_cmd(&cmd, blk_rq_bytes(rq));
814 ide_map_sg(drive, &cmd); 820 ide_map_sg(drive, &cmd);
815 } 821 }
@@ -1365,9 +1371,9 @@ static int ide_cdrom_prep_pc(struct request *rq)
1365 1371
1366static int ide_cdrom_prep_fn(struct request_queue *q, struct request *rq) 1372static int ide_cdrom_prep_fn(struct request_queue *q, struct request *rq)
1367{ 1373{
1368 if (blk_fs_request(rq)) 1374 if (rq->cmd_type == REQ_TYPE_FS)
1369 return ide_cdrom_prep_fs(q, rq); 1375 return ide_cdrom_prep_fs(q, rq);
1370 else if (blk_pc_request(rq)) 1376 else if (rq->cmd_type == REQ_TYPE_BLOCK_PC)
1371 return ide_cdrom_prep_pc(rq); 1377 return ide_cdrom_prep_pc(rq);
1372 1378
1373 return 0; 1379 return 0;
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 33d65039cce9..df3d91ba1c96 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(!blk_fs_request(rq)); 187 BUG_ON(rq->cmd_type != REQ_TYPE_FS);
188 188
189 ledtrig_ide_activity(); 189 ledtrig_ide_activity();
190 190
diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c
index e9abf2c3c335..c0aa93fb7a60 100644
--- a/drivers/ide/ide-eh.c
+++ b/drivers/ide/ide-eh.c
@@ -122,7 +122,7 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat)
122 return ide_stopped; 122 return ide_stopped;
123 123
124 /* retry only "normal" I/O: */ 124 /* retry only "normal" I/O: */
125 if (!blk_fs_request(rq)) { 125 if (rq->cmd_type != REQ_TYPE_FS) {
126 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { 126 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
127 struct ide_cmd *cmd = rq->special; 127 struct ide_cmd *cmd = rq->special;
128 128
@@ -146,7 +146,8 @@ static inline void ide_complete_drive_reset(ide_drive_t *drive, int err)
146{ 146{
147 struct request *rq = drive->hwif->rq; 147 struct request *rq = drive->hwif->rq;
148 148
149 if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET) { 149 if (rq && rq->cmd_type == REQ_TYPE_SPECIAL &&
150 rq->cmd[0] == REQ_DRIVE_RESET) {
150 if (err <= 0 && rq->errors == 0) 151 if (err <= 0 && rq->errors == 0)
151 rq->errors = -EIO; 152 rq->errors = -EIO;
152 ide_complete_rq(drive, err ? err : 0, blk_rq_bytes(rq)); 153 ide_complete_rq(drive, err ? err : 0, blk_rq_bytes(rq));
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 4713bdca20b6..c7d0737bb18a 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -73,7 +73,7 @@ static int ide_floppy_callback(ide_drive_t *drive, int dsc)
73 drive->failed_pc = NULL; 73 drive->failed_pc = NULL;
74 74
75 if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 || 75 if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 ||
76 (rq && blk_pc_request(rq))) 76 (rq && rq->cmd_type == REQ_TYPE_BLOCK_PC))
77 uptodate = 1; /* FIXME */ 77 uptodate = 1; /* FIXME */
78 else if (pc->c[0] == GPCMD_REQUEST_SENSE) { 78 else if (pc->c[0] == GPCMD_REQUEST_SENSE) {
79 79
@@ -98,7 +98,7 @@ static int ide_floppy_callback(ide_drive_t *drive, int dsc)
98 "Aborting request!\n"); 98 "Aborting request!\n");
99 } 99 }
100 100
101 if (blk_special_request(rq)) 101 if (rq->cmd_type == REQ_TYPE_SPECIAL)
102 rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL; 102 rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
103 103
104 return uptodate; 104 return uptodate;
@@ -247,14 +247,16 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
247 } else 247 } else
248 printk(KERN_ERR PFX "%s: I/O error\n", drive->name); 248 printk(KERN_ERR PFX "%s: I/O error\n", drive->name);
249 249
250 if (blk_special_request(rq)) { 250 if (rq->cmd_type == REQ_TYPE_SPECIAL) {
251 rq->errors = 0; 251 rq->errors = 0;
252 ide_complete_rq(drive, 0, blk_rq_bytes(rq)); 252 ide_complete_rq(drive, 0, blk_rq_bytes(rq));
253 return ide_stopped; 253 return ide_stopped;
254 } else 254 } else
255 goto out_end; 255 goto out_end;
256 } 256 }
257 if (blk_fs_request(rq)) { 257
258 switch (rq->cmd_type) {
259 case REQ_TYPE_FS:
258 if (((long)blk_rq_pos(rq) % floppy->bs_factor) || 260 if (((long)blk_rq_pos(rq) % floppy->bs_factor) ||
259 (blk_rq_sectors(rq) % floppy->bs_factor)) { 261 (blk_rq_sectors(rq) % floppy->bs_factor)) {
260 printk(KERN_ERR PFX "%s: unsupported r/w rq size\n", 262 printk(KERN_ERR PFX "%s: unsupported r/w rq size\n",
@@ -263,13 +265,18 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
263 } 265 }
264 pc = &floppy->queued_pc; 266 pc = &floppy->queued_pc;
265 idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block); 267 idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block);
266 } else if (blk_special_request(rq) || blk_sense_request(rq)) { 268 break;
269 case REQ_TYPE_SPECIAL:
270 case REQ_TYPE_SENSE:
267 pc = (struct ide_atapi_pc *)rq->special; 271 pc = (struct ide_atapi_pc *)rq->special;
268 } else if (blk_pc_request(rq)) { 272 break;
273 case REQ_TYPE_BLOCK_PC:
269 pc = &floppy->queued_pc; 274 pc = &floppy->queued_pc;
270 idefloppy_blockpc_cmd(floppy, pc, rq); 275 idefloppy_blockpc_cmd(floppy, pc, rq);
271 } else 276 break;
277 default:
272 BUG(); 278 BUG();
279 }
273 280
274 ide_prep_sense(drive, rq); 281 ide_prep_sense(drive, rq);
275 282
@@ -280,7 +287,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
280 287
281 cmd.rq = rq; 288 cmd.rq = rq;
282 289
283 if (blk_fs_request(rq) || blk_rq_bytes(rq)) { 290 if (rq->cmd_type == REQ_TYPE_FS || blk_rq_bytes(rq)) {
284 ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); 291 ide_init_sg_cmd(&cmd, blk_rq_bytes(rq));
285 ide_map_sg(drive, &cmd); 292 ide_map_sg(drive, &cmd);
286 } 293 }
@@ -290,7 +297,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
290 return ide_floppy_issue_pc(drive, &cmd, pc); 297 return ide_floppy_issue_pc(drive, &cmd, pc);
291out_end: 298out_end:
292 drive->failed_pc = NULL; 299 drive->failed_pc = NULL;
293 if (blk_fs_request(rq) == 0 && rq->errors == 0) 300 if (rq->cmd_type != REQ_TYPE_FS && rq->errors == 0)
294 rq->errors = -EIO; 301 rq->errors = -EIO;
295 ide_complete_rq(drive, -EIO, blk_rq_bytes(rq)); 302 ide_complete_rq(drive, -EIO, blk_rq_bytes(rq));
296 return ide_stopped; 303 return ide_stopped;
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 172ac9218154..9304a7e54d9e 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -135,7 +135,7 @@ EXPORT_SYMBOL(ide_complete_rq);
135 135
136void ide_kill_rq(ide_drive_t *drive, struct request *rq) 136void ide_kill_rq(ide_drive_t *drive, struct request *rq)
137{ 137{
138 u8 drv_req = blk_special_request(rq) && rq->rq_disk; 138 u8 drv_req = (rq->cmd_type == REQ_TYPE_SPECIAL) && rq->rq_disk;
139 u8 media = drive->media; 139 u8 media = drive->media;
140 140
141 drive->failed_pc = NULL; 141 drive->failed_pc = NULL;
@@ -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 (blk_fs_request(rq) == 0 && rq->errors == 0) 148 else if (rq->cmd_type != REQ_TYPE_FS && rq->errors == 0)
149 rq->errors = -EIO; 149 rq->errors = -EIO;
150 } 150 }
151 151
@@ -307,7 +307,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
307{ 307{
308 ide_startstop_t startstop; 308 ide_startstop_t startstop;
309 309
310 BUG_ON(!blk_rq_started(rq)); 310 BUG_ON(!(rq->cmd_flags & REQ_STARTED));
311 311
312#ifdef DEBUG 312#ifdef DEBUG
313 printk("%s: start_request: current=0x%08lx\n", 313 printk("%s: start_request: current=0x%08lx\n",
@@ -353,7 +353,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
353 pm->pm_step == IDE_PM_COMPLETED) 353 pm->pm_step == IDE_PM_COMPLETED)
354 ide_complete_pm_rq(drive, rq); 354 ide_complete_pm_rq(drive, rq);
355 return startstop; 355 return startstop;
356 } else if (!rq->rq_disk && blk_special_request(rq)) 356 } else if (!rq->rq_disk && rq->cmd_type == REQ_TYPE_SPECIAL) {
357 /* 357 /*
358 * TODO: Once all ULDs have been modified to 358 * TODO: Once all ULDs have been modified to
359 * check for specific op codes rather than 359 * check for specific op codes rather than
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c
index 1c08311b0a0e..92406097efeb 100644
--- a/drivers/ide/ide-pm.c
+++ b/drivers/ide/ide-pm.c
@@ -191,10 +191,10 @@ void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq)
191 191
192#ifdef DEBUG_PM 192#ifdef DEBUG_PM
193 printk("%s: completing PM request, %s\n", drive->name, 193 printk("%s: completing PM request, %s\n", drive->name,
194 blk_pm_suspend_request(rq) ? "suspend" : "resume"); 194 (rq->cmd_type == REQ_TYPE_PM_SUSPEND) ? "suspend" : "resume");
195#endif 195#endif
196 spin_lock_irqsave(q->queue_lock, flags); 196 spin_lock_irqsave(q->queue_lock, flags);
197 if (blk_pm_suspend_request(rq)) 197 if (rq->cmd_type == REQ_TYPE_PM_SUSPEND)
198 blk_stop_queue(q); 198 blk_stop_queue(q);
199 else 199 else
200 drive->dev_flags &= ~IDE_DFLAG_BLOCKED; 200 drive->dev_flags &= ~IDE_DFLAG_BLOCKED;
@@ -210,11 +210,11 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
210{ 210{
211 struct request_pm_state *pm = rq->special; 211 struct request_pm_state *pm = rq->special;
212 212
213 if (blk_pm_suspend_request(rq) && 213 if (rq->cmd_type == REQ_TYPE_PM_SUSPEND &&
214 pm->pm_step == IDE_PM_START_SUSPEND) 214 pm->pm_step == IDE_PM_START_SUSPEND)
215 /* Mark drive blocked when starting the suspend sequence. */ 215 /* Mark drive blocked when starting the suspend sequence. */
216 drive->dev_flags |= IDE_DFLAG_BLOCKED; 216 drive->dev_flags |= IDE_DFLAG_BLOCKED;
217 else if (blk_pm_resume_request(rq) && 217 else if (rq->cmd_type == REQ_TYPE_PM_RESUME &&
218 pm->pm_step == IDE_PM_START_RESUME) { 218 pm->pm_step == IDE_PM_START_RESUME) {
219 /* 219 /*
220 * The first thing we do on wakeup is to wait for BSY bit to 220 * The first thing we do on wakeup is to wait for BSY bit to
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index b07232880ec9..635fd72d4728 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -577,7 +577,8 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
577 rq->cmd[0], (unsigned long long)blk_rq_pos(rq), 577 rq->cmd[0], (unsigned long long)blk_rq_pos(rq),
578 blk_rq_sectors(rq)); 578 blk_rq_sectors(rq));
579 579
580 BUG_ON(!(blk_special_request(rq) || blk_sense_request(rq))); 580 BUG_ON(!(rq->cmd_type == REQ_TYPE_SPECIAL ||
581 rq->cmd_type == REQ_TYPE_SENSE));
581 582
582 /* Retry a failed packet command */ 583 /* Retry a failed packet command */
583 if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) { 584 if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) {
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index d21e1284604f..1e0e6dd51501 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -792,12 +792,12 @@ static void dm_end_request(struct request *clone, int error)
792{ 792{
793 int rw = rq_data_dir(clone); 793 int rw = rq_data_dir(clone);
794 int run_queue = 1; 794 int run_queue = 1;
795 bool is_barrier = blk_barrier_rq(clone); 795 bool is_barrier = clone->cmd_flags & REQ_HARDBARRIER;
796 struct dm_rq_target_io *tio = clone->end_io_data; 796 struct dm_rq_target_io *tio = clone->end_io_data;
797 struct mapped_device *md = tio->md; 797 struct mapped_device *md = tio->md;
798 struct request *rq = tio->orig; 798 struct request *rq = tio->orig;
799 799
800 if (blk_pc_request(rq) && !is_barrier) { 800 if (rq->cmd_type == REQ_TYPE_BLOCK_PC && !is_barrier) {
801 rq->errors = clone->errors; 801 rq->errors = clone->errors;
802 rq->resid_len = clone->resid_len; 802 rq->resid_len = clone->resid_len;
803 803
@@ -844,7 +844,7 @@ void dm_requeue_unmapped_request(struct request *clone)
844 struct request_queue *q = rq->q; 844 struct request_queue *q = rq->q;
845 unsigned long flags; 845 unsigned long flags;
846 846
847 if (unlikely(blk_barrier_rq(clone))) { 847 if (unlikely(clone->cmd_flags & REQ_HARDBARRIER)) {
848 /* 848 /*
849 * Barrier clones share an original request. 849 * Barrier clones share an original request.
850 * Leave it to dm_end_request(), which handles this special 850 * Leave it to dm_end_request(), which handles this special
@@ -943,7 +943,7 @@ static void dm_complete_request(struct request *clone, int error)
943 struct dm_rq_target_io *tio = clone->end_io_data; 943 struct dm_rq_target_io *tio = clone->end_io_data;
944 struct request *rq = tio->orig; 944 struct request *rq = tio->orig;
945 945
946 if (unlikely(blk_barrier_rq(clone))) { 946 if (unlikely(clone->cmd_flags & REQ_HARDBARRIER)) {
947 /* 947 /*
948 * Barrier clones share an original request. So can't use 948 * Barrier clones share an original request. So can't use
949 * softirq_done with the original. 949 * softirq_done with the original.
@@ -972,7 +972,7 @@ void dm_kill_unmapped_request(struct request *clone, int error)
972 struct dm_rq_target_io *tio = clone->end_io_data; 972 struct dm_rq_target_io *tio = clone->end_io_data;
973 struct request *rq = tio->orig; 973 struct request *rq = tio->orig;
974 974
975 if (unlikely(blk_barrier_rq(clone))) { 975 if (unlikely(clone->cmd_flags & REQ_HARDBARRIER)) {
976 /* 976 /*
977 * Barrier clones share an original request. 977 * Barrier clones share an original request.
978 * Leave it to dm_end_request(), which handles this special 978 * Leave it to dm_end_request(), which handles this special
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index 8327e248520a..56645408d225 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -805,7 +805,8 @@ static void mspro_block_start(struct memstick_dev *card)
805 805
806static int mspro_block_prepare_req(struct request_queue *q, struct request *req) 806static int mspro_block_prepare_req(struct request_queue *q, struct request *req)
807{ 807{
808 if (!blk_fs_request(req) && !blk_pc_request(req)) { 808 if (req->cmd_type != REQ_TYPE_FS &&
809 req->cmd_type != REQ_TYPE_BLOCK_PC) {
809 blk_dump_rq_flags(req, "MSPro unsupported request"); 810 blk_dump_rq_flags(req, "MSPro unsupported request");
810 return BLKPREP_KILL; 811 return BLKPREP_KILL;
811 } 812 }
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index fc593fbab696..108f0c2b2bfd 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -883,7 +883,7 @@ static void i2o_block_request_fn(struct request_queue *q)
883 if (!req) 883 if (!req)
884 break; 884 break;
885 885
886 if (blk_fs_request(req)) { 886 if (req->cmd_type == REQ_TYPE_FS) {
887 struct i2o_block_delayed_request *dreq; 887 struct i2o_block_delayed_request *dreq;
888 struct i2o_block_request *ireq = req->special; 888 struct i2o_block_request *ireq = req->special;
889 unsigned int queue_depth; 889 unsigned int queue_depth;
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index d6ded247d941..ec92bcbdeddb 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -32,7 +32,7 @@ static int mmc_prep_request(struct request_queue *q, struct request *req)
32 /* 32 /*
33 * We only like normal block requests. 33 * We only like normal block requests.
34 */ 34 */
35 if (!blk_fs_request(req)) { 35 if (req->cmd_type != REQ_TYPE_FS) {
36 blk_dump_rq_flags(req, "MMC bad request"); 36 blk_dump_rq_flags(req, "MMC bad request");
37 return BLKPREP_KILL; 37 return BLKPREP_KILL;
38 } 38 }
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 03e19c1965cc..475af42745cb 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -73,14 +73,14 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr,
73 73
74 buf = req->buffer; 74 buf = req->buffer;
75 75
76 if (!blk_fs_request(req)) 76 if (req->cmd_type != REQ_TYPE_FS)
77 return -EIO; 77 return -EIO;
78 78
79 if (blk_rq_pos(req) + blk_rq_cur_sectors(req) > 79 if (blk_rq_pos(req) + blk_rq_cur_sectors(req) >
80 get_capacity(req->rq_disk)) 80 get_capacity(req->rq_disk))
81 return -EIO; 81 return -EIO;
82 82
83 if (blk_discard_rq(req)) 83 if (req->cmd_flags & REQ_DISCARD)
84 return tr->discard(dev, block, nsect); 84 return tr->discard(dev, block, nsect);
85 85
86 switch(rq_data_dir(req)) { 86 switch(rq_data_dir(req)) {
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index a5d630f5f519..1b88af89d0c7 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -307,7 +307,7 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
307 (sshdr.asc == 0x04) && (sshdr.ascq == 0x02)) 307 (sshdr.asc == 0x04) && (sshdr.ascq == 0x02))
308 return FAILED; 308 return FAILED;
309 309
310 if (blk_barrier_rq(scmd->request)) 310 if (scmd->request->cmd_flags & REQ_HARDBARRIER)
311 /* 311 /*
312 * barrier requests should always retry on UA 312 * barrier requests should always retry on UA
313 * otherwise block will get a spurious error 313 * otherwise block will get a spurious error
@@ -1318,16 +1318,16 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd)
1318 case DID_OK: 1318 case DID_OK:
1319 break; 1319 break;
1320 case DID_BUS_BUSY: 1320 case DID_BUS_BUSY:
1321 return blk_failfast_transport(scmd->request); 1321 return (scmd->request->cmd_flags & REQ_FAILFAST_TRANSPORT);
1322 case DID_PARITY: 1322 case DID_PARITY:
1323 return blk_failfast_dev(scmd->request); 1323 return (scmd->request->cmd_flags & REQ_FAILFAST_DEV);
1324 case DID_ERROR: 1324 case DID_ERROR:
1325 if (msg_byte(scmd->result) == COMMAND_COMPLETE && 1325 if (msg_byte(scmd->result) == COMMAND_COMPLETE &&
1326 status_byte(scmd->result) == RESERVATION_CONFLICT) 1326 status_byte(scmd->result) == RESERVATION_CONFLICT)
1327 return 0; 1327 return 0;
1328 /* fall through */ 1328 /* fall through */
1329 case DID_SOFT_ERROR: 1329 case DID_SOFT_ERROR:
1330 return blk_failfast_driver(scmd->request); 1330 return (scmd->request->cmd_flags & REQ_FAILFAST_DRIVER);
1331 } 1331 }
1332 1332
1333 switch (status_byte(scmd->result)) { 1333 switch (status_byte(scmd->result)) {
@@ -1336,7 +1336,7 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd)
1336 * assume caller has checked sense and determinted 1336 * assume caller has checked sense and determinted
1337 * the check condition was retryable. 1337 * the check condition was retryable.
1338 */ 1338 */
1339 return blk_failfast_dev(scmd->request); 1339 return (scmd->request->cmd_flags & REQ_FAILFAST_DEV);
1340 } 1340 }
1341 1341
1342 return 0; 1342 return 0;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 1646fe7cbd4b..5f1160841b0e 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -722,7 +722,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
722 sense_deferred = scsi_sense_is_deferred(&sshdr); 722 sense_deferred = scsi_sense_is_deferred(&sshdr);
723 } 723 }
724 724
725 if (blk_pc_request(req)) { /* SG_IO ioctl from block level */ 725 if (req->cmd_type == REQ_TYPE_BLOCK_PC) { /* SG_IO ioctl from block level */
726 req->errors = result; 726 req->errors = result;
727 if (result) { 727 if (result) {
728 if (sense_valid && req->sense) { 728 if (sense_valid && req->sense) {
@@ -757,7 +757,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
757 } 757 }
758 } 758 }
759 759
760 BUG_ON(blk_bidi_rq(req)); /* bidi not support for !blk_pc_request yet */ 760 /* no bidi support for !REQ_TYPE_BLOCK_PC yet */
761 BUG_ON(blk_bidi_rq(req));
761 762
762 /* 763 /*
763 * Next deal with any sectors which we were able to correctly 764 * Next deal with any sectors which we were able to correctly
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 8802e48bc063..a3fdf4dc59da 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -485,7 +485,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
485 * Discard request come in as REQ_TYPE_FS but we turn them into 485 * Discard request come in as REQ_TYPE_FS but we turn them into
486 * block PC requests to make life easier. 486 * block PC requests to make life easier.
487 */ 487 */
488 if (blk_discard_rq(rq)) 488 if (rq->cmd_flags & REQ_DISCARD)
489 ret = sd_prepare_discard(rq); 489 ret = sd_prepare_discard(rq);
490 490
491 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { 491 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
@@ -636,7 +636,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
636 SCpnt->cmnd[0] = VARIABLE_LENGTH_CMD; 636 SCpnt->cmnd[0] = VARIABLE_LENGTH_CMD;
637 SCpnt->cmnd[7] = 0x18; 637 SCpnt->cmnd[7] = 0x18;
638 SCpnt->cmnd[9] = (rq_data_dir(rq) == READ) ? READ_32 : WRITE_32; 638 SCpnt->cmnd[9] = (rq_data_dir(rq) == READ) ? READ_32 : WRITE_32;
639 SCpnt->cmnd[10] = protect | (blk_fua_rq(rq) ? 0x8 : 0); 639 SCpnt->cmnd[10] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0);
640 640
641 /* LBA */ 641 /* LBA */
642 SCpnt->cmnd[12] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0; 642 SCpnt->cmnd[12] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0;
@@ -661,7 +661,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
661 SCpnt->cmnd[31] = (unsigned char) this_count & 0xff; 661 SCpnt->cmnd[31] = (unsigned char) this_count & 0xff;
662 } else if (block > 0xffffffff) { 662 } else if (block > 0xffffffff) {
663 SCpnt->cmnd[0] += READ_16 - READ_6; 663 SCpnt->cmnd[0] += READ_16 - READ_6;
664 SCpnt->cmnd[1] = protect | (blk_fua_rq(rq) ? 0x8 : 0); 664 SCpnt->cmnd[1] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0);
665 SCpnt->cmnd[2] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0; 665 SCpnt->cmnd[2] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0;
666 SCpnt->cmnd[3] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0; 666 SCpnt->cmnd[3] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0;
667 SCpnt->cmnd[4] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0; 667 SCpnt->cmnd[4] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0;
@@ -682,7 +682,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
682 this_count = 0xffff; 682 this_count = 0xffff;
683 683
684 SCpnt->cmnd[0] += READ_10 - READ_6; 684 SCpnt->cmnd[0] += READ_10 - READ_6;
685 SCpnt->cmnd[1] = protect | (blk_fua_rq(rq) ? 0x8 : 0); 685 SCpnt->cmnd[1] = protect | ((rq->cmd_flags & REQ_FUA) ? 0x8 : 0);
686 SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff; 686 SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff;
687 SCpnt->cmnd[3] = (unsigned char) (block >> 16) & 0xff; 687 SCpnt->cmnd[3] = (unsigned char) (block >> 16) & 0xff;
688 SCpnt->cmnd[4] = (unsigned char) (block >> 8) & 0xff; 688 SCpnt->cmnd[4] = (unsigned char) (block >> 8) & 0xff;
@@ -691,7 +691,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
691 SCpnt->cmnd[7] = (unsigned char) (this_count >> 8) & 0xff; 691 SCpnt->cmnd[7] = (unsigned char) (this_count >> 8) & 0xff;
692 SCpnt->cmnd[8] = (unsigned char) this_count & 0xff; 692 SCpnt->cmnd[8] = (unsigned char) this_count & 0xff;
693 } else { 693 } else {
694 if (unlikely(blk_fua_rq(rq))) { 694 if (unlikely(rq->cmd_flags & REQ_FUA)) {
695 /* 695 /*
696 * This happens only if this drive failed 696 * This happens only if this drive failed
697 * 10byte rw command with ILLEGAL_REQUEST 697 * 10byte rw command with ILLEGAL_REQUEST
@@ -1112,7 +1112,7 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd)
1112 u64 bad_lba; 1112 u64 bad_lba;
1113 int info_valid; 1113 int info_valid;
1114 1114
1115 if (!blk_fs_request(scmd->request)) 1115 if (scmd->request->cmd_type != REQ_TYPE_FS)
1116 return 0; 1116 return 0;
1117 1117
1118 info_valid = scsi_get_sense_info_fld(scmd->sense_buffer, 1118 info_valid = scsi_get_sense_info_fld(scmd->sense_buffer,
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c
index b5838d547c68..713620ed70d9 100644
--- a/drivers/scsi/sun3_NCR5380.c
+++ b/drivers/scsi/sun3_NCR5380.c
@@ -2022,7 +2022,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
2022 if((count > SUN3_DMA_MINSIZE) && (sun3_dma_setup_done 2022 if((count > SUN3_DMA_MINSIZE) && (sun3_dma_setup_done
2023 != cmd)) 2023 != cmd))
2024 { 2024 {
2025 if(blk_fs_request(cmd->request)) { 2025 if (cmd->request->cmd_type == REQ_TYPE_FS) {
2026 sun3scsi_dma_setup(d, count, 2026 sun3scsi_dma_setup(d, count,
2027 rq_data_dir(cmd->request)); 2027 rq_data_dir(cmd->request));
2028 sun3_dma_setup_done = cmd; 2028 sun3_dma_setup_done = cmd;
diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c
index e606cf0a2eb7..613f5880d135 100644
--- a/drivers/scsi/sun3_scsi.c
+++ b/drivers/scsi/sun3_scsi.c
@@ -524,7 +524,7 @@ static inline unsigned long sun3scsi_dma_xfer_len(unsigned long wanted,
524 struct scsi_cmnd *cmd, 524 struct scsi_cmnd *cmd,
525 int write_flag) 525 int write_flag)
526{ 526{
527 if(blk_fs_request(cmd->request)) 527 if (cmd->request->cmd_type == REQ_TYPE_FS)
528 return wanted; 528 return wanted;
529 else 529 else
530 return 0; 530 return 0;
diff --git a/drivers/scsi/sun3_scsi_vme.c b/drivers/scsi/sun3_scsi_vme.c
index aaa4fd0dd1b9..7c526b8e30ac 100644
--- a/drivers/scsi/sun3_scsi_vme.c
+++ b/drivers/scsi/sun3_scsi_vme.c
@@ -458,7 +458,7 @@ static inline unsigned long sun3scsi_dma_xfer_len(unsigned long wanted,
458 struct scsi_cmnd *cmd, 458 struct scsi_cmnd *cmd,
459 int write_flag) 459 int write_flag)
460{ 460{
461 if(blk_fs_request(cmd->request)) 461 if (cmd->request->cmd_type == REQ_TYPE_FS)
462 return wanted; 462 return wanted;
463 else 463 else
464 return 0; 464 return 0;
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 61bd0be5fb18..a9aff90e58e0 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -823,7 +823,8 @@ static void blkvsc_init_rw(struct blkvsc_request *blkvsc_req)
823 blkvsc_req->cmnd[0] = READ_16; 823 blkvsc_req->cmnd[0] = READ_16;
824 } 824 }
825 825
826 blkvsc_req->cmnd[1] |= blk_fua_rq(blkvsc_req->req) ? 0x8 : 0; 826 blkvsc_req->cmnd[1] |=
827 (blkvsc_req->req->cmd_flags & REQ_FUA) ? 0x8 : 0;
827 828
828 *(unsigned long long *)&blkvsc_req->cmnd[2] = 829 *(unsigned long long *)&blkvsc_req->cmnd[2] =
829 cpu_to_be64(blkvsc_req->sector_start); 830 cpu_to_be64(blkvsc_req->sector_start);
@@ -839,7 +840,8 @@ static void blkvsc_init_rw(struct blkvsc_request *blkvsc_req)
839 blkvsc_req->cmnd[0] = READ_10; 840 blkvsc_req->cmnd[0] = READ_10;
840 } 841 }
841 842
842 blkvsc_req->cmnd[1] |= blk_fua_rq(blkvsc_req->req) ? 0x8 : 0; 843 blkvsc_req->cmnd[1] |=
844 (blkvsc_req->req->cmd_flags & REQ_FUA) ? 0x8 : 0;
843 845
844 *(unsigned int *)&blkvsc_req->cmnd[2] = 846 *(unsigned int *)&blkvsc_req->cmnd[2] =
845 cpu_to_be32(blkvsc_req->sector_start); 847 cpu_to_be32(blkvsc_req->sector_start);
@@ -1286,7 +1288,7 @@ static void blkvsc_request(struct request_queue *queue)
1286 DPRINT_DBG(BLKVSC_DRV, "- req %p\n", req); 1288 DPRINT_DBG(BLKVSC_DRV, "- req %p\n", req);
1287 1289
1288 blkdev = req->rq_disk->private_data; 1290 blkdev = req->rq_disk->private_data;
1289 if (blkdev->shutting_down || !blk_fs_request(req) || 1291 if (blkdev->shutting_down || req->cmd_type != REQ_TYPE_FS ||
1290 blkdev->media_not_present) { 1292 blkdev->media_not_present) {
1291 __blk_end_request_cur(req, 0); 1293 __blk_end_request_cur(req, 0);
1292 continue; 1294 continue;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d7ae241a9e55..3ecd28ef9ba4 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -604,33 +604,20 @@ enum {
604 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) 604 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags)
605#define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags) 605#define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags)
606 606
607#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) 607#define blk_noretry_request(rq) \
608#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC) 608 ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \
609#define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL) 609 REQ_FAILFAST_DRIVER))
610#define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE) 610
611 611#define blk_account_rq(rq) \
612#define blk_failfast_dev(rq) ((rq)->cmd_flags & REQ_FAILFAST_DEV) 612 (((rq)->cmd_flags & REQ_STARTED) && \
613#define blk_failfast_transport(rq) ((rq)->cmd_flags & REQ_FAILFAST_TRANSPORT) 613 ((rq)->cmd_type == REQ_TYPE_FS || \
614#define blk_failfast_driver(rq) ((rq)->cmd_flags & REQ_FAILFAST_DRIVER) 614 ((rq)->cmd_flags & REQ_DISCARD)))
615#define blk_noretry_request(rq) (blk_failfast_dev(rq) || \ 615
616 blk_failfast_transport(rq) || \
617 blk_failfast_driver(rq))
618#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED)
619#define blk_rq_io_stat(rq) ((rq)->cmd_flags & REQ_IO_STAT)
620#define blk_rq_quiet(rq) ((rq)->cmd_flags & REQ_QUIET)
621
622#define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq)))
623
624#define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND)
625#define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME)
626#define blk_pm_request(rq) \ 616#define blk_pm_request(rq) \
627 (blk_pm_suspend_request(rq) || blk_pm_resume_request(rq)) 617 ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND || \
618 (rq)->cmd_type == REQ_TYPE_PM_RESUME)
628 619
629#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1) 620#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1)
630#define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED)
631#define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER)
632#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
633#define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD)
634#define blk_bidi_rq(rq) ((rq)->next_rq != NULL) 621#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
635/* rq->queuelist of dequeued request must be list_empty() */ 622/* rq->queuelist of dequeued request must be list_empty() */
636#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist)) 623#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist))
@@ -652,9 +639,6 @@ static inline bool rq_is_sync(struct request *rq)
652 return rw_is_sync(rq->cmd_flags); 639 return rw_is_sync(rq->cmd_flags);
653} 640}
654 641
655#define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META)
656#define rq_noidle(rq) ((rq)->cmd_flags & REQ_NOIDLE)
657
658static inline int blk_queue_full(struct request_queue *q, int sync) 642static inline int blk_queue_full(struct request_queue *q, int sync)
659{ 643{
660 if (sync) 644 if (sync)
@@ -687,7 +671,8 @@ static inline void blk_clear_queue_full(struct request_queue *q, int sync)
687 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) 671 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER)
688#define rq_mergeable(rq) \ 672#define rq_mergeable(rq) \
689 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \ 673 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \
690 (blk_discard_rq(rq) || blk_fs_request((rq)))) 674 (((rq)->cmd_flags & REQ_DISCARD) || \
675 (rq)->cmd_type == REQ_TYPE_FS))
691 676
692/* 677/*
693 * q->prep_rq_fn return values 678 * q->prep_rq_fn return values
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 416bf62d6d46..23faa67e8022 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -224,7 +224,7 @@ static inline int blk_trace_init_sysfs(struct device *dev)
224 224
225static inline int blk_cmd_buf_len(struct request *rq) 225static inline int blk_cmd_buf_len(struct request *rq)
226{ 226{
227 return blk_pc_request(rq) ? rq->cmd_len * 3 : 1; 227 return (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? rq->cmd_len * 3 : 1;
228} 228}
229 229
230extern void blk_dump_cmd(char *buf, struct request *rq); 230extern void blk_dump_cmd(char *buf, struct request *rq);
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index d870a918559c..d8ce278515c3 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -25,8 +25,10 @@ DECLARE_EVENT_CLASS(block_rq_with_error,
25 25
26 TP_fast_assign( 26 TP_fast_assign(
27 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; 27 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
28 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); 28 __entry->sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
29 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); 29 0 : blk_rq_pos(rq);
30 __entry->nr_sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
31 0 : blk_rq_sectors(rq);
30 __entry->errors = rq->errors; 32 __entry->errors = rq->errors;
31 33
32 blk_fill_rwbs_rq(__entry->rwbs, rq); 34 blk_fill_rwbs_rq(__entry->rwbs, rq);
@@ -109,9 +111,12 @@ DECLARE_EVENT_CLASS(block_rq,
109 111
110 TP_fast_assign( 112 TP_fast_assign(
111 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; 113 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
112 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); 114 __entry->sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
113 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); 115 0 : blk_rq_pos(rq);
114 __entry->bytes = blk_pc_request(rq) ? blk_rq_bytes(rq) : 0; 116 __entry->nr_sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
117 0 : blk_rq_sectors(rq);
118 __entry->bytes = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
119 blk_rq_bytes(rq) : 0;
115 120
116 blk_fill_rwbs_rq(__entry->rwbs, rq); 121 blk_fill_rwbs_rq(__entry->rwbs, rq);
117 blk_dump_cmd(__get_str(cmd), rq); 122 blk_dump_cmd(__get_str(cmd), rq);
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 638711c17504..4f149944cb89 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -661,10 +661,10 @@ static void blk_add_trace_rq(struct request_queue *q, struct request *rq,
661 if (likely(!bt)) 661 if (likely(!bt))
662 return; 662 return;
663 663
664 if (blk_discard_rq(rq)) 664 if (rq->cmd_flags & REQ_DISCARD)
665 rw |= (1 << BIO_RW_DISCARD); 665 rw |= (1 << BIO_RW_DISCARD);
666 666
667 if (blk_pc_request(rq)) { 667 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
668 what |= BLK_TC_ACT(BLK_TC_PC); 668 what |= BLK_TC_ACT(BLK_TC_PC);
669 __blk_add_trace(bt, 0, blk_rq_bytes(rq), rw, 669 __blk_add_trace(bt, 0, blk_rq_bytes(rq), rw,
670 what, rq->errors, rq->cmd_len, rq->cmd); 670 what, rq->errors, rq->cmd_len, rq->cmd);
@@ -925,7 +925,7 @@ void blk_add_driver_data(struct request_queue *q,
925 if (likely(!bt)) 925 if (likely(!bt))
926 return; 926 return;
927 927
928 if (blk_pc_request(rq)) 928 if (rq->cmd_type == REQ_TYPE_BLOCK_PC)
929 __blk_add_trace(bt, 0, blk_rq_bytes(rq), 0, 929 __blk_add_trace(bt, 0, blk_rq_bytes(rq), 0,
930 BLK_TA_DRV_DATA, rq->errors, len, data); 930 BLK_TA_DRV_DATA, rq->errors, len, data);
931 else 931 else
@@ -1730,7 +1730,7 @@ void blk_dump_cmd(char *buf, struct request *rq)
1730 int len = rq->cmd_len; 1730 int len = rq->cmd_len;
1731 unsigned char *cmd = rq->cmd; 1731 unsigned char *cmd = rq->cmd;
1732 1732
1733 if (!blk_pc_request(rq)) { 1733 if (rq->cmd_type != REQ_TYPE_BLOCK_PC) {
1734 buf[0] = '\0'; 1734 buf[0] = '\0';
1735 return; 1735 return;
1736 } 1736 }
@@ -1779,7 +1779,7 @@ void blk_fill_rwbs_rq(char *rwbs, struct request *rq)
1779 int rw = rq->cmd_flags & 0x03; 1779 int rw = rq->cmd_flags & 0x03;
1780 int bytes; 1780 int bytes;
1781 1781
1782 if (blk_discard_rq(rq)) 1782 if (rq->cmd_flags & REQ_DISCARD)
1783 rw |= (1 << BIO_RW_DISCARD); 1783 rw |= (1 << BIO_RW_DISCARD);
1784 1784
1785 bytes = blk_rq_bytes(rq); 1785 bytes = blk_rq_bytes(rq);