Re: [for-6.13 PATCH 05/19] nfs/localio: remove extra indirect nfs_to call to check {read,write}_iter

Mike Snitzer
2024-11-11T15:09:11Z

On Mon, Nov 11, 2024 at 12:20:12PM +1100, NeilBrown wrote:
> On Sat, 09 Nov 2024, Mike Snitzer wrote:
> > Push the read_iter and write_iter availability checks down to
> > nfs_do_local_read and nfs_do_local_write respectively.
> >
> > This eliminates a redundant nfs_to->nfsd_file_file() call.
>
> Do it?

It does.. it is harder to see just from looking at the patch.

> The patch removes 2 of these calls and add 2 of these calls. So it
> isn't clear what is being eliminated.
>
> Maybe it is a good thing to do, but it isn't obvious to me why.

nfs_local_doio() is common to both read and write, and both
nfs_do_local_read() and nfs_do_local_write() already call
nfs_to->nfsd_file_file(). This patch simply pushes nfs_local_doio()'s
nfs_to->nfsd_file_file() call down to nfs_do_local_{read,write} (or
put differently: moves their respective calls earlier) to kill 2 birds
with 1 stone. Hence it eliminates an extra call to
nfs_to->nfsd_file_file() in both read and write paths.

Mike