[pnfs] [PATCH 6/9] layoutrecall: implement RECALL_ALL

Benny Halevy bhalevy at panasas.com
Thu Aug 30 09:32:54 EDT 2007


do the per-fsid song and dance for all mounted filesystems
in the RECALL_ALL case or for the filesystem matching the
fsid arg in the RECALL_FSID case.

The per-fsid loop was moved under the cl_sem lock otherwise
to allow traversal of cl_superblocks.

Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfs/delegation.c |   66 +++++++++++++++++++++++---------------------------
 1 files changed, 30 insertions(+), 36 deletions(-)

diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index a94aced..db43b6e 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -384,52 +384,46 @@ static int recall_layout_thread(void *data)
 		goto out;
 	}
 
+	args->rl.cbl_seg.offset = 0;
+	args->rl.cbl_seg.length = NFS4_LENGTH_EOF;
+
 	down_read(&clp->cl_sem);
 	list_for_each_entry(server, &clp->cl_superblocks, nfs4_siblings) {
 		dprintk("%s: fsid 0x%llx-0x%llx 0x%llx-0x%llx\n",
 			__FUNCTION__, args->rl.cbl_fsid.major, args->rl.cbl_fsid.minor,
 			server->fsid.major, server->fsid.minor);
 
-		if (server->fsid.major == args->rl.cbl_fsid.major &&
-			server->fsid.minor == args->rl.cbl_fsid.minor) {
-			found = 1;
-			break;
+		if (args->rl.cbl_recall_type == RECALL_ALL ||
+		    (server->fsid.major == args->rl.cbl_fsid.major &&
+		     server->fsid.minor == args->rl.cbl_fsid.minor)) {
+			sb = server->sb;
+			if (!sb)
+				continue;
+			/* XXX UGLY UGLY hack alert! */
+			do {
+				found = 0;
+				spin_lock(&inode_lock);
+				list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
+					if (NFS_I(inode)->current_layout) {
+						found = 1;
+						break;
+					}
+				}
+				spin_unlock(&inode_lock);
+
+				if (found) {
+					igrab(inode);
+					pnfs_return_layout(inode, &args->rl.cbl_seg);
+					iput(inode);
+				}
+			} while(found);
+
+			if (args->rl.cbl_recall_type != RECALL_ALL)
+				break;
 		}
 	}
-
 	up_read(&clp->cl_sem);
 
-        if (found) {
-		sb = server->sb;
-		if (!sb)
-			goto out;
-	}
-	else
-		goto out;
-
-	args->rl.cbl_seg.offset = 0;
-	args->rl.cbl_seg.length = NFS4_LENGTH_EOF;
-
-	/* XXX UGLY UGLY hack alert! */
-	do {
-		found = 0;
-		spin_lock(&inode_lock);
-		list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
-			if (NFS_I(inode)->current_layout) {
-				found = 1;
-				break;
-			}
-		}
-		spin_unlock(&inode_lock);
-
-		if (found) {
-			igrab(inode);
-			pnfs_return_layout(inode, &args->rl.cbl_seg);
-			iput(inode);
-		}
-
-	} while(found);
-
 out:
 	module_put_and_exit(0);
 	printk("%s: exit status %d\n", __FUNCTION__, args->result);
-- 
1.5.2.5



More information about the pNFS mailing list