io_uring: follow **iovec idiom in io_import_iovec
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 13 Jul 2020 19:59:20 +0000 (22:59 +0300)
committerJens Axboe <axboe@kernel.dk>
Fri, 24 Jul 2020 18:55:44 +0000 (12:55 -0600)
commit252917c30f551e8e4377faac81d7fcf8e9629df1
tree938627f73a8b73ee2aef2c2dfa59d63db7da13c2
parentc3e330a493740a2a8312dcb7b1cffceaec7f619a
io_uring: follow **iovec idiom in io_import_iovec

As for import_iovec(), return !=NULL iovec from io_import_iovec() only
when it should be freed. That includes returning NULL when iovec is
already in req->io, because it should be deallocated by other means,
e.g. inside op handler. After io_setup_async_rw() local iovec to ->io,
just mark it NULL, to follow the idea in io_{read,write} as well.

That's easier to follow, and especially useful if we want to reuse
per-op space for completion data.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
[axboe: only call kfree() on non-NULL pointer]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c