[PVFS2-CVS]
commit by neill in pvfs2-1/src/kernel/linux-2.6: dir.c namei.c
pvfs2-kernel.h pvfs2-utils.c super.c
CVS commit program
cvs at parl.clemson.edu
Wed Mar 3 16:41:10 EST 2004
Update of /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6
In directory parlweb:/tmp/cvs-serv24829
Modified Files:
dir.c namei.c pvfs2-kernel.h pvfs2-utils.c super.c
Log Message:
- re-organize mount option retrieval in the vfs
- add new type for gathering the mount options
- add support for a mount option "intr", but it's not used for anything (yet)
Index: dir.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/dir.c,v
diff -p -u -r1.17 -r1.18
--- dir.c 13 Feb 2004 19:37:26 -0000 1.17
+++ dir.c 3 Mar 2004 21:41:10 -0000 1.18
@@ -106,7 +106,7 @@ static int pvfs2_readdir(
new_op->upcall.req.readdir.refn.handle =
pvfs2_ino_to_handle(dentry->d_inode->i_ino);
new_op->upcall.req.readdir.refn.fs_id =
- PVFS2_SB(dentry->d_inode->i_sb)->fs_id;
+ PVFS2_SB(dentry->d_inode->i_sb)->coll_id;
}
new_op->upcall.req.readdir.max_dirent_count = MAX_DIRENT_COUNT;
Index: namei.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/namei.c,v
diff -p -u -r1.42 -r1.43
--- namei.c 13 Feb 2004 19:37:26 -0000 1.42
+++ namei.c 3 Mar 2004 21:41:10 -0000 1.43
@@ -112,7 +112,7 @@ struct dentry *pvfs2_lookup(
new_op->upcall.req.lookup.parent_refn.handle =
pvfs2_ino_to_handle(dir->i_ino);
new_op->upcall.req.lookup.parent_refn.fs_id =
- PVFS2_SB(sb)->fs_id;
+ PVFS2_SB(sb)->coll_id;
}
}
else
@@ -124,9 +124,9 @@ struct dentry *pvfs2_lookup(
*/
sb = dentry->d_inode->i_sb;
new_op->upcall.req.lookup.parent_refn.handle =
- PVFS2_SB(sb)->handle;
+ PVFS2_SB(sb)->root_handle;
new_op->upcall.req.lookup.parent_refn.fs_id =
- PVFS2_SB(sb)->fs_id;
+ PVFS2_SB(sb)->coll_id;
}
strncpy(new_op->upcall.req.lookup.d_name,
dentry->d_name.name, PVFS2_NAME_LEN);
@@ -331,9 +331,9 @@ static int pvfs2_rename(
{
sb = old_dir->i_sb;
new_op->upcall.req.rename.old_parent_refn.handle =
- PVFS2_SB(sb)->handle;
+ PVFS2_SB(sb)->root_handle;
new_op->upcall.req.rename.old_parent_refn.fs_id =
- PVFS2_SB(sb)->fs_id;
+ PVFS2_SB(sb)->coll_id;
}
/* do the same for the new parent */
@@ -347,9 +347,9 @@ static int pvfs2_rename(
{
sb = new_dir->i_sb;
new_op->upcall.req.rename.new_parent_refn.handle =
- PVFS2_SB(sb)->handle;
+ PVFS2_SB(sb)->root_handle;
new_op->upcall.req.rename.new_parent_refn.fs_id =
- PVFS2_SB(sb)->fs_id;
+ PVFS2_SB(sb)->coll_id;
}
strncpy(new_op->upcall.req.rename.d_old_name,
old_dentry->d_name.name, PVFS2_NAME_LEN);
Index: pvfs2-kernel.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/pvfs2-kernel.h,v
diff -p -u -r1.37 -r1.38
--- pvfs2-kernel.h 23 Feb 2004 18:19:46 -0000 1.37
+++ pvfs2-kernel.h 3 Mar 2004 21:41:10 -0000 1.38
@@ -140,11 +140,31 @@ typedef struct
sector_t last_failed_block_index_read;
} pvfs2_inode_t;
+/*
+ these are the available mount options that we accept:
+
+ for now, the root handle and collection id are specified as mount
+ options. it may seem extraneous since we have these stored in the
+ sb private info, but this is mostly for compatibility in case one
+ day these are not passed as mount options.
+
+ the intr option is inspired by the nfs intr option that interrupts
+ the operation in progress if a signal is received if set, and
+ ignores the signal otherwise. THIS IS NOT YET SUPPORTED.
+*/
+typedef struct
+{
+ PVFS_handle root_handle;
+ PVFS_fs_id coll_id;
+ int intr;
+} pvfs2_mount_options_t;
+
/* per superblock private pvfs2 info */
typedef struct
{
- PVFS_handle handle;
- PVFS_fs_id fs_id;
+ PVFS_handle root_handle;
+ PVFS_fs_id coll_id;
+ pvfs2_mount_options_t mnt_options;
} pvfs2_sb_info;
/*
Index: pvfs2-utils.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/pvfs2-utils.c,v
diff -p -u -r1.52 -r1.53
--- pvfs2-utils.c 23 Feb 2004 18:19:46 -0000 1.52
+++ pvfs2-utils.c 3 Mar 2004 21:41:10 -0000 1.53
@@ -367,7 +367,7 @@ int pvfs2_inode_getattr(
}
if (pvfs2_inode->refn.fs_id == 0)
{
- pvfs2_inode->refn.fs_id = PVFS2_SB(inode->i_sb)->fs_id;
+ pvfs2_inode->refn.fs_id = PVFS2_SB(inode->i_sb)->coll_id;
}
/*
@@ -445,9 +445,9 @@ int pvfs2_inode_setattr(
{
struct super_block *sb = inode->i_sb;
new_op->upcall.req.lookup.parent_refn.handle =
- PVFS2_SB(sb)->handle;
+ PVFS2_SB(sb)->root_handle;
new_op->upcall.req.lookup.parent_refn.fs_id =
- PVFS2_SB(sb)->fs_id;
+ PVFS2_SB(sb)->coll_id;
}
copy_attributes_from_inode(
inode, &new_op->upcall.req.setattr.attributes, iattr);
@@ -501,7 +501,7 @@ static inline struct inode *pvfs2_create
new_op->upcall.req.create.parent_refn.handle =
pvfs2_ino_to_handle(dir->i_ino);
new_op->upcall.req.create.parent_refn.fs_id =
- PVFS2_SB(dir->i_sb)->fs_id;
+ PVFS2_SB(dir->i_sb)->coll_id;
}
copy_attributes_from_inode(
inode, &new_op->upcall.req.create.attributes, NULL);
@@ -600,7 +600,7 @@ static inline struct inode *pvfs2_create
new_op->upcall.req.mkdir.parent_refn.handle =
pvfs2_ino_to_handle(dir->i_ino);
new_op->upcall.req.mkdir.parent_refn.fs_id =
- PVFS2_SB(dir->i_sb)->fs_id;
+ PVFS2_SB(dir->i_sb)->coll_id;
}
copy_attributes_from_inode(
inode, &new_op->upcall.req.mkdir.attributes, NULL);
@@ -700,7 +700,7 @@ static inline struct inode *pvfs2_create
new_op->upcall.req.sym.parent_refn.handle =
pvfs2_ino_to_handle(dir->i_ino);
new_op->upcall.req.sym.parent_refn.fs_id =
- PVFS2_SB(dir->i_sb)->fs_id;
+ PVFS2_SB(dir->i_sb)->coll_id;
}
copy_attributes_from_inode(
inode, &new_op->upcall.req.sym.attributes, NULL);
@@ -835,7 +835,7 @@ int pvfs2_remove_entry(
new_op->upcall.req.remove.parent_refn.handle =
pvfs2_ino_to_handle(dir->i_ino);
new_op->upcall.req.remove.parent_refn.fs_id =
- PVFS2_SB(dir->i_sb)->fs_id;
+ PVFS2_SB(dir->i_sb)->coll_id;
}
strncpy(new_op->upcall.req.remove.d_name,
dentry->d_name.name, PVFS2_NAME_LEN);
Index: super.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/super.c,v
diff -p -u -r1.26 -r1.27
--- super.c 23 Feb 2004 18:19:46 -0000 1.26
+++ super.c 3 Mar 2004 21:41:10 -0000 1.27
@@ -134,7 +134,7 @@ static int pvfs2_statfs(
pvfs2_kernel_op_t *new_op = NULL;
pvfs2_print("pvfs2_: pvfs2_statfs called on sb %p "
- "(fs_id is %d)\n", sb, (int)(PVFS2_SB(sb)->fs_id));
+ "(fs_id is %d)\n", sb, (int)(PVFS2_SB(sb)->coll_id));
new_op = kmem_cache_alloc(op_cache, PVFS2_CACHE_ALLOC_FLAGS);
if (!new_op)
@@ -143,7 +143,7 @@ static int pvfs2_statfs(
return ret;
}
new_op->upcall.type = PVFS2_VFS_OP_STATFS;
- new_op->upcall.req.statfs.fs_id = PVFS2_SB(sb)->fs_id;
+ new_op->upcall.req.statfs.fs_id = PVFS2_SB(sb)->coll_id;
service_operation_with_timeout_retry(
new_op, "pvfs2_statfs", retries);
@@ -212,17 +212,101 @@ struct super_operations pvfs2_s_ops =
static struct export_operations pvfs2_export_ops = { };
+static int parse_mount_options(
+ char *option_str, struct super_block *sb, int silent)
+{
+ int ret = -EINVAL;
+ char *options = option_str;
+ pvfs2_sb_info *pvfs2_sb = NULL;
+
+ if (!silent)
+ {
+ pvfs2_print("pvfs2: parse_mount_options called with:\n");
+ pvfs2_print(" %s\n", options);
+ }
+
+ if (options && sb)
+ {
+ pvfs2_sb = PVFS2_SB(sb);
+ memset(&pvfs2_sb->mnt_options, 0, sizeof(pvfs2_mount_options_t));
+
+ if (!options || (strncmp(options, "coll_id=", 8) != 0))
+ {
+ pvfs2_error("pvfs2: Invalid coll_id specification %s\n",
+ option_str);
+ return ret;
+ }
+ options += 8;
+ pvfs2_sb->mnt_options.coll_id =
+ simple_strtoul(options, &options, 0);
+
+ if (*options && (*options != ','))
+ {
+ pvfs2_error("pvfs2: Invalid coll_id specification %s\n",
+ option_str);
+ return ret;
+ }
+
+ if (*options == ',')
+ {
+ options++;
+ }
+
+ if (!options || (strncmp(options, "root_handle=", 12) != 0))
+ {
+ pvfs2_print("pvfs2: Invalid root_handle specification\n");
+ return ret;
+ }
+ options += 12;
+ pvfs2_sb->mnt_options.root_handle =
+ simple_strtoul(options, &options, 0);
+
+ if (*options == ',')
+ {
+ options++;
+ }
+
+ /* handle misc trailing mount options here */
+ if (options && (strncmp(options, "intr", 4) == 0))
+ {
+ if (!silent)
+ {
+ pvfs2_print("pvfs2: mount option intr specified\n");
+ }
+ pvfs2_sb->mnt_options.intr = 1;
+ }
+
+ if ((pvfs2_sb->mnt_options.coll_id == 0) ||
+ (pvfs2_sb->mnt_options.root_handle == 0))
+ {
+ pvfs2_error("pvfs2: Invalid coll_id or root_handle "
+ "specification: %s\n", option_str);
+ return ret;
+ }
+ else
+ {
+ if (!silent)
+ {
+ pvfs2_print(
+ "pvfs2: got coll_id %d | root_handle %Lu | "
+ "intr? %s\n", (int)pvfs2_sb->mnt_options.coll_id,
+ Lu(pvfs2_sb->mnt_options.root_handle),
+ (pvfs2_sb->mnt_options.intr ? "yes" : "no"));
+ }
+ ret = 0;
+ }
+ }
+ return ret;
+}
+
int pvfs2_fill_sb(
struct super_block *sb,
void *data,
int silent)
{
- int shift_val = 0;
+ int ret = -EINVAL, shift_val = 0;
struct inode *root = NULL;
struct dentry *root_dentry = NULL;
- char *options = (char *)data;
- unsigned long coll_id = 0;
- unsigned long root_handle = 0;
/* alloc and init our private pvfs2 sb info */
sb->s_fs_info = kmalloc(sizeof(pvfs2_sb_info), PVFS2_GFP_FLAGS);
@@ -231,48 +315,14 @@ int pvfs2_fill_sb(
return -ENOMEM;
}
- if (!silent)
- {
- pvfs2_print("pvfs2_fill_sb: called with coll_id %s\n", options);
- }
-
- if (!options || (strncmp(options, "coll_id=", 8) != 0))
- {
- pvfs2_print("pvfs2_fill_sb called with invalid coll_id\n");
- return -EINVAL;
- }
- options += 8;
- coll_id = simple_strtoul(options, &options, 0);
- if (*options && (*options != ','))
- {
- pvfs2_error("pvfs2: Invalid coll_id specification %s\n",
- (char *)data);
- return -EINVAL;
- }
- if (*options == ',')
- {
- options++;
- }
-
- if (!options || (strncmp(options, "root_handle=", 12) != 0))
+ ret = parse_mount_options((char *)data, sb, silent);
+ if (ret)
{
- pvfs2_print("pvfs2_fill_sb called with invalid root_handle\n");
- return 1;
+ return ret;
}
- options += 12;
- root_handle = simple_strtoul(options, &options, 0);
- if ((coll_id == 0) || (root_handle == 0))
- {
- pvfs2_error("pvfs2: Invalid coll_id or root_handle "
- "specification %s\n", (char *)data);
- return 1;
- }
- else if (!silent)
- {
- pvfs2_print("pvfs2: got coll_id %lu | root_handle %lu\n",
- coll_id, root_handle);
- }
+ PVFS2_SB(sb)->root_handle = PVFS2_SB(sb)->mnt_options.root_handle;
+ PVFS2_SB(sb)->coll_id = PVFS2_SB(sb)->mnt_options.coll_id;
sb->s_magic = PVFS2_MAGIC;
sb->s_op = &pvfs2_s_ops;
@@ -301,12 +351,9 @@ int pvfs2_fill_sb(
{
return -ENOMEM;
}
- root->i_ino = (ino_t)root_handle;
- PVFS2_I(root)->refn.handle = (PVFS_handle)root_handle;
- PVFS2_I(root)->refn.fs_id = (PVFS_fs_id)coll_id;
-
- PVFS2_SB(sb)->handle = PVFS2_I(root)->refn.handle;
- PVFS2_SB(sb)->fs_id = PVFS2_I(root)->refn.fs_id;
+ root->i_ino = (ino_t)PVFS2_SB(sb)->root_handle;
+ PVFS2_I(root)->refn.handle = PVFS2_SB(sb)->root_handle;
+ PVFS2_I(root)->refn.fs_id = PVFS2_SB(sb)->coll_id;
/* allocates and places root dentry in dcache */
root_dentry = d_alloc_root(root);
More information about the PVFS2-CVS
mailing list