Skip to content

Commit f0225ca

Browse files
Christoph Hellwigaxboe
authored andcommitted
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 <[email protected]> Reported-by: Dave Chinner <[email protected]> Fixes: c2df40 ("drivers: use req op accessor"); Reviewed-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent c0f3fd2 commit f0225ca

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/block/loop.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,11 +1659,15 @@ static int loop_queue_rq(struct blk_mq_hw_ctx *hctx,
16591659
if (lo->lo_state != Lo_bound)
16601660
return -EIO;
16611661

1662-
if (lo->use_dio && (req_op(cmd->rq) != REQ_OP_FLUSH ||
1663-
req_op(cmd->rq) == REQ_OP_DISCARD))
1664-
cmd->use_aio = true;
1665-
else
1662+
switch (req_op(cmd->rq)) {
1663+
case REQ_OP_FLUSH:
1664+
case REQ_OP_DISCARD:
16661665
cmd->use_aio = false;
1666+
break;
1667+
default:
1668+
cmd->use_aio = lo->use_dio;
1669+
break;
1670+
}
16671671

16681672
queue_kthread_work(&lo->worker, &cmd->work);
16691673

0 commit comments

Comments
 (0)