Re: [PATCH 12/13] RFC: pnfs: add LAYOUTGET and GETDEVICEINFO infrastructure

Trond Myklebust
2010-09-10T22:44:11Z

On Fri, 2010-09-10 at 14:47 -0700, Fred Isaman wrote:
> On Fri, Sep 10, 2010 at 1:11 PM, Trond Myklebust
> <Trond.Myklebust@netapp.com> wrote:
> > On Thu, 2010-09-02 at 14:00 -0400, Fred Isaman wrote:
> >> From: The pNFS Team <linux-nfs@vger.kernel.org>
> >> static void
> >> init_lseg(struct pnfs_layout_hdr *lo, struct pnfs_layout_segment *lseg)
> >> {
> >> @@ -191,7 +210,7 @@ destroy_lseg(struct kref *kref)
> >> struct pnfs_layout_hdr *local = lseg->layout;
> >>
> >> dprintk("--> %s\n", __func__);
> >> - kfree(lseg);
> >> + PNFS_LD_IO_OPS(local)->free_lseg(lseg);
> >
> > Where is PNFS_LD_IO_OPS() defined? Besides, I thought we agreed to get
> > rid of that.
>
> This is defined in pnfs.h as
> PNFS_NFS_SERVER()->pnfs_curr_ld->ld_io_iops, mainly to save typing.

It may save typing in the short term, but long-term it mainly serves to
hide the various levels of indirection. I'd prefer to have the latter
obvious to people in order to encourage them to think more carefully
about how to avoid recalculating these values over and over again.

Cheers
Trond