[pnfs] [PATCH 16/18] pnfs client filelayout_commit
William A. (Andy) Adamson
andros at citi.umich.edu
Mon Jan 14 14:45:46 EST 2008
On Jan 14, 2008 2:32 PM, Dean Hildebrand <seattleplus at gmail.com> wrote:
>
>
> andros at umich.edu wrote:
> > From: Andy Adamson <andros at umich.edu>
> >
> > If calling commit to the MDS, return 1 to pnfs_try_to_commit. If calling
> > commit to DS, set the correct DS address in the call to
> nfs_initiate_commit.
> >
> > The commit code was passing in a strut list_head of pages as an
> argument,
> > but this is an empty list, its contents have already been moved to
> data->pages.
> >
> > Try to make the pnfs_try_to_commit path more closely resemble the
> > pnfs_try_to_write path.
> >
> > NOTE: The filelayout_commit() code gathers pages per DS - I left this
> code
> > alone, but it should be reviewed because I think it is unnecessary
> because
> > the pages have already been gathered per DS in the write path.
> >
> I would love to see comments like this placed in the code rather than
> just the patch. I'm worried that once the patch is applied no one will
> ever remember to do this review.
ok - good suggestion for the future. i'll be sending 2-3 patches that change
the filelayout_commit code for per DS commit today or tomorrow, so this code
will be reviewed....
-->Andy
>
> > Signed-off by: Fred Isaman<iisaman at umich.edu>
> > Signed-off by: Andy Adamson<andros at umich.edu>
> > ---
> > fs/nfs/nfs4filelayout.c | 16 ++++++++--------
> > fs/nfs/pnfs.c | 22 +++++++++-------------
> > fs/nfs/pnfs.h | 4 ++--
> > fs/nfs/write.c | 4 +++-
> > include/linux/nfs4_pnfs.h | 2 +-
> > 5 files changed, 23 insertions(+), 25 deletions(-)
> >
> > diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
> > index 48bd470..d8876a9 100644
> > --- a/fs/nfs/nfs4filelayout.c
> > +++ b/fs/nfs/nfs4filelayout.c
> > @@ -72,6 +72,7 @@ extern struct nfs_write_data *nfs_commit_alloc(void);
> > extern void nfs_commit_free(struct nfs_write_data *p);
> > extern void nfs_initiate_write(struct nfs_write_data *, struct rpc_clnt
> *, const struct rpc_call_ops *, int);
> > extern void nfs_initiate_read(struct nfs_read_data *data, struct
> rpc_clnt *clnt, const struct rpc_call_ops *call_ops);
> > +extern void nfs_initiate_commit(struct nfs_write_data *, struct
> rpc_clnt *, int);
> > extern void nfs_read_validate(struct rpc_task *task, void *calldata);
> > extern void nfs_readdata_release(void *data);
> > extern void nfs_write_validate(struct rpc_task *task, void *calldata);
> > @@ -516,7 +517,7 @@ filelayout_fsync(struct pnfs_layout_type *layoutid,
> > * Once we fix this, we will need to invoke the pnfs_commit_complete
> callback.
> > */
> > int
> > -filelayout_commit(struct pnfs_layout_type *layoutid, struct inode *ino,
> struct list_head *pages, int sync, struct nfs_write_data *data)
> > +filelayout_commit(struct pnfs_layout_type *layoutid, struct inode *ino,
> int sync, struct nfs_write_data *data)
> > {
> > struct nfs_write_data *dsdata = NULL;
> > struct pnfs_layout_type *laytype;
> > @@ -538,13 +539,13 @@ filelayout_commit(struct pnfs_layout_type
> *layoutid, struct inode *ino, struct l
> >
> > if (nfslay->commit_through_mds) {
> > dprintk("%s data %p commit through mds\n", __FUNCTION__,
> data);
> > - nfs_commit_rpcsetup(data, sync);
> > - nfs_execute_write(data);
> > - return 0;
> > + return 1;
> > }
> > +
> > dev = nfs4_pnfs_device_item_get(ino, nfslay->dev_id);
> > fdev = &dev->stripe_devs[0];
> >
> > + /* Gather pages per DS - Isn't this already done in
> nfs_pageio_init?*/
> > for (i = 0; i < nfslay->num_fh; i++) {
> > /* just try the first data server for the index..*/
> > ds = fdev->ds_list[0];
> > @@ -581,22 +582,21 @@ filelayout_commit(struct pnfs_layout_type
> *layoutid, struct inode *ino, struct l
> > }
> > first = nfs_list_entry(dsdata->pages.next);
> >
> > - dprintk("%s call nfs_commit_rpcsetup i %d devid %d\n",
> > + dprintk("%s call nfs_initiate_commit i %d devid %d\n",
> > __FUNCTION__, i, nfslay->dev_id);
> >
> > dsdata->pnfs_client = ds->ds_clp->cl_rpcclient;
> > dsdata->ds_nfs_client = ds->ds_clp;
> > dserver.dev = fdev;
> >
> > - nfs_commit_rpcsetup(dsdata, sync);
> > -
> > /* TODO: Is the FH different from NFS_FH(data->inode)?
> > * (set in nfs_commit_rpcsetup)
> > */
> > dserver.fh = &nfslay->fh_array[i];
> > dsdata->args.fh = dserver.fh;
> >
> > - nfs_execute_write(dsdata);
> > + nfs_initiate_commit(dsdata, dsdata->pnfs_client, sync);
> > +
> > dsdata = NULL;
> > fdev++;
> > }
> > diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> > index f77a292..3f5ee35 100644
> > --- a/fs/nfs/pnfs.c
> > +++ b/fs/nfs/pnfs.c
> > @@ -1306,17 +1306,18 @@ fallback:
> > return do_sync_write(filp, buf, count, pos);
> > }
> >
> > -int pnfs_try_to_commit(struct inode *inode, struct nfs_write_data
> *data, struct list_head *head, int how)
> > +int pnfs_try_to_commit(struct nfs_write_data *data)
> > {
> > + struct inode *inode = data->inode;
> > int status;
> >
> > if (!pnfs_use_write(inode, -1)) {
> > dprintk("%s: Not using pNFS I/O\n", __func__);
> > return 1;
> > } else {
> > - /* data->call_ops already set in nfs_commit_rpcsetup */
> > + /* data->call_ops and data->how set in nfs_commit_rpcsetup
> */
> > dprintk("%s Utilizing pNFS I/O\n", __func__);
> > - status = pnfs_commit(inode, head, how, data);
> > + status = pnfs_commit(data, data->how);
> > return status;
> > }
> > }
> > @@ -1338,34 +1339,29 @@ pnfs_commit_done(struct nfs_write_data *data,
> ssize_t status)
> > }
> >
> > int
> > -pnfs_commit(struct inode *inode,
> > - struct list_head *head,
> > - int sync,
> > - struct nfs_write_data *data)
> > +pnfs_commit(struct nfs_write_data *data, int sync)
> > {
> > int result = 0;
> > - struct nfs_inode *nfsi = NFS_I(inode);
> > - struct nfs_server *nfss = NFS_SERVER(inode);
> > + struct nfs_inode *nfsi = NFS_I(data->inode);
> > + struct nfs_server *nfss = NFS_SERVER(data->inode);
> > dprintk("%s: Begin\n", __FUNCTION__);
> >
> > /* If the layout driver doesn't define its own commit function
> > * OR no layout have been retrieved,
> > * use standard NFSv4 commit
> > */
> > - if (!nfsi->current_layout ||
> > - !nfss->pnfs_curr_ld->ld_io_ops->commit) {
> > + if (!nfsi->current_layout ||
> !nfss->pnfs_curr_ld->ld_io_ops->commit) {
> > /* TODO: This doesn't match o_direct commit
> > * processing. We need to align regular
> > * and o_direct commit processing.
> > */
> > dprintk("%s: Not using pNFS\n",__func__);
> > - nfs_initiate_commit(data, NFS_CLIENT(inode), sync);
> > return 1;
> > }
> >
> > dprintk("%s: Calling layout driver commit\n", __FUNCTION__);
> > result =
> nfss->pnfs_curr_ld->ld_io_ops->commit(nfsi->current_layout,
> > - inode, head, sync,
> data);
> > + data->inode, sync,
> data);
> >
> > dprintk("%s end (err:%d)\n", __FUNCTION__, result);
> > return result;
> > diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
> > index 0f86db4..b314aff 100644
> > --- a/fs/nfs/pnfs.h
> > +++ b/fs/nfs/pnfs.h
> > @@ -47,8 +47,8 @@ int pnfs_use_nfsv4_wproto(struct inode *inode, ssize_t
> count);
> > int pnfs_use_nfsv4_rproto(struct inode *inode, ssize_t count);
> > unsigned int pnfs_getiosize(struct nfs_server *server);
> > void pnfs_set_ds_iosize(struct nfs_server *server);
> > -int pnfs_commit(struct inode *inode, struct list_head *head, int sync,
> struct nfs_write_data *data);
> > -int pnfs_try_to_commit(struct inode *, struct nfs_write_data *, struct
> list_head *, int);
> > +int pnfs_commit(struct nfs_write_data *data, int sync);
> > +int pnfs_try_to_commit(struct nfs_write_data *);
> > 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 *);
> > diff --git a/fs/nfs/write.c b/fs/nfs/write.c
> > index 0d081d4..4231915 100644
> > --- a/fs/nfs/write.c
> > +++ b/fs/nfs/write.c
> > @@ -1305,8 +1305,10 @@ int nfs_commit_rpcsetup(struct list_head *head,
> >
> > #ifdef CONFIG_PNFS
> > data->args.context = first->wb_context; /* used by commit done */
> > + data->call_ops = &nfs_commit_ops;
> > + data->how = how;
> >
> > - if ((ret = pnfs_try_to_commit(inode, data, head, how)) <= 0)
> > + if ((ret = pnfs_try_to_commit(data)) <= 0)
> > return ret;
> > #endif /* CONFIG_PNFS */
> > nfs_initiate_commit(data, NFS_CLIENT(inode), how);
> > diff --git a/include/linux/nfs4_pnfs.h b/include/linux/nfs4_pnfs.h
> > index 7b2473d..c5dd321 100644
> > --- a/include/linux/nfs4_pnfs.h
> > +++ b/include/linux/nfs4_pnfs.h
> > @@ -60,7 +60,7 @@ struct layoutdriver_io_operations {
> > * 1) the page list contains nfs_pages, NOT pages
> > * 2) currently the NFS code doesn't create a page array (as it
> does with read/write)
> > */
> > - int (*commit) (struct pnfs_layout_type *layoutid, struct inode *,
> struct list_head *, int sync, struct nfs_write_data *nfs_data);
> > + int (*commit) (struct pnfs_layout_type *layoutid, struct inode *,
> int sync, struct nfs_write_data *nfs_data);
> >
> > /* Layout information. For each inode, alloc_layout is executed
> once to retrieve an
> > * inode specific layout structure. Each subsequent layoutget
> operation results in
> >
> _______________________________________________
> 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/b9f08310/attachment.htm
More information about the pNFS
mailing list