nilfs2: get rid of nilfs_mount_options structure
[cascardo/linux.git] / fs / nilfs2 / super.c
index 35ae03c..6ea32d9 100644 (file)
@@ -111,12 +111,17 @@ void nilfs_error(struct super_block *sb, const char *function,
                 const char *fmt, ...)
 {
        struct nilfs_sb_info *sbi = NILFS_SB(sb);
+       struct va_format vaf;
        va_list args;
 
        va_start(args, fmt);
-       printk(KERN_CRIT "NILFS error (device %s): %s: ", sb->s_id, function);
-       vprintk(fmt, args);
-       printk("\n");
+
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       printk(KERN_CRIT "NILFS error (device %s): %s: %pV\n",
+              sb->s_id, function, &vaf);
+
        va_end(args);
 
        if (!(sb->s_flags & MS_RDONLY)) {
@@ -136,13 +141,17 @@ void nilfs_error(struct super_block *sb, const char *function,
 void nilfs_warning(struct super_block *sb, const char *function,
                   const char *fmt, ...)
 {
+       struct va_format vaf;
        va_list args;
 
        va_start(args, fmt);
-       printk(KERN_WARNING "NILFS warning (device %s): %s: ",
-              sb->s_id, function);
-       vprintk(fmt, args);
-       printk("\n");
+
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       printk(KERN_WARNING "NILFS warning (device %s): %s: %pV\n",
+              sb->s_id, function, &vaf);
+
        va_end(args);
 }
 
@@ -162,10 +171,13 @@ struct inode *nilfs_alloc_inode(struct super_block *sb)
        return &ii->vfs_inode;
 }
 
-void nilfs_destroy_inode(struct inode *inode)
+static void nilfs_i_callback(struct rcu_head *head)
 {
+       struct inode *inode = container_of(head, struct inode, i_rcu);
        struct nilfs_mdt_info *mdi = NILFS_MDT(inode);
 
+       INIT_LIST_HEAD(&inode->i_dentry);
+
        if (mdi) {
                kfree(mdi->mi_bgl); /* kfree(NULL) is safe */
                kfree(mdi);
@@ -173,6 +185,11 @@ void nilfs_destroy_inode(struct inode *inode)
        kmem_cache_free(nilfs_inode_cachep, NILFS_I(inode));
 }
 
+void nilfs_destroy_inode(struct inode *inode)
+{
+       call_rcu(&inode->i_rcu, nilfs_i_callback);
+}
+
 static int nilfs_sync_super(struct nilfs_sb_info *sbi, int flag)
 {
        struct the_nilfs *nilfs = sbi->s_nilfs;
@@ -838,7 +855,7 @@ static int nilfs_attach_snapshot(struct super_block *s, __u64 cno,
 
 static int nilfs_tree_was_touched(struct dentry *root_dentry)
 {
-       return atomic_read(&root_dentry->d_count) > 1;
+       return root_dentry->d_count > 1;
 }
 
 /**
@@ -1002,11 +1019,11 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data)
        struct nilfs_sb_info *sbi = NILFS_SB(sb);
        struct the_nilfs *nilfs = sbi->s_nilfs;
        unsigned long old_sb_flags;
-       struct nilfs_mount_options old_opts;
+       unsigned long old_mount_opt;
        int err;
 
        old_sb_flags = sb->s_flags;
-       old_opts.mount_opt = sbi->s_mount_opt;
+       old_mount_opt = sbi->s_mount_opt;
 
        if (!parse_options(data, sb, 1)) {
                err = -EINVAL;
@@ -1075,7 +1092,7 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data)
 
  restore_opts:
        sb->s_flags = old_sb_flags;
-       sbi->s_mount_opt = old_opts.mount_opt;
+       sbi->s_mount_opt = old_mount_opt;
        return err;
 }
 
@@ -1141,9 +1158,9 @@ static int nilfs_test_bdev_super(struct super_block *s, void *data)
        return (void *)s->s_bdev == data;
 }
 
-static int
-nilfs_get_sb(struct file_system_type *fs_type, int flags,
-            const char *dev_name, void *data, struct vfsmount *mnt)
+static struct dentry *
+nilfs_mount(struct file_system_type *fs_type, int flags,
+            const char *dev_name, void *data)
 {
        struct nilfs_super_data sd;
        struct super_block *s;
@@ -1156,7 +1173,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
 
        sd.bdev = open_bdev_exclusive(dev_name, mode, fs_type);
        if (IS_ERR(sd.bdev))
-               return PTR_ERR(sd.bdev);
+               return ERR_CAST(sd.bdev);
 
        sd.cno = 0;
        sd.flags = flags;
@@ -1235,9 +1252,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
        if (!s_new)
                close_bdev_exclusive(sd.bdev, mode);
 
-       mnt->mnt_sb = s;
-       mnt->mnt_root = root_dentry;
-       return 0;
+       return root_dentry;
 
  failed_super:
        deactivate_locked_super(s);
@@ -1245,13 +1260,13 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags,
  failed:
        if (!s_new)
                close_bdev_exclusive(sd.bdev, mode);
-       return err;
+       return ERR_PTR(err);
 }
 
 struct file_system_type nilfs_fs_type = {
        .owner    = THIS_MODULE,
        .name     = "nilfs2",
-       .get_sb   = nilfs_get_sb,
+       .mount    = nilfs_mount,
        .kill_sb  = kill_block_super,
        .fs_flags = FS_REQUIRES_DEV,
 };