Re: [PATCH 1/2] nfs: remove ->write_pageio_init from rpc ops

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

 



> > +	struct nfs_server *server = NFS_SERVER(inode);
> > +	const struct nfs_pageio_ops *pg_ops = &nfs_pageio_write_ops;
> > +
> > +#if IS_ENABLED(CONFIG_NFS_V4)
> > +	if (server->pnfs_curr_ld)
> > +		pg_ops = server->pnfs_curr_ld->pg_write_ops;
> > +#endif
> > +	nfs_pageio_init(pgio, inode, pg_ops, compl_ops, server->wsize, ioflags);
> >  }
> 
> I thought it was bad style to put a #ifdef in the middle of a function, which is why we have so many noop functions in the rest of the code.  Should this be done with a select_compl_ops() function instead?

I don't think it's much of a problem for a small and readable function
with a single ifdef.  And we'd need one helper for read and write each,
which would make the code much harder to read.  Still better than what's
there currently, though.

The other option would be to simply always have the pnfs_curr_ld field
in the server structure and remove the ifdef entirely.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux