Re: [PATCH] io_uring: add support for IORING_REGISTER_FILES_UPDATE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/4/19 9:34 AM, Jeff Moyer wrote:
> Jens Axboe <axboe@xxxxxxxxx> writes:
> 
>> Allows the application to remove/replace/add files to/from a file set.
>> Passes in a struct:
>>
>> struct io_uring_files_update {
>>          __u32 offset;
>>          __s32 *fds;
>> };
>>
>> that holds an array of fds, size of array passed in through the usual
>> nr_args part of the io_uring_register() system call. The logic is as
>> follows:
>>
>> 1) If ->fds[i] is -1, the existing file at i + ->offset is removed from
>>     the set.
>> 2) If ->fds[i] is a valid fd, the existing file at i + ->offset is
>>     replaced with ->fds[i].
>>
>> For case #2, is the existing file is currently empty (fd == -1), the
>> new fd is simply added to the array.
> 
> If I'm reading this (and the code) right, that means you can't add files
> to a set.  Wouldn't that be a useful thing to do, instead of just
> replacing existing ones?

You can add files to a set, you just can't grow a set beyond the size
you originally registered. I actually forgot to post the pre-patch for
this, which is:

http://git.kernel.dk/cgit/linux-block/commit/?h=for-5.5/io_uring&id=fb3e60f87aa43f4f047f01243d6be54dadd9d67a

This allows registering -1 as the fd, so you could register 10 files,
but an array of size 500 (for example), and the last 490 fds are just
-1. Then you can use the IORING_REGISTER_FILES_UPDATE to replace those
empty fds with real files later on.

> Can you post the man page update along with this?

Yes, I'll write the documentation too, just wanted consensus on the
approach before I wrote up documentation.

-- 
Jens Axboe




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux