Re: [PATCHv2 2/6] io_uring: create resource release callback

Pavel Begunkov
2025-02-13T13:05:23Z

On 2/13/25 01:58, Keith Busch wrote:
> On Thu, Feb 13, 2025 at 01:31:07AM +0000, Pavel Begunkov wrote:
>> On 2/11/25 00:56, Keith Busch wrote:
>>> @@ -24,6 +24,9 @@ struct io_rsrc_node {
>>> unsigned long file_ptr;
>>> struct io_mapped_ubuf *buf;
>>> };
>>> +
>>> + void (*release)(void *);
>>> + void *priv;
>>
>> Nodes are more generic than buffers. Unless we want to reuse it
>> for files, and I very much doubt that, it should move into
>> io_mapped_ubuf.
>
> Good point. Cloning is another reason it should be in the imu.
>
> If we want to save space, the "KBUFFER" type doesn't need ubuf or
> folio_shift, so we could even union the new fields to prevent imu from
> getting any bigger. The downside would be we can't use "release" to
> distinguish kernel vs user buffers, which you suggested in that patch's
> thread. Which option do you prefer?

I think we can just grow the struct for now, it's not a big
problem, and follow up on that separately. Should make it
easier for the series as well.

--
Pavel Begunkov