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>
Wed, 15 Jan 2020 22:05:01 +0000 (15:05 -0700)
commit471441417ed294bcb8f66e5ec92f969091ade6d4
tree25009f912810d42dd4639ce800113831578655e8
parent8300cf830b6cbd03eb69c87b1d7209194fd080a9
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