Re: [RFC PATCH 12/53] netfs: Provide tools to create a buffer in an xarray

From: David Howells
Date: Fri Nov 17 2023 - 15:11:54 EST


Jeff Layton <jlayton@xxxxxxxxxx> wrote:

> Some kerneldoc comments on these new helpers would be nice. I assume
> that "index" and "to" are "start" and "end" for this, but it'd be nice
> to make that explicit.

These are internal to netfs not API functions, so they shouldn't appear in the
API docs. That's why the declaration is in internal.h, not netfs.h.

That said, I could describe them better.

> > + ret = netfs_add_folios_to_buffer(buffer, mapping, want_index,
> > + have_index - 1, gfp_mask);
> > + if (ret < 0)
> > + return ret;
> > + have_folios += have_index - want_index;
> > +
> > + ret = netfs_add_folios_to_buffer(buffer, mapping,
> > + have_index + have_folios,
> > + want_index + want_folios - 1,
> > + gfp_mask);
>
> I don't get it. Why are you calling netfs_add_folios_to_buffer twice
> here? Why not just make one call? Either way, a comment here explaining
> that would also be nice.

The ranges aren't contiguous. They bracket the folios spliced from the
mapping. That being said, I seem to have lost a bit of maths somewhere.

Further, I'm not now using netfs_add_folios_to_buffer(), so I'll remove it.

David