Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 30 Jul 2009 23:46:48 +0000 (16:46 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 30 Jul 2009 23:46:48 +0000 (16:46 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
  Btrfs: be more polite in the async caching threads
  Btrfs: preserve commit_root for async caching

1  2 
fs/btrfs/ctree.h
fs/btrfs/disk-io.c

diff --combined fs/btrfs/ctree.h
@@@ -41,6 -41,8 +41,6 @@@ struct btrfs_ordered_sum
  
  #define BTRFS_MAGIC "_BHRfS_M"
  
 -#define BTRFS_ACL_NOT_CACHED    ((void *)-1)
 -
  #define BTRFS_MAX_LEVEL 8
  
  #define BTRFS_COMPAT_EXTENT_TREE_V0
@@@ -825,6 -827,7 +825,7 @@@ struct btrfs_fs_info 
        struct mutex drop_mutex;
        struct mutex volume_mutex;
        struct mutex tree_reloc_mutex;
+       struct rw_semaphore extent_commit_sem;
  
        /*
         * this protects the ordered operations list only while we are
@@@ -959,9 -962,6 +960,6 @@@ struct btrfs_root 
        /* the node lock is held while changing the node pointer */
        spinlock_t node_lock;
  
-       /* taken when updating the commit root */
-       struct rw_semaphore commit_root_sem;
        struct extent_buffer *commit_root;
        struct btrfs_root *log_root;
        struct btrfs_root *reloc_root;
diff --combined fs/btrfs/disk-io.c
@@@ -42,8 -42,6 +42,8 @@@
  static struct extent_io_ops btree_extent_io_ops;
  static void end_workqueue_fn(struct btrfs_work *work);
  
 +static atomic_t btrfs_bdi_num = ATOMIC_INIT(0);
 +
  /*
   * end_io_wq structs are used to do processing in task context when an IO is
   * complete.  This is used during reads to verify checksums, and it is used
@@@ -909,7 -907,6 +909,6 @@@ static int __setup_root(u32 nodesize, u
        spin_lock_init(&root->inode_lock);
        mutex_init(&root->objectid_mutex);
        mutex_init(&root->log_mutex);
-       init_rwsem(&root->commit_root_sem);
        init_waitqueue_head(&root->log_writer_wait);
        init_waitqueue_head(&root->log_commit_wait[0]);
        init_waitqueue_head(&root->log_commit_wait[1]);
@@@ -1345,25 -1342,12 +1344,25 @@@ static void btrfs_unplug_io_fn(struct b
        free_extent_map(em);
  }
  
 +/*
 + * If this fails, caller must call bdi_destroy() to get rid of the
 + * bdi again.
 + */
  static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi)
  {
 -      bdi_init(bdi);
 +      int err;
 +
 +      bdi->capabilities = BDI_CAP_MAP_COPY;
 +      err = bdi_init(bdi);
 +      if (err)
 +              return err;
 +
 +      err = bdi_register(bdi, NULL, "btrfs-%d",
 +                              atomic_inc_return(&btrfs_bdi_num));
 +      if (err)
 +              return err;
 +
        bdi->ra_pages   = default_backing_dev_info.ra_pages;
 -      bdi->state              = 0;
 -      bdi->capabilities       = default_backing_dev_info.capabilities;
        bdi->unplug_io_fn       = btrfs_unplug_io_fn;
        bdi->unplug_io_data     = info;
        bdi->congested_fn       = btrfs_congested_fn;
@@@ -1585,8 -1569,7 +1584,8 @@@ struct btrfs_root *open_ctree(struct su
        fs_info->sb = sb;
        fs_info->max_extent = (u64)-1;
        fs_info->max_inline = 8192 * 1024;
 -      setup_bdi(fs_info, &fs_info->bdi);
 +      if (setup_bdi(fs_info, &fs_info->bdi))
 +              goto fail_bdi;
        fs_info->btree_inode = new_inode(sb);
        fs_info->btree_inode->i_ino = 1;
        fs_info->btree_inode->i_nlink = 1;
        mutex_init(&fs_info->cleaner_mutex);
        mutex_init(&fs_info->volume_mutex);
        mutex_init(&fs_info->tree_reloc_mutex);
+       init_rwsem(&fs_info->extent_commit_sem);
  
        btrfs_init_free_cluster(&fs_info->meta_alloc_cluster);
        btrfs_init_free_cluster(&fs_info->data_alloc_cluster);
@@@ -1973,8 -1957,8 +1973,8 @@@ fail_iput
  
        btrfs_close_devices(fs_info->fs_devices);
        btrfs_mapping_tree_free(&fs_info->mapping_tree);
 +fail_bdi:
        bdi_destroy(&fs_info->bdi);
 -
  fail:
        kfree(extent_root);
        kfree(tree_root);