]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - fs/btrfs/super.c
NFSD: Refactor portlist socket closing into a helper
[mv-sheeva.git] / fs / btrfs / super.c
index 2ceb40b794a8ef18d3be9b52e359673827eaeaae..a7acfe639a449eeb278214a04bfc6037249e3048 100644 (file)
@@ -67,7 +67,8 @@ static void btrfs_put_super(struct super_block *sb)
 enum {
        Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow,
        Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier,
-       Opt_ssd, Opt_thread_pool, Opt_noacl,  Opt_compress, Opt_err,
+       Opt_ssd, Opt_thread_pool, Opt_noacl,  Opt_compress, Opt_notreelog,
+       Opt_flushoncommit, Opt_err,
 };
 
 static match_table_t tokens = {
@@ -84,6 +85,8 @@ static match_table_t tokens = {
        {Opt_compress, "compress"},
        {Opt_ssd, "ssd"},
        {Opt_noacl, "noacl"},
+       {Opt_notreelog, "notreelog"},
+       {Opt_flushoncommit, "flushoncommit"},
        {Opt_err, NULL},
 };
 
@@ -223,6 +226,14 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
                case Opt_noacl:
                        root->fs_info->sb->s_flags &= ~MS_POSIXACL;
                        break;
+               case Opt_notreelog:
+                       printk(KERN_INFO "btrfs: disabling tree log\n");
+                       btrfs_set_opt(info->mount_opt, NOTREELOG);
+                       break;
+               case Opt_flushoncommit:
+                       printk(KERN_INFO "btrfs: turning on flush-on-commit\n");
+                       btrfs_set_opt(info->mount_opt, FLUSHONCOMMIT);
+                       break;
                default:
                        break;
                }
@@ -364,9 +375,8 @@ fail_close:
 int btrfs_sync_fs(struct super_block *sb, int wait)
 {
        struct btrfs_trans_handle *trans;
-       struct btrfs_root *root;
+       struct btrfs_root *root = btrfs_sb(sb);
        int ret;
-       root = btrfs_sb(sb);
 
        if (sb->s_flags & MS_RDONLY)
                return 0;
@@ -412,6 +422,10 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
                seq_puts(seq, ",compress");
        if (btrfs_test_opt(root, SSD))
                seq_puts(seq, ",ssd");
+       if (btrfs_test_opt(root, NOTREELOG))
+               seq_puts(seq, ",no-treelog");
+       if (btrfs_test_opt(root, FLUSHONCOMMIT))
+               seq_puts(seq, ",flush-on-commit");
        if (!(root->fs_info->sb->s_flags & MS_POSIXACL))
                seq_puts(seq, ",noacl");
        return 0;
@@ -621,14 +635,9 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
-       vol = kmalloc(sizeof(*vol), GFP_KERNEL);
-       if (!vol)
-               return -ENOMEM;
-
-       if (copy_from_user(vol, (void __user *)arg, sizeof(*vol))) {
-               ret = -EFAULT;
-               goto out;
-       }
+       vol = memdup_user((void __user *)arg, sizeof(*vol));
+       if (IS_ERR(vol))
+               return PTR_ERR(vol);
 
        switch (cmd) {
        case BTRFS_IOC_SCAN_DEV:
@@ -636,7 +645,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
                                            &btrfs_fs_type, &fs_devices);
                break;
        }
-out:
+
        kfree(vol);
        return ret;
 }