io_uring: add support for IORING_SETUP_CLAMP
authorJens Axboe <axboe@kernel.dk>
Sat, 28 Dec 2019 22:39:54 +0000 (15:39 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 15 Jan 2020 22:05:02 +0000 (15:05 -0700)
commit0ef77a84f2414b520508da126ef1e43ee24829bf
treea41da0a5c7c391688893e30e8ab85e802793743b
parentea5c55d9075b03ae8d2f29d56451493bc355aa2b
io_uring: add support for IORING_SETUP_CLAMP

Some applications like to start small in terms of ring size, and then
ramp up as needed. This is a bit tricky to do currently, since we don't
advertise the max ring size.

This adds IORING_SETUP_CLAMP. If set, and the values for SQ or CQ ring
size exceed what we support, then clamp them at the max values instead
of returning -EINVAL. Since we return the chosen ring sizes after setup,
no further changes are needed on the application side. io_uring already
changes the ring sizes if the application doesn't ask for power-of-two
sizes, for example.

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