[pnfs] CVS: nfsv4
Benny Halevy Panasas
bhalevy at citi.umich.edu
Thu Dec 28 04:21:20 EST 2006
CVSROOT: /cvs
Module name: nfsv4
Changes by: bhalevy at citi. 2006/12/28 04:21:20
Modified files:
cvs/pnfs/fs/nfsd: nfs4state.c
Log message:
* nfsd layout cache support for multiple clients per file
(still one layout per client)
* do not increase layout segment ref count on hit in layout_get
Signed-off-by: Benny Halevy <bhalevy at panasas.com>
Index: fs/nfsd/nfs4state.c
===================================================================
RCS file: /cvs/nfsv4/cvs/pnfs/fs/nfsd/nfs4state.c,v
retrieving revision 1.26
diff -d -u -p -r1.26 nfs4state.c
--- fs/nfsd/nfs4state.c 18 Dec 2006 17:18:45 -0000 1.26
+++ fs/nfsd/nfs4state.c 28 Dec 2006 09:18:38 -0000
@@ -449,6 +449,7 @@ expire_client(struct nfs4_client *clp)
lp = list_entry(clp->cl_layouts.next, struct nfs4_layout, lo_perclnt);
dprintk("NFSD: expire client. lp %p, fp %p\n", lp,
lp->lo_file);
+ BUG_ON(lp->lo_client != clp);
list_del_init(&lp->lo_perclnt);
list_move(&lp->lo_recall_lru, &reaplist);
}
@@ -3531,7 +3532,7 @@ int nfs4_pnfs_get_layout(struct super_bl
{
int status = -ENOENT;
struct inode *ino = current_fh->fh_dentry->d_inode;
- struct nfs4_file *fp;
+ struct nfs4_file *fp = NULL;
struct nfs4_client *clp = NULL;
struct nfs4_layout *lp = NULL;
struct nfsd4_pnfs_layoutreturn lr;
@@ -3550,12 +3551,12 @@ int nfs4_pnfs_get_layout(struct super_bl
goto out;
lgp->lg_flags = 0;
- while (!list_empty(&fp->fi_layouts)) {
- lp = list_entry(fp->fi_layouts.next,
- struct nfs4_layout, lo_perfile);
+ list_for_each_entry (lp, &fp->fi_layouts, lo_perfile) {
//??? if the right layout
- lgp->lg_flags = 1; /* update layout */
- break;
+ if (lp->lo_client == clp) {
+ 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,
@@ -3584,9 +3585,6 @@ int nfs4_pnfs_get_layout(struct super_bl
if (!lp) {
lp = pnfs_alloc_init_layout(fp, clp, current_fh, lgp);
}
- else {
- get_nfs4_layout(lp);
- }
if (lp) {
dprintk("pNFS %s: lp %p\n", __FUNCTION__, lp);
goto out;
@@ -3623,6 +3621,7 @@ int nfs4_pnfs_return_layout(struct super
int status = -ENOENT;
struct inode *ino = current_fh->fh_dentry->d_inode;
struct nfs4_file *fp;
+ struct nfs4_client *clp = NULL;
struct nfs4_layout *lp = NULL;
dprintk("NFSD: nfs4_pnfs_return_layout\n");
@@ -3633,11 +3632,15 @@ int nfs4_pnfs_return_layout(struct super
dprintk("pNFS %s: fp %p\n", __FUNCTION__, fp);
- while (!list_empty(&fp->fi_layouts)) {
- lp = list_entry(fp->fi_layouts.next,
- struct nfs4_layout, lo_perfile);
+ clp = find_confirmed_client((clientid_t *)&lrp->lr_clientid);
+ dprintk("pNFS %s: clp %p \n", __FUNCTION__, clp);
+ if (!clp)
+ goto out;
+
+ list_for_each_entry (lp, &fp->fi_layouts, lo_perfile) {
//??? if the right layout
- break;
+ if (lp->lo_client == clp)
+ break;
}
dprintk("pNFS %s: lp %p\n", __FUNCTION__, lp);
More information about the pNFS
mailing list