Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 27 Apr 2009 18:16:33 +0000 (11:16 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 27 Apr 2009 18:16:33 +0000 (11:16 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
  Btrfs: look for acls during btrfs_read_locked_inode
  Btrfs: fix acl caching
  Btrfs: Fix a bunch of printk() warnings.
  Btrfs: Fix a trivial warning using max() of u64 vs ULL.
  Btrfs: remove unused btrfs_bit_radix slab
  Btrfs: ratelimit IO error printks
  Btrfs: remove #if 0 code
  Btrfs: When shrinking, only update disk size on success
  Btrfs: fix deadlocks and stalls on dead root removal
  Btrfs: fix fallocate deadlock on inode extent lock
  Btrfs: kill btrfs_cache_create
  Btrfs: don't export symbols
  Btrfs: simplify makefile
  Btrfs: try to keep a healthy ratio of metadata vs data block groups

1  2 
fs/btrfs/ioctl.c
fs/btrfs/super.c

diff --combined fs/btrfs/ioctl.c
index 9f135e87850708e3b33fc8be24cb08f7e869b7bc,48762aa1e945b3f01712837793449dd184bf2956..5e94ea6e1cbe05ea164e5f6128b87c84b7bc8570
@@@ -461,9 -461,15 +461,9 @@@ static int btrfs_ioctl_resize(struct bt
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
  
 -      vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS);
 -
 -      if (!vol_args)
 -              return -ENOMEM;
 -
 -      if (copy_from_user(vol_args, arg, sizeof(*vol_args))) {
 -              ret = -EFAULT;
 -              goto out;
 -      }
 +      vol_args = memdup_user(arg, sizeof(*vol_args));
 +      if (IS_ERR(vol_args))
 +              return PTR_ERR(vol_args);
  
        vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
        namelen = strlen(vol_args->name);
                *devstr = '\0';
                devstr = vol_args->name;
                devid = simple_strtoull(devstr, &end, 10);
-               printk(KERN_INFO "resizing devid %llu\n", devid);
+               printk(KERN_INFO "resizing devid %llu\n",
+                      (unsigned long long)devid);
        }
        device = btrfs_find_device(root, devid, NULL, NULL);
        if (!device) {
-               printk(KERN_INFO "resizer unable to find device %llu\n", devid);
+               printk(KERN_INFO "resizer unable to find device %llu\n",
+                      (unsigned long long)devid);
                ret = -EINVAL;
                goto out_unlock;
        }
  
  out_unlock:
        mutex_unlock(&root->fs_info->volume_mutex);
 -out:
        kfree(vol_args);
        return ret;
  }
@@@ -558,9 -567,15 +560,9 @@@ static noinline int btrfs_ioctl_snap_cr
        if (root->fs_info->sb->s_flags & MS_RDONLY)
                return -EROFS;
  
 -      vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS);
 -
 -      if (!vol_args)
 -              return -ENOMEM;
 -
 -      if (copy_from_user(vol_args, arg, sizeof(*vol_args))) {
 -              ret = -EFAULT;
 -              goto out;
 -      }
 +      vol_args = memdup_user(arg, sizeof(*vol_args));
 +      if (IS_ERR(vol_args))
 +              return PTR_ERR(vol_args);
  
        vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
        namelen = strlen(vol_args->name);
@@@ -662,13 -677,19 +664,13 @@@ static long btrfs_ioctl_add_dev(struct 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
  
 -      vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS);
 +      vol_args = memdup_user(arg, sizeof(*vol_args));
 +      if (IS_ERR(vol_args))
 +              return PTR_ERR(vol_args);
  
 -      if (!vol_args)
 -              return -ENOMEM;
 -
 -      if (copy_from_user(vol_args, arg, sizeof(*vol_args))) {
 -              ret = -EFAULT;
 -              goto out;
 -      }
        vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
        ret = btrfs_init_new_device(root, vol_args->name);
  
 -out:
        kfree(vol_args);
        return ret;
  }
@@@ -684,13 -705,19 +686,13 @@@ static long btrfs_ioctl_rm_dev(struct b
        if (root->fs_info->sb->s_flags & MS_RDONLY)
                return -EROFS;
  
 -      vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS);
 +      vol_args = memdup_user(arg, sizeof(*vol_args));
 +      if (IS_ERR(vol_args))
 +              return PTR_ERR(vol_args);
  
 -      if (!vol_args)
 -              return -ENOMEM;
 -
 -      if (copy_from_user(vol_args, arg, sizeof(*vol_args))) {
 -              ret = -EFAULT;
 -              goto out;
 -      }
        vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
        ret = btrfs_rm_device(root, vol_args->name);
  
 -out:
        kfree(vol_args);
        return ret;
  }
@@@ -805,7 -832,8 +807,8 @@@ static long btrfs_ioctl_clone(struct fi
        BUG_ON(!trans);
  
        /* punch hole in destination first */
-       btrfs_drop_extents(trans, root, inode, off, off+len, 0, &hint_byte);
+       btrfs_drop_extents(trans, root, inode, off, off + len,
+                          off + len, 0, &hint_byte);
  
        /* clone data */
        key.objectid = src->i_ino;
diff --combined fs/btrfs/super.c
index a7acfe639a449eeb278214a04bfc6037249e3048,bf0e84c7560723ecb58a6381d76ca91b551ee456..3536bdb2d7cb0cc22cd149b1b561850881bbb096
@@@ -68,7 -68,7 +68,7 @@@ 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_notreelog,
-       Opt_flushoncommit, Opt_err,
+       Opt_ratio, Opt_flushoncommit, Opt_err,
  };
  
  static match_table_t tokens = {
@@@ -87,6 -87,7 +87,7 @@@
        {Opt_noacl, "noacl"},
        {Opt_notreelog, "notreelog"},
        {Opt_flushoncommit, "flushoncommit"},
+       {Opt_ratio, "metadata_ratio=%d"},
        {Opt_err, NULL},
  };
  
@@@ -195,7 -196,7 +196,7 @@@ int btrfs_parse_options(struct btrfs_ro
                                info->max_extent = max_t(u64,
                                        info->max_extent, root->sectorsize);
                                printk(KERN_INFO "btrfs: max_extent at %llu\n",
-                                      info->max_extent);
+                                      (unsigned long long)info->max_extent);
                        }
                        break;
                case Opt_max_inline:
                                                root->sectorsize);
                                }
                                printk(KERN_INFO "btrfs: max_inline at %llu\n",
-                                       info->max_inline);
+                                       (unsigned long long)info->max_inline);
                        }
                        break;
                case Opt_alloc_start:
                                kfree(num);
                                printk(KERN_INFO
                                        "btrfs: allocations start at %llu\n",
-                                       info->alloc_start);
+                                       (unsigned long long)info->alloc_start);
                        }
                        break;
                case Opt_noacl:
                        printk(KERN_INFO "btrfs: turning on flush-on-commit\n");
                        btrfs_set_opt(info->mount_opt, FLUSHONCOMMIT);
                        break;
+               case Opt_ratio:
+                       intarg = 0;
+                       match_int(&args[0], &intarg);
+                       if (intarg) {
+                               info->metadata_ratio = intarg;
+                               printk(KERN_INFO "btrfs: metadata ratio %d\n",
+                                      info->metadata_ratio);
+                       }
+                       break;
                default:
                        break;
                }
@@@ -410,11 -420,14 +420,14 @@@ static int btrfs_show_options(struct se
        if (btrfs_test_opt(root, NOBARRIER))
                seq_puts(seq, ",nobarrier");
        if (info->max_extent != (u64)-1)
-               seq_printf(seq, ",max_extent=%llu", info->max_extent);
+               seq_printf(seq, ",max_extent=%llu",
+                          (unsigned long long)info->max_extent);
        if (info->max_inline != 8192 * 1024)
-               seq_printf(seq, ",max_inline=%llu", info->max_inline);
+               seq_printf(seq, ",max_inline=%llu",
+                          (unsigned long long)info->max_inline);
        if (info->alloc_start != 0)
-               seq_printf(seq, ",alloc_start=%llu", info->alloc_start);
+               seq_printf(seq, ",alloc_start=%llu",
+                          (unsigned long long)info->alloc_start);
        if (info->thread_pool_size !=  min_t(unsigned long,
                                             num_online_cpus() + 2, 8))
                seq_printf(seq, ",thread_pool=%d", info->thread_pool_size);
@@@ -635,9 -648,14 +648,9 @@@ static long btrfs_control_ioctl(struct 
        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:
                                            &btrfs_fs_type, &fs_devices);
                break;
        }
 -out:
 +
        kfree(vol);
        return ret;
  }