[PVFS2-CVS] commit by neill in pvfs2-1/src/kernel/linux-2.6: downcall.h pvfs2-dev-proto.h super.c upcall.h

CVS commit program cvs at parl.clemson.edu
Tue Mar 30 14:25:26 EST 2004


Update of /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6
In directory parlweb:/tmp/cvs-serv9842/src/kernel/linux-2.6

Modified Files:
	downcall.h pvfs2-dev-proto.h super.c upcall.h 
Log Message:
- some vfs cleanups/naming consistency changes
- added full support for dynamic vfs mounts.  this means that pvfs2-client has
  absolutely NO dependence on a pvfs2tab file, as a pvfs2 server and fs_name
  MUST be specified at mount time.  An example of what this looks like is the
  following:

  mount -t pvfs2 tcp://lain.mcs.anl.gov:3334/pvfs2-fs /tmp/mnt

  This line contacts the server, resolves the file system information matching
  the name pvfs2-fs and mounts it locally on the vfs mount point /tmp/mnt.
  Running 'mount' now reports the fs as something like:

  tcp://lain.mcs.anl.gov:3334/pvfs2-fs on /tmp/mnt type pvfs2 (rw)
- this stuff needs more testing, and it breaks the old way of kernel mounting
  (documentation updates forthcoming)


Index: downcall.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/downcall.h,v
diff -p -u -r1.14 -r1.15
--- downcall.h	24 Mar 2004 23:10:32 -0000	1.14
+++ downcall.h	30 Mar 2004 19:25:26 -0000	1.15
@@ -82,6 +82,12 @@ typedef struct
 
 typedef struct
 {
+    PVFS_fs_id fs_id;
+    PVFS_handle root_handle;
+} pvfs2_fs_mount_response_t;
+
+typedef struct
+{
     int type;
     int status;
 
@@ -99,6 +105,7 @@ typedef struct
 /*      pvfs2_rename_response_t rename; */
 	pvfs2_statfs_response_t statfs;
 /* 	pvfs2_truncate_response_t truncate; */
+        pvfs2_fs_mount_response_t fs_mount;
     } resp;
 } pvfs2_downcall_t;
 

Index: pvfs2-dev-proto.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/pvfs2-dev-proto.h,v
diff -p -u -r1.10 -r1.11
--- pvfs2-dev-proto.h	11 Mar 2004 23:14:57 -0000	1.10
+++ pvfs2-dev-proto.h	30 Mar 2004 19:25:26 -0000	1.11
@@ -25,6 +25,7 @@
 #define PVFS2_VFS_OP_STATFS            0xFF00000B
 #define PVFS2_VFS_OP_TRUNCATE          0xFF00000C
 #define PVFS2_VFS_OP_MMAP_RA_FLUSH     0xFF00000D
+#define PVFS2_VFS_OP_FS_MOUNT          0xFF00000E
 
 /* misc constants */
 #define PVFS2_NAME_LEN                 0x000000FF

Index: super.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/super.c,v
diff -p -u -r1.36 -r1.37
--- super.c	29 Mar 2004 19:47:42 -0000	1.36
+++ super.c	30 Mar 2004 19:25:26 -0000	1.37
@@ -339,6 +339,7 @@ int pvfs2_fill_sb(
 	return -ENOMEM;
     }
 
+    pvfs2_print("About to parse mount options %s\n",(char *)data);
     ret = parse_mount_options((char *)data, sb, silent);
     if (ret)
     {
@@ -393,7 +394,74 @@ struct super_block *pvfs2_get_sb(
     const char *devname,
     void *data)
 {
-    return get_sb_nodev(fst, flags, data, pvfs2_fill_sb);
+    struct super_block *sb = ERR_PTR(-EINVAL);
+    int ret = -EINVAL;
+    char buf[PVFS2_MAX_MOUNT_OPT_LEN];
+    pvfs2_kernel_op_t *new_op = NULL;
+
+    if (devname)
+    {
+        new_op = kmem_cache_alloc(op_cache, PVFS2_CACHE_ALLOC_FLAGS);
+        if (!new_op)
+        {
+            return ERR_PTR(-ENOMEM);
+        }
+        new_op->upcall.type = PVFS2_VFS_OP_FS_MOUNT;
+        strncpy(new_op->upcall.req.fs_mount.pvfs2_config_server,
+                devname, PVFS_MAX_SERVER_ADDR_LEN);
+
+        pvfs2_print("Attempting PVFS2 Mount via host %s\n",
+                    new_op->upcall.req.fs_mount.pvfs2_config_server);
+
+        if (data)
+        {
+            strncpy(new_op->upcall.req.fs_mount.options,
+                    (char *)data, PVFS2_MAX_MOUNT_OPT_LEN);
+            pvfs2_print("Got mount options: %s\n",
+                        new_op->upcall.req.fs_mount.options);
+        }
+
+        service_operation(new_op, "pvfs2_fs_mount", 0);
+        ret = pvfs2_kernel_error_code_convert(new_op->downcall.status);
+
+        pvfs2_print("pvfs2_fs_mount: got return value of %d\n", ret);
+        if (ret)
+        {
+            sb = ERR_PTR(ret);
+            goto error_exit;
+        }
+
+        if (data)
+        {
+            snprintf(buf, PVFS2_MAX_MOUNT_OPT_LEN,
+                     "coll_id=%d,root_handle=%Lu,%s",
+                     new_op->downcall.resp.fs_mount.fs_id,
+                     new_op->downcall.resp.fs_mount.root_handle,
+                     (char *)data);
+        }
+        else
+        {
+            snprintf(buf, PVFS2_MAX_MOUNT_OPT_LEN,
+                     "coll_id=%d,root_handle=%Lu",
+                     new_op->downcall.resp.fs_mount.fs_id,
+                     new_op->downcall.resp.fs_mount.root_handle);
+        }
+
+        pvfs2_print("Formatted mount options are: %s\n", buf);
+        sb = get_sb_nodev(fst, flags, buf, pvfs2_fill_sb);
+    }
+    else
+    {
+        sb = get_sb_nodev(fst, flags, data, pvfs2_fill_sb);
+    }
+
+  error_exit:
+    if (new_op)
+    {
+        op_release(new_op);
+    }
+
+    return sb;
 }
 
 void pvfs2_kill_sb(

Index: upcall.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/upcall.h,v
diff -p -u -r1.19 -r1.20
--- upcall.h	24 Mar 2004 23:10:32 -0000	1.19
+++ upcall.h	30 Mar 2004 19:25:26 -0000	1.20
@@ -7,9 +7,10 @@
 #ifndef __UPCALL_H
 #define __UPCALL_H
 
-/* TODO: we might want to try to avoid this inclusion  */
 #include "pvfs2-sysint.h"
 
+#define PVFS2_MAX_MOUNT_OPT_LEN        0x00000080
+
 typedef struct
 {
     int buf_index;
@@ -95,7 +96,13 @@ typedef struct
 typedef struct
 {
     PVFS_object_ref refn;
-} pvfs2_mmap_ra_cache_flush_t;
+} pvfs2_mmap_ra_cache_flush_request_t;
+
+typedef struct
+{
+    char pvfs2_config_server[PVFS_MAX_SERVER_ADDR_LEN];
+    char options[PVFS2_MAX_MOUNT_OPT_LEN];
+} pvfs2_fs_mount_request_t;
 
 typedef struct
 {
@@ -116,7 +123,8 @@ typedef struct
 	pvfs2_rename_request_t rename;
         pvfs2_statfs_request_t statfs;
         pvfs2_truncate_request_t truncate;
-        pvfs2_mmap_ra_cache_flush_t ra_cache_flush;
+        pvfs2_mmap_ra_cache_flush_request_t ra_cache_flush;
+        pvfs2_fs_mount_request_t fs_mount;
     } req;
 } pvfs2_upcall_t;
 



More information about the PVFS2-CVS mailing list