io_uring: add lookup table for various opcode needs
authorJens Axboe <axboe@kernel.dk>
Wed, 18 Dec 2019 16:50:26 +0000 (09:50 -0700)
committerJens Axboe <axboe@kernel.dk>
Sat, 28 Dec 2019 23:06:22 +0000 (16:06 -0700)
commit13ea85d914260d36da63d1d76fbecbf0d25a9fa7
treecea90703e8579f34c2a9e5cbd19c3ccbfbccd040
parent23066b9bcac07ca9e2070136c39e37ee1ed29631
io_uring: add lookup table for various opcode needs

We currently have various switch statements that check if an opcode needs
a file, mm, etc. These are hard to keep in sync as opcodes are added. Add
a struct io_op_def that holds all of this information, so we have just
one spot to update when opcodes are added.

This also enables us to NOT allocate req->io if a deferred command
doesn't need it, and corrects some mistakes we had in terms of what
commands need mm context.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c