blk-mq-debug: Avoid that sparse complains about req_flags_t usage
authorBart Van Assche <bart.vanassche@sandisk.com>
Wed, 1 Feb 2017 19:22:23 +0000 (12:22 -0700)
committerJens Axboe <axboe@fb.com>
Wed, 1 Feb 2017 19:22:23 +0000 (12:22 -0700)
Avoid that sparse reports the following complaints:

block/elevator.c:541:29: warning: incorrect type in assignment (different base types)
block/elevator.c:541:29:    expected bool [unsigned] [usertype] next_sorted
block/elevator.c:541:29:    got restricted req_flags_t

block/blk-mq-debugfs.c:92:54: warning: cast from restricted req_flags_t

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq-debugfs.c
block/elevator.c

index 3a914e78ac11226a4285a8ec4cc2220428438eb1..0119ec533824e579de1c79a23dd6466743292c6b 100644 (file)
@@ -89,7 +89,7 @@ static int blk_mq_debugfs_rq_show(struct seq_file *m, void *v)
        struct request *rq = list_entry_rq(v);
 
        seq_printf(m, "%p {.cmd_flags=0x%x, .rq_flags=0x%x, .tag=%d, .internal_tag=%d}\n",
-                  rq, rq->cmd_flags, (unsigned int)rq->rq_flags,
+                  rq, rq->cmd_flags, (__force unsigned int)rq->rq_flags,
                   rq->tag, rq->internal_tag);
        return 0;
 }
index dba9be891a6b6e52ade80b7c47b1dcfc190ef9d9..7e4f5880dd64879485db0a2e18eaab08dfcd56ce 100644 (file)
@@ -538,7 +538,7 @@ void elv_merge_requests(struct request_queue *q, struct request *rq,
        if (e->uses_mq && e->type->ops.mq.requests_merged)
                e->type->ops.mq.requests_merged(q, rq, next);
        else if (e->type->ops.sq.elevator_merge_req_fn) {
-               next_sorted = next->rq_flags & RQF_SORTED;
+               next_sorted = (__force bool)(next->rq_flags & RQF_SORTED);
                if (next_sorted)
                        e->type->ops.sq.elevator_merge_req_fn(q, rq, next);
        }