loop: simplify do_req_filebacked()
authorMing Lei <ming.lei@redhat.com>
Sat, 22 Mar 2025 01:26:10 +0000 (09:26 +0800)
committerJens Axboe <axboe@kernel.dk>
Sat, 22 Mar 2025 17:39:45 +0000 (11:39 -0600)
commit04dcb8a909b5b68464ec5ccb123e9614f3ac333d
treeb9ba6273b7a30f7ff3513a0694b350010f47ffbc
parent3c9f0c9326b625bf008962d58996f89a3bba1e12
loop: simplify do_req_filebacked()

lo_rw_aio() is only called for READ/WRITE operation, which can be
figured out from request directly, so remove 'rw' parameter from
lo_rw_aio(), meantime rename the local variable as 'dir' which makes
the check more readable in lo_rw_aio().

Meantime add lo_rw_simple() so that do_req_filebacked() can be
simplified in the following way:

```
if (cmd->use_aio)
return lo_rw_aio(lo, cmd, pos);
else
return lo_rw_simple(lo, rq, pos);
```

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250322012617.354222-2-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/loop.c