[pnfs] CVS: nfsv4
Benny Halevy
bhalevy at panasas.com
Tue Dec 5 03:09:06 EST 2006
Marc, a struct layout_return is defined and initialized in
nfs4_pnfs_return_layout() but it doesn't seem to be used
otherwise...
Benny
> @@ -3619,6 +3624,7 @@
> struct inode *ino = current_fh->fh_dentry->d_inode;
> struct nfs4_file *fp;
> struct nfs4_layout *lp = NULL;
> + struct layout_return lr;
>
> dprintk("NFSD: nfs4_pnfs_return_layout\n");
>
> @@ -3637,6 +3643,12 @@
> dprintk("pNFS %s: lp %p\n", __FUNCTION__, lp);
>
> if (lp) {
> + lr.reclaim = 0;
> + lr.offset = lrp->lr_offset;
> + lr.length = lrp->lr_length;
> + lr.iomode = lrp->lr_iomode;
> + lr.layout_type = lrp->lr_type;
> + lr.flags = 1; /* update return */
> if (sb->s_export_op->layout_return) {
> status = sb->s_export_op->layout_return(current_fh->fh_dentry->d_inode,
> lrp);
Marc Eshel (IBM) wrote:
> CVSROOT: /cvs
> Module name: nfsv4
> Changes by: eshel at citi. 2006/12/04 16:42:13
>
> Modified files:
> cvs/pnfs/fs/nfsd: nfs4state.c
>
> Log message:
> Add a flags to nfsd/fs interfaces to indicate if it is a new layout
> get/return or just update to help the fs to keep track of hold count.
>
> ===================================================================
> RCS file: /cvs/nfsv4/cvs/pnfs/fs/nfsd/nfs4state.c,v
> retrieving revision 1.18
> diff -u -r1.18 nfs4state.c
> --- nfs4state.c 4 Dec 2006 18:10:59 -0000 1.18
> +++ nfs4state.c 4 Dec 2006 21:35:19 -0000
> @@ -3414,7 +3414,8 @@
> lr.offset = lp->lo_offset;
> lr.length = lp->lo_length;
> lr.iomode = lp->lo_iomode;
> - lr.layout_type= lp->lo_layout_type;
> + lr.layout_type = lp->lo_layout_type;
> + lr.flags = 0; /* last return */
>
> //??? recall layout
>
> @@ -3475,6 +3476,8 @@
> lp->lo_offset = lg->lg_offset;
> lp->lo_length = lg->lg_length;
> num_layouts++;
> + list_add(&lp->lo_perfile, &fp->fi_layouts);
> + list_add(&lp->lo_perclnt, &clp->cl_layouts);
> get_nfs4_file(lp->lo_file);
> dprintk("NFSD alloc_init_layout exit\n");
> return lp;
> @@ -3542,6 +3545,19 @@
> if (fp == NULL)
> goto out;
> }
> + clp = find_confirmed_client((clientid_t *)&lgp->lg_clientid);
> + dprintk("pNFS %s: clp %p \n", __FUNCTION__, clp);
> + if (!clp)
> + goto out;
> +
> + lgp->lg_flags = 0;
> + while (!list_empty(&clp->cl_layouts)) {
> + lp = list_entry(fp->fi_layouts.next,
> + struct nfs4_layout, lo_perfile);
> + //??? if the right layout
> + lgp->lg_flags = 1; /* update layout */
> + break;
> + }
> if (sb->s_export_op->layout_get) {
> status = sb->s_export_op->layout_get(current_fh->fh_dentry->d_inode,
> (void *)lgp);
> @@ -3566,43 +3582,32 @@
> if (status)
> goto out;
>
> - while (!list_empty(&fp->fi_layouts)) {
> - lp = list_entry(fp->fi_layouts.next,
> - struct nfs4_layout, lo_perfile);
> - //??? if the right layout
> - break;
> + if (!lp) {
> + lp = pnfs_alloc_init_layout(fp, clp, current_fh, lgp);
> }
> - if (lp) {
> + else {
> get_nfs4_layout(lp);
> }
> - else {
> - clp = find_confirmed_client((clientid_t *)&lgp->lg_clientid);
> - dprintk("pNFS %s: clp %p \n", __FUNCTION__, clp);
> -
> - if (clp) {
> - lp = pnfs_alloc_init_layout(fp, clp, current_fh, lgp);
> - }
> - if (lp) {
> - dprintk("pNFS %s: lp %p\n", __FUNCTION__, lp);
> - pnfs_hash_layoutget(lp);
> - goto out;
> - }
> - status = nfserr_layouttrylater;
> -
> - if (lgp->lg_ops->layout_encode == NULL &&
> - lgp->lg_type == LAYOUT_NFSV4_FILES)
> - filelayout_free_layout(lgp->lg_layout);
> - else
> - lgp->lg_ops->layout_free(lgp->lg_layout);
> -
> - lr.reclaim = 0;
> - lr.offset = lgp->lg_offset;
> - lr.length = lgp->lg_length;
> - lr.iomode = lgp->lg_iomode;
> - lr.layout_type= lgp->lg_type;
> - if (sb->s_export_op->layout_return)
> - sb->s_export_op->layout_return(ino, &lr);
> + if (lp) {
> + dprintk("pNFS %s: lp %p\n", __FUNCTION__, lp);
> + goto out;
> }
> + status = nfserr_layouttrylater;
> +
> + if (lgp->lg_ops->layout_encode == NULL &&
> + lgp->lg_type == LAYOUT_NFSV4_FILES)
> + filelayout_free_layout(lgp->lg_layout);
> + else
> + lgp->lg_ops->layout_free(lgp->lg_layout);
> +
> + lr.reclaim = 0;
> + lr.offset = lgp->lg_offset;
> + lr.length = lgp->lg_length;
> + lr.iomode = lgp->lg_iomode;
> + lr.layout_type = lgp->lg_type;
> + lr.flags = lgp->lg_flags;
> + if (sb->s_export_op->layout_return)
> + sb->s_export_op->layout_return(ino, &lr);
> }
> out:
> if (fp)
> @@ -3619,6 +3624,7 @@
> struct inode *ino = current_fh->fh_dentry->d_inode;
> struct nfs4_file *fp;
> struct nfs4_layout *lp = NULL;
> + struct layout_return lr;
>
> dprintk("NFSD: nfs4_pnfs_return_layout\n");
>
> @@ -3637,6 +3643,12 @@
> dprintk("pNFS %s: lp %p\n", __FUNCTION__, lp);
>
> if (lp) {
> + lr.reclaim = 0;
> + lr.offset = lrp->lr_offset;
> + lr.length = lrp->lr_length;
> + lr.iomode = lrp->lr_iomode;
> + lr.layout_type = lrp->lr_type;
> + lr.flags = 1; /* update return */
> if (sb->s_export_op->layout_return) {
> status = sb->s_export_op->layout_return(current_fh->fh_dentry->d_inode,
> lrp);
>
> _______________________________________________
> pNFS mailing list
> pNFS at linux-nfs.org
> http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs
More information about the pNFS
mailing list