Whamcloud - gitweb
Fix RPM tag
[fs/lustre-release.git] / lustre / smfs / super.c
index 58dfcd3..bfa4247 100644 (file)
 #include <linux/slab.h>
 #include <linux/loop.h>
 #include <linux/errno.h>
+#include <linux/lustre_idl.h>
 #include "smfs_internal.h" 
 
 /* Find the options for the clone. These consist of a cache device
    and an index in the snaptable associated with that device. 
 */
-static char *smfs_options(char *options, char **devstr, char **namestr)
+static char *smfs_options(char *options, char **devstr, char **namestr, int *kml)
 {
        struct option *opt_value = NULL;
        char *pos;
@@ -39,24 +40,15 @@ static char *smfs_options(char *options, char **devstr, char **namestr)
                } else if (!strcmp(opt_value->opt, "type")) {
                        if (namestr != NULL)
                                *namestr = opt_value->value;
+               } else if (!strcmp(opt_value->opt, "kml")) {
+                       *kml = 1;       
                } else {
                        break;
                }
        }
        return pos;
 }
-static int close_fd(int fd)
-{
-       struct files_struct *files = current->files;    
-        
-       write_lock(&files->file_lock);
-       
-       files->fd[fd] = NULL;
-        __put_unused_fd(files, fd); 
-       
-       write_unlock(&files->file_lock);
-       return 0;
-}
+
 static int set_loop_fd(char *dev_path, char *loop_dev)
 {
         struct loop_info loopinfo;
@@ -190,7 +182,7 @@ static char *parse_path2dev(struct super_block *sb, char *dev_path)
        memcpy(name, dev_path, strlen(dev_path) + 1);
        RETURN(name);
 }
-static void duplicate_sb(struct super_block *csb, 
+void duplicate_sb(struct super_block *csb, 
                         struct super_block *sb)
 {
        sb->s_blocksize = csb->s_blocksize;
@@ -224,7 +216,7 @@ static int sm_mount_cache(struct super_block *sb,
         free_page(page);
        
        if (IS_ERR(mnt)) {
-                CERROR("do_kern_mount failed: rc = %d\n", PTR_ERR(mnt));
+                CERROR("do_kern_mount failed: rc = %ld\n", PTR_ERR(mnt));
                 GOTO(err_out, err = PTR_ERR(mnt));
         }
        smb = S2SMI(sb); 
@@ -264,7 +256,7 @@ smfs_read_super(
        char *devstr = NULL, *typestr = NULL;
        char *cache_data;
        ino_t root_ino;
-       int err = 0;
+       int err = 0, kml = 0;
 
        ENTRY;
 
@@ -272,7 +264,7 @@ smfs_read_super(
        
        init_option(data);
        /* read and validate options */
-       cache_data = smfs_options(data, &devstr, &typestr);
+       cache_data = smfs_options(data, &devstr, &typestr, &kml);
        if (*cache_data) {
                CERROR("invalid mount option %s\n", (char*)data);
                GOTO(out_err, err=-EINVAL);
@@ -287,6 +279,11 @@ smfs_read_super(
                CERROR("Can not mount %s as %s\n", devstr, typestr);
                GOTO(out_err, 0);
        }
+       
+       if (kml) smfs_kml_init(sb);     
+       
+       setup_sm_journal_ops(typestr);
+       
        dget(S2CSB(sb)->s_root);
        root_ino = S2CSB(sb)->s_root->d_inode->i_ino;
        root_inode = iget(sb, root_ino);