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

Keith Busch
2025-02-13T01:58:37Z

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?