[pnfs] [PATCH] make layout_type id u32 consistently

Benny Halevy bhalevy at panasas.com
Thu Mar 8 11:51:18 EST 2007


Missing new line and a negative value printed for my private layout_type
led me to think id should be unsigned everywhere.

Signed-off-by: Benny Halevy <bhalevy at panasas.com>

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 14ab1b9..718831c 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -163,10 +163,10 @@ void pnfs_uninitialize(void)
 
 /* search pnfs_modules_tbl for right pnfs module */
 static int
-find_pnfs(int id, struct pnfs_module **module) {
+find_pnfs(u32 id, struct pnfs_module **module) {
 	struct  pnfs_module* local = NULL;
 
-	dprintk("PNFS: %s: Searching for %d\n",__func__, id);
+	dprintk("PNFS: %s: Searching for %u\n",__func__, id);
 	list_for_each_entry(local, &pnfs_modules_tbl, pnfs_tblid) {
 		if (local->pnfs_ld_type->id == id) {
 			*module = local;
@@ -245,7 +245,7 @@ set_pnfs_layoutdriver(struct super_block *sb, u32 id)
 		server->pnfs_curr_ld = mod->pnfs_ld_type;
 		mt = server->pnfs_curr_ld->ld_io_ops->initialize_mountpoint(sb);
 		if (!mt) {
-			printk("%s: Error initializing mount point for layout driver %d. ",__FUNCTION__, id);
+			printk("%s: Error initializing mount point for layout driver %u.\n",__FUNCTION__, id);
 			goto out_err;
 		}
 		/* Layout driver succeeded in initializing mountpoint */
@@ -255,7 +255,7 @@ set_pnfs_layoutdriver(struct super_block *sb, u32 id)
 		return;
 	}
 
-	dprintk("%s: No pNFS module found for %d. ",__FUNCTION__, id);
+	dprintk("%s: No pNFS module found for %u.\n",__FUNCTION__, id);
 out_err:
 	dprintk("Using NFSv4 I/O\n");
 	server->pnfs_curr_ld = NULL;
@@ -275,7 +275,7 @@ pnfs_register_layoutdriver(struct pnfs_layoutdriver_type *ld_type)
 	}
 
 	if ((pnfs_mod = kmalloc(sizeof(struct pnfs_module), GFP_KERNEL))!= NULL) {
-		dprintk("%s Registering id:%d name:%s\n",
+		dprintk("%s Registering id:%u name:%s\n",
 			__FUNCTION__,
 			ld_type->id,
 			ld_type->name);
@@ -297,7 +297,7 @@ pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *ld_type)
 	struct pnfs_module *pnfs_mod;
 
 	if (find_pnfs(ld_type->id, &pnfs_mod)) {
-		dprintk("%s Deregistering id:%d\n",__FUNCTION__, ld_type->id);
+		dprintk("%s Deregistering id:%u\n",__FUNCTION__, ld_type->id);
 		spin_lock(&pnfs_spinlock);
 		list_del(&pnfs_mod->pnfs_tblid);
 		spin_unlock(&pnfs_spinlock);
diff --git a/include/linux/nfs4_pnfs.h b/include/linux/nfs4_pnfs.h
index 6f6be74..110e5a9 100644
--- a/include/linux/nfs4_pnfs.h
+++ b/include/linux/nfs4_pnfs.h
@@ -113,7 +113,7 @@ struct layoutdriver_policy_operations {
 
 /* Per-layout driver specific registration structure */
 struct pnfs_layoutdriver_type {
-	const int id;
+	const u32 id;
 	const char *name;
 	struct layoutdriver_io_operations *ld_io_ops;
 	struct layoutdriver_policy_operations *ld_policy_ops;


More information about the pNFS mailing list