diff options
author | Christoph Hellwig <hch@lst.de> | 2017-01-31 10:57:29 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-01-31 16:00:34 -0500 |
commit | 57292b58ddb58689e8c3b4c6eadbef10d9ca44dd (patch) | |
tree | dd6e5af538b2f2684d2090781f668c7099a0455e /block | |
parent | 09fc54ccc42744669e748434af5c2f8adcad900f (diff) |
block: introduce blk_rq_is_passthrough
This can be used to check for fs vs non-fs requests and basically
removes all knowledge of BLOCK_PC specific from the block layer,
as well as preparing for removing the cmd_type field in struct request.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-core.c | 8 | ||||
-rw-r--r-- | block/blk-exec.c | 2 | ||||
-rw-r--r-- | block/blk.h | 2 | ||||
-rw-r--r-- | block/elevator.c | 4 | ||||
-rw-r--r-- | block/mq-deadline.c | 2 |
5 files changed, 9 insertions, 9 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 95829523cded..44431086e4e7 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -2506,10 +2506,10 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes) | |||
2506 | * TODO: tj: This is too subtle. It would be better to let | 2506 | * TODO: tj: This is too subtle. It would be better to let |
2507 | * low level drivers do what they see fit. | 2507 | * low level drivers do what they see fit. |
2508 | */ | 2508 | */ |
2509 | if (req->cmd_type == REQ_TYPE_FS) | 2509 | if (!blk_rq_is_passthrough(req)) |
2510 | req->errors = 0; | 2510 | req->errors = 0; |
2511 | 2511 | ||
2512 | if (error && req->cmd_type == REQ_TYPE_FS && | 2512 | if (error && !blk_rq_is_passthrough(req) && |
2513 | !(req->rq_flags & RQF_QUIET)) { | 2513 | !(req->rq_flags & RQF_QUIET)) { |
2514 | char *error_type; | 2514 | char *error_type; |
2515 | 2515 | ||
@@ -2581,7 +2581,7 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes) | |||
2581 | req->__data_len -= total_bytes; | 2581 | req->__data_len -= total_bytes; |
2582 | 2582 | ||
2583 | /* update sector only for requests with clear definition of sector */ | 2583 | /* update sector only for requests with clear definition of sector */ |
2584 | if (req->cmd_type == REQ_TYPE_FS) | 2584 | if (!blk_rq_is_passthrough(req)) |
2585 | req->__sector += total_bytes >> 9; | 2585 | req->__sector += total_bytes >> 9; |
2586 | 2586 | ||
2587 | /* mixed attributes always follow the first bio */ | 2587 | /* mixed attributes always follow the first bio */ |
@@ -2659,7 +2659,7 @@ void blk_finish_request(struct request *req, int error) | |||
2659 | 2659 | ||
2660 | BUG_ON(blk_queued_rq(req)); | 2660 | BUG_ON(blk_queued_rq(req)); |
2661 | 2661 | ||
2662 | if (unlikely(laptop_mode) && req->cmd_type == REQ_TYPE_FS) | 2662 | if (unlikely(laptop_mode) && !blk_rq_is_passthrough(req)) |
2663 | laptop_io_completion(&req->q->backing_dev_info); | 2663 | laptop_io_completion(&req->q->backing_dev_info); |
2664 | 2664 | ||
2665 | blk_delete_timer(req); | 2665 | blk_delete_timer(req); |
diff --git a/block/blk-exec.c b/block/blk-exec.c index ed51800f4b44..8cd0e9bc8dc8 100644 --- a/block/blk-exec.c +++ b/block/blk-exec.c | |||
@@ -51,7 +51,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, | |||
51 | int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK; | 51 | int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK; |
52 | 52 | ||
53 | WARN_ON(irqs_disabled()); | 53 | WARN_ON(irqs_disabled()); |
54 | WARN_ON(rq->cmd_type == REQ_TYPE_FS); | 54 | WARN_ON(!blk_rq_is_passthrough(rq)); |
55 | 55 | ||
56 | rq->rq_disk = bd_disk; | 56 | rq->rq_disk = bd_disk; |
57 | rq->end_io = done; | 57 | rq->end_io = done; |
diff --git a/block/blk.h b/block/blk.h index 9a716b5925a4..c1bd4bf9e645 100644 --- a/block/blk.h +++ b/block/blk.h | |||
@@ -249,7 +249,7 @@ static inline int blk_do_io_stat(struct request *rq) | |||
249 | { | 249 | { |
250 | return rq->rq_disk && | 250 | return rq->rq_disk && |
251 | (rq->rq_flags & RQF_IO_STAT) && | 251 | (rq->rq_flags & RQF_IO_STAT) && |
252 | (rq->cmd_type == REQ_TYPE_FS); | 252 | !blk_rq_is_passthrough(rq); |
253 | } | 253 | } |
254 | 254 | ||
255 | /* | 255 | /* |
diff --git a/block/elevator.c b/block/elevator.c index ef7f59469acc..dba9be891a6b 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -634,7 +634,7 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where) | |||
634 | 634 | ||
635 | if (rq->rq_flags & RQF_SOFTBARRIER) { | 635 | if (rq->rq_flags & RQF_SOFTBARRIER) { |
636 | /* barriers are scheduling boundary, update end_sector */ | 636 | /* barriers are scheduling boundary, update end_sector */ |
637 | if (rq->cmd_type == REQ_TYPE_FS) { | 637 | if (!blk_rq_is_passthrough(rq)) { |
638 | q->end_sector = rq_end_sector(rq); | 638 | q->end_sector = rq_end_sector(rq); |
639 | q->boundary_rq = rq; | 639 | q->boundary_rq = rq; |
640 | } | 640 | } |
@@ -676,7 +676,7 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where) | |||
676 | if (elv_attempt_insert_merge(q, rq)) | 676 | if (elv_attempt_insert_merge(q, rq)) |
677 | break; | 677 | break; |
678 | case ELEVATOR_INSERT_SORT: | 678 | case ELEVATOR_INSERT_SORT: |
679 | BUG_ON(rq->cmd_type != REQ_TYPE_FS); | 679 | BUG_ON(blk_rq_is_passthrough(rq)); |
680 | rq->rq_flags |= RQF_SORTED; | 680 | rq->rq_flags |= RQF_SORTED; |
681 | q->nr_sorted++; | 681 | q->nr_sorted++; |
682 | if (rq_mergeable(rq)) { | 682 | if (rq_mergeable(rq)) { |
diff --git a/block/mq-deadline.c b/block/mq-deadline.c index d93ec713fa62..49583536698c 100644 --- a/block/mq-deadline.c +++ b/block/mq-deadline.c | |||
@@ -398,7 +398,7 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq, | |||
398 | if (blk_mq_sched_bypass_insert(hctx, rq)) | 398 | if (blk_mq_sched_bypass_insert(hctx, rq)) |
399 | return; | 399 | return; |
400 | 400 | ||
401 | if (at_head || rq->cmd_type != REQ_TYPE_FS) { | 401 | if (at_head || blk_rq_is_passthrough(rq)) { |
402 | if (at_head) | 402 | if (at_head) |
403 | list_add(&rq->queuelist, &dd->dispatch); | 403 | list_add(&rq->queuelist, &dd->dispatch); |
404 | else | 404 | else |