Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0225cac authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

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: default avatarChristoph Hellwig <hch@lst.de>
Reported-by: default avatarDave Chinner <david@fromorbit.com>
Fixes: c2df40 ("drivers: use req op accessor");
Reviewed-by: default avatarMing Lei <ming.lei@canonical.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent c0f3fd2b
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -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);