loop: don't try to use AIO for discards
[deliverable/linux.git] / drivers / block / loop.c
index 075377eee0c0bcafed761e4034ab69e17ef9d5b8..91c2c881cb49807cf67516ff31aa60f066cb2cbe 100644 (file)
@@ -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);
 
This page took 0.038126 seconds and 5 git commands to generate.