diff options
author | Christoph Hellwig <hch@lst.de> | 2016-08-04 16:10:00 +0200 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-08-04 22:19:16 +0200 |
commit | f0225cacfe7e69ff3234a125aeb0f3d65077835c (patch) | |
tree | e61f490b47a997149aa391b301fa3f3b463d66e1 /drivers/block | |
parent | blk-mq: fix deadlock in blk_mq_register_disk() error path (diff) | |
download | linux-f0225cacfe7e69ff3234a125aeb0f3d65077835c.tar.xz linux-f0225cacfe7e69ff3234a125aeb0f3d65077835c.zip |
loop: don't try to use AIO for discards
Fix a fat-fingered conversion to the req_op accessors, and also
use a switch statement to make it more obvious what is being checked.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Dave Chinner <david@fromorbit.com>
Fixes: c2df40 ("drivers: use req op accessor");
Reviewed-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/loop.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 075377eee0c0..91c2c881cb49 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1659,11 +1659,15 @@ static int loop_queue_rq(struct blk_mq_hw_ctx *hctx, if (lo->lo_state != Lo_bound) return -EIO; - if (lo->use_dio && (req_op(cmd->rq) != REQ_OP_FLUSH || - req_op(cmd->rq) == REQ_OP_DISCARD)) - cmd->use_aio = true; - else + switch (req_op(cmd->rq)) { + case REQ_OP_FLUSH: + case REQ_OP_DISCARD: cmd->use_aio = false; + break; + default: + cmd->use_aio = lo->use_dio; + break; + } queue_kthread_work(&lo->worker, &cmd->work); |