io_uring: change submit file state invariant
authorPavel Begunkov <asml.silence@gmail.com>
Fri, 20 Nov 2020 15:50:50 +0000 (15:50 +0000)
committerJens Axboe <axboe@kernel.dk>
Wed, 9 Dec 2020 19:04:01 +0000 (12:04 -0700)
commit6e1271e60c1d5e822fd1a32a56d52d9ae1823e62
tree499ef5d3dfac0f37a3742e718f4cb5e672ba2563
parent65b2b213484acd89a3c20dbb524e52a2f3793b78
io_uring: change submit file state invariant

Keep submit state invariant of whether there are file refs left based on
state->nr_refs instead of (state->file==NULL), and always check against
the first one. It's easier to track and allows to remove 1 if. It also
automatically leaves struct submit_state in a consistent state after
io_submit_state_end(), that's not used yet but nice.

btw rename has_refs to file_refs for more clarity.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c