[pnfs] [PATCH 14/18] pnfs client get layout in commit path

William A. (Andy) Adamson andros at citi.umich.edu
Mon Jan 14 14:42:29 EST 2008


On Jan 14, 2008 2:26 PM, Dean Hildebrand <seattleplus at gmail.com> wrote:

>
>
> andros at umich.edu wrote:
> > From: Andy Adamson <andros at umich.edu>
> >
> > Check for a cached layout prior to flushing writes.
> >
> > Signed-off by: Andy Adamson<andros at umich.edu>
> > ---
> >  fs/nfs/pnfs.c  |   26 ++++++++++++++++++++++++++
> >  fs/nfs/pnfs.h  |    1 +
> >  fs/nfs/write.c |   18 ++++++++++++------
> >  3 files changed, 39 insertions(+), 6 deletions(-)
> >
> > diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> > index 4c5c1e9..f77a292 100644
> > --- a/fs/nfs/pnfs.c
> > +++ b/fs/nfs/pnfs.c
> > @@ -740,6 +740,32 @@ pnfs_pageio_init_write(struct nfs_pageio_descriptor
> *pgio, struct inode * inode)
> >       pnfs_set_pg_test(inode, pgio);
> >  }
> >
> > +/*
> > + * Get a layoutout for COMMIT
> > + */
> > +void
> > +pnfs_update_layout_commit(struct inode *inode,
> > +                     struct list_head *head,
> > +                     pgoff_t idx_start,
> > +                     unsigned int npages)
> > +{
> > +     struct nfs_server *nfss = NFS_SERVER(inode);
> > +     struct nfs_page *nfs_page = nfs_list_entry(head->next);
> > +     int status;
> > +
> > +     dprintk("--> %s inode %p layout range: %Zd@%Lu\n", __func__,
> inode,
> > +                             (size_t)(npages * PAGE_SIZE),
> > +                             (loff_t)idx_start * PAGE_SIZE);
> > +
> > +     if (!pnfs_enabled_sb(nfss))
> > +             return;
> > +     status = virtual_update_layout(inode, nfs_page->wb_context,
> > +                             (size_t)npages * PAGE_SIZE,
> > +                             (loff_t)idx_start * PAGE_SIZE,
> > +                             IOMODE_RW);
> > +     dprintk("%s  virt update status %d\n", __func__, status);
> > +}
> >
> 1. Could we rename this function?  Using ...layout_commit in the title,
> but yet has nothing to do with the layoutcommit operation is quite
> confusing.  How about pnfs_commit_update_layout?


agreed - bad name choice. pnfs_commit_update_layout is indeed better.

>
> 2. This is just an observation, and I may be totally wrong, but this
> function actually seems to have very little do do with the commit
> operation.  Should we just make it generic and pass in commit related
> args (e.g., pass in the sizes for virtual_update_layout)?


in benny's tree, the client-layout-cache branch, it is a wrapper for
pnfs_update_layout. this function serves two purposes: translate the sizes,
offsets, context etc and performs the necessary pnfs_enabled check. so i
think this has been addressed in benny's tree.


-->Andy

>
> Dean
> > +
> >  /* This is utilized in the paging system to determine if
> >   * it should use the NFSv4 or pNFS read path.
> >   * If count < 0, we do not check the I/O size.
> > diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
> > index a5883ba..0f86db4 100644
> > --- a/fs/nfs/pnfs.h
> > +++ b/fs/nfs/pnfs.h
> > @@ -52,6 +52,7 @@ int pnfs_try_to_commit(struct inode *, struct
> nfs_write_data *, struct list_head
> >  void pnfs_commit_done_norpc(struct rpc_task *, void *);
> >  void pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode
> *, struct nfs_open_context *, struct list_head *, size_t *);
> >  void pnfs_pageio_init_write(struct nfs_pageio_descriptor *, struct
> inode *);
> > +void pnfs_update_layout_commit(struct inode *, struct list_head *,
> pgoff_t, unsigned int);
> >
> >  #endif /* CONFIG_PNFS */
> >
> > diff --git a/fs/nfs/write.c b/fs/nfs/write.c
> > index c3d2d15..0d081d4 100644
> > --- a/fs/nfs/write.c
> > +++ b/fs/nfs/write.c
> > @@ -1276,12 +1276,13 @@ void nfs_initiate_commit(struct nfs_write_data
> *data,
> >  /*
> >   * Set up the argument/result storage required for the RPC call.
> >   */
> > -void nfs_commit_rpcsetup(struct list_head *head,
> > +int nfs_commit_rpcsetup(struct list_head *head,
> >               struct nfs_write_data *data,
> >               int how)
> >  {
> >       struct nfs_page         *first;
> >       struct inode            *inode;
> > +     int ret = 0;
> >
> >       /* Set up the RPC argument and reply structs
> >        * NB: take care not to mess about with data->commit et al. */
> > @@ -1305,10 +1306,11 @@ void nfs_commit_rpcsetup(struct list_head *head,
> >  #ifdef CONFIG_PNFS
> >       data->args.context = first->wb_context;  /* used by commit done */
> >
> > -     if ((data->error = pnfs_try_to_commit(inode, data, head, how)) <=
> 0)
> > -             return;
> > +     if ((ret = pnfs_try_to_commit(inode, data, head, how)) <= 0)
> > +             return ret;
> >  #endif /* CONFIG_PNFS */
> >       nfs_initiate_commit(data, NFS_CLIENT(inode), how);
> > +     return ret;
> >  }
> >
> >  /*
> > @@ -1319,6 +1321,7 @@ nfs_commit_list(struct inode *inode, struct
> list_head *head, int how)
> >  {
> >       struct nfs_write_data   *data;
> >       struct nfs_page         *req;
> > +     int ret;
> >
> >       data = nfs_commit_alloc();
> >
> > @@ -1326,10 +1329,10 @@ nfs_commit_list(struct inode *inode, struct
> list_head *head, int how)
> >               goto out_bad;
> >
> >       /* Set up the argument struct */
> > -     nfs_commit_rpcsetup(head, data, how);
> > +     ret = nfs_commit_rpcsetup(head, data, how);
> >  #ifdef CONFIG_PNFS
> > -     if (data->error)
> > -             return data->error;
> > +     if (ret < 0)
> > +             return ret;
> >  #endif /* CONFIG_PNFS */
> >
> >       return 0;
> > @@ -1473,6 +1476,9 @@ long nfs_sync_mapping_wait(struct address_space
> *mapping, struct writeback_contr
> >               }
> >               pages += nfs_scan_commit(inode, &head, 0, 0);
> >               spin_unlock(&inode->i_lock);
> > +#ifdef CONFIG_PNFS
> > +             pnfs_update_layout_commit(inode, &head, idx_start,
> npages);
> > +#endif /* CONFIG_PNFS */
> >               ret = nfs_commit_list(inode, &head, how);
> >               spin_lock(&inode->i_lock);
> >
> >
> _______________________________________________
> pNFS mailing list
> pNFS at linux-nfs.org
> http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://linux-nfs.org/pipermail/pnfs/attachments/20080114/fe65358f/attachment-0001.htm 


More information about the pNFS mailing list