[pnfs] [PATCH 8/8] pnfs: pnfs_return_layout-done framework
Benny Halevy
bhalevy at panasas.com
Wed Mar 12 11:30:43 EDT 2008
On Mar. 10, 2008, 20:39 +0200, andros at umich.edu wrote:
> From: Andy Adamson <andros at umich.edu>
>
> pnfs_return_layout_done() is where layout stateid processing will occur.
>
> Signed-off-by: Andy Adamson<andros at umich.edu>
> ---
> fs/nfs/nfs4proc.c | 7 +++++++
> fs/nfs/pnfs.c | 23 +++++++++++++++++------
> fs/nfs/pnfs.h | 3 +++
> 3 files changed, 27 insertions(+), 6 deletions(-)
>
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 729e14e..5925612 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -5405,12 +5405,19 @@ static void nfs4_pnfs_layoutreturn_done(struct rpc_task *task, void *calldata)
> struct nfs4_pnfs_layoutreturn *lrp = calldata;
> struct inode *ino = lrp->args->inode;
> struct nfs_server *server = NFS_SERVER(ino);
> + struct nfs_inode *nfsi = NFS_I(ino);
> + struct pnfs_layout_type *lo;
>
> dprintk("--> %s\n", __func__);
> if (RPC_ASSASSINATED(task))
> return;
>
> nfs4_sequence_done(server, &lrp->res->seq_res, task->tk_status);
> +
> + lo = nfsi->current_layout;
> + BUG_ON(!lo);
untrue for return_type != RETURN_FILE, in which case you
just want to return here, otherwise grab the lock ...
> +
> + pnfs_return_layout_done(lo, lrp, task->tk_status);
... and put_unlock here.
> dprintk("<-- %s\n", __func__);
> }
>
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index e4ed81f..bce2597 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -549,11 +549,13 @@ pnfs_return_layout(struct inode *ino, struct nfs4_pnfs_layout_segment *range,
> struct nfs_server *server = NFS_SERVER(ino);
> int status;
>
> + dprintk("-->%s\n", __func__);
nit: missing space between "-->" and "%s"
> +
> lo = get_lock_current_layout(nfsi);
> if (lo == NULL)
> return 0;
>
> - dprintk("%s:Begin layout %p\n", __FUNCTION__, lo);
> + dprintk("%s layout %p\n", __func__, lo);
how about just adding the "layout %p" part to the previous dprintk you added?
>
> arg.reclaim = 0;
> arg.layout_type = server->pnfs_curr_ld->id;
> @@ -568,17 +570,26 @@ pnfs_return_layout(struct inode *ino, struct nfs4_pnfs_layout_segment *range,
> arg.inode = ino;
>
> pnfs_free_layout(lo, &arg.lseg);
> -
> spin_unlock(&nfsi->lo_lock);
right, but only for the type==RETURN_FILE case
> - status = server->nfs_client->rpc_ops->pnfs_layoutreturn(&gdata);
> - spin_lock(&nfsi->lo_lock);
>
> - put_unlock_current_layout(nfsi, lo);
> + status = server->nfs_client->rpc_ops->pnfs_layoutreturn(&gdata);
>
> - dprintk("%s:Exit status %d\n", __FUNCTION__, status);
> + dprintk("<--%s status %d\n", __func__, status);
nit: missing space between "-->" and "%s"
> return status;
> }
>
> +void
> +pnfs_return_layout_done(struct pnfs_layout_type *lo,
> + struct nfs4_pnfs_layoutreturn *lrp, int rpc_status)
> +{
> + dprintk("-->%s inode %p\n", __func__, lo->inode);
nit: missing space between "-->" and "%s"
> +
> + /* will do stateid work here */
> +
> + dprintk("<-- %s \n", __func__);
nit: trailing space after "%s"
> + return;
> +}
> +
> /*
> * cmp two layout segments for sorting into layout cache
> */
> diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
> index 0e0e678..69ba7bc 100644
> --- a/fs/nfs/pnfs.h
> +++ b/fs/nfs/pnfs.h
> @@ -50,6 +50,9 @@ ssize_t pnfs_file_write(struct file *, const char __user *, size_t, loff_t *);
> void pnfs_get_layout_done(struct pnfs_layout_type *,
> struct nfs4_pnfs_layoutget *, int);
> void pnfs_layout_release(struct pnfs_layout_type *);
> +void pnfs_return_layout_done(struct pnfs_layout_type *,
> + struct nfs4_pnfs_layoutreturn *, int);
> +
>
> #endif /* CONFIG_PNFS */
>
More information about the pNFS
mailing list