Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 9 Jul 2011 06:25:45 +0000 (23:25 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 9 Jul 2011 06:25:45 +0000 (23:25 -0700)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
  btrfs: fix oops when doing space balance
  Btrfs: don't panic if we get an error while balancing V2
  btrfs: add missing options displayed in mount output

1  2 
fs/btrfs/ctree.h
fs/btrfs/inode.c
fs/btrfs/super.c

diff --combined fs/btrfs/ctree.h
@@@ -19,6 -19,7 +19,6 @@@
  #ifndef __BTRFS_CTREE__
  #define __BTRFS_CTREE__
  
 -#include <linux/version.h>
  #include <linux/mm.h>
  #include <linux/highmem.h>
  #include <linux/fs.h>
@@@ -1335,6 -1336,11 +1335,11 @@@ struct btrfs_ioctl_defrag_range_args 
   */
  #define BTRFS_STRING_ITEM_KEY 253
  
+ /*
+  * Flags for mount options.
+  *
+  * Note: don't forget to add new options to btrfs_show_options()
+  */
  #define BTRFS_MOUNT_NODATASUM         (1 << 0)
  #define BTRFS_MOUNT_NODATACOW         (1 << 1)
  #define BTRFS_MOUNT_NOBARRIER         (1 << 2)
@@@ -2548,7 -2554,7 +2553,7 @@@ int btrfs_page_mkwrite(struct vm_area_s
  int btrfs_readpage(struct file *file, struct page *page);
  void btrfs_evict_inode(struct inode *inode);
  int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc);
 -void btrfs_dirty_inode(struct inode *inode);
 +void btrfs_dirty_inode(struct inode *inode, int flags);
  struct inode *btrfs_alloc_inode(struct super_block *sb);
  void btrfs_destroy_inode(struct inode *inode);
  int btrfs_drop_inode(struct inode *inode);
diff --combined fs/btrfs/inode.c
@@@ -2678,12 -2678,14 +2678,14 @@@ noinline int btrfs_update_inode(struct 
        int ret;
  
        /*
-        * If root is tree root, it means this inode is used to
-        * store free space information. And these inodes are updated
-        * when committing the transaction, so they needn't delaye to
-        * be updated, or deadlock will occured.
+        * If the inode is a free space inode, we can deadlock during commit
+        * if we put it into the delayed code.
+        *
+        * The data relocation inode should also be directly updated
+        * without delay
         */
-       if (!is_free_space_inode(root, inode)) {
+       if (!is_free_space_inode(root, inode)
+           && root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID) {
                ret = btrfs_delayed_update_inode(trans, root, inode);
                if (!ret)
                        btrfs_set_inode_last_trans(trans, inode);
@@@ -4299,7 -4301,7 +4301,7 @@@ int btrfs_write_inode(struct inode *ino
   * FIXME, needs more benchmarking...there are no reasons other than performance
   * to keep or drop this code.
   */
 -void btrfs_dirty_inode(struct inode *inode)
 +void btrfs_dirty_inode(struct inode *inode, int flags)
  {
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct btrfs_trans_handle *trans;
diff --combined fs/btrfs/super.c
@@@ -39,7 -39,6 +39,7 @@@
  #include <linux/miscdevice.h>
  #include <linux/magic.h>
  #include <linux/slab.h>
 +#include <linux/cleancache.h>
  #include "compat.h"
  #include "delayed-inode.h"
  #include "ctree.h"
@@@ -639,7 -638,6 +639,7 @@@ static int btrfs_fill_super(struct supe
        sb->s_root = root_dentry;
  
        save_mount_options(sb, data);
 +      cleancache_init_fs(sb);
        return 0;
  
  fail_close:
@@@ -723,6 -721,12 +723,12 @@@ static int btrfs_show_options(struct se
                seq_puts(seq, ",clear_cache");
        if (btrfs_test_opt(root, USER_SUBVOL_RM_ALLOWED))
                seq_puts(seq, ",user_subvol_rm_allowed");
+       if (btrfs_test_opt(root, ENOSPC_DEBUG))
+               seq_puts(seq, ",enospc_debug");
+       if (btrfs_test_opt(root, AUTO_DEFRAG))
+               seq_puts(seq, ",autodefrag");
+       if (btrfs_test_opt(root, INODE_MAP_CACHE))
+               seq_puts(seq, ",inode_cache");
        return 0;
  }
  
@@@ -825,7 -829,7 +831,7 @@@ static struct dentry *btrfs_mount(struc
        } else {
                char b[BDEVNAME_SIZE];
  
 -              s->s_flags = flags;
 +              s->s_flags = flags | MS_NOSEC;
                strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
                error = btrfs_fill_super(s, fs_devices, data,
                                         flags & MS_SILENT ? 1 : 0);