From: Christoph Hellwig Date: Thu, 4 Aug 2016 14:10:00 +0000 (+0200) Subject: loop: don't try to use AIO for discards X-Git-Tag: v4.9.8~1565^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f0225cacfe7e69ff3234a125aeb0f3d65077835c;p=platform%2Fkernel%2Flinux-rpi3.git 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 Reported-by: Dave Chinner Fixes: c2df40 ("drivers: use req op accessor"); Reviewed-by: Ming Lei Signed-off-by: Jens Axboe --- diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 075377e..91c2c88 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);