btrfs: sink get_extent parameter to read_extent_buffer_pages
[sfrench/cifs-2.6.git] / fs / btrfs / disk-io.c
index a8ecccfc36ded1d9470deb0d78f77bcdacb6d0cf..cbf37df05a8838eebbace7d09efd44a0907d2000 100644 (file)
@@ -220,7 +220,7 @@ void btrfs_set_buffer_lockdep_class(u64 objectid, struct extent_buffer *eb,
  * extents on the btree inode are pretty simple, there's one extent
  * that covers the entire device
  */
-static struct extent_map *btree_get_extent(struct btrfs_inode *inode,
+struct extent_map *btree_get_extent(struct btrfs_inode *inode,
                struct page *page, size_t pg_offset, u64 start, u64 len,
                int create)
 {
@@ -455,7 +455,7 @@ static int btree_read_extent_buffer_pages(struct btrfs_fs_info *fs_info,
        io_tree = &BTRFS_I(fs_info->btree_inode)->io_tree;
        while (1) {
                ret = read_extent_buffer_pages(io_tree, eb, WAIT_COMPLETE,
-                                              btree_get_extent, mirror_num);
+                                              mirror_num);
                if (!ret) {
                        if (!verify_parent_transid(io_tree, eb,
                                                   parent_transid, 0))
@@ -1012,7 +1012,7 @@ void readahead_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr)
        if (IS_ERR(buf))
                return;
        read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree,
-                                buf, WAIT_NONE, btree_get_extent, 0);
+                                buf, WAIT_NONE, 0);
        free_extent_buffer(buf);
 }
 
@@ -1031,7 +1031,7 @@ int reada_tree_block_flagged(struct btrfs_fs_info *fs_info, u64 bytenr,
        set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags);
 
        ret = read_extent_buffer_pages(io_tree, buf, WAIT_PAGE_LOCK,
-                                      btree_get_extent, mirror_num);
+                                      mirror_num);
        if (ret) {
                free_extent_buffer(buf);
                return ret;
@@ -1243,7 +1243,7 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
        struct btrfs_root *root;
        struct btrfs_key key;
        int ret = 0;
-       uuid_le uuid;
+       uuid_le uuid = NULL_UUID_LE;
 
        root = btrfs_alloc_root(fs_info, GFP_KERNEL);
        if (!root)
@@ -1284,7 +1284,8 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
        btrfs_set_root_used(&root->root_item, leaf->len);
        btrfs_set_root_last_snapshot(&root->root_item, 0);
        btrfs_set_root_dirid(&root->root_item, 0);
-       uuid_le_gen(&uuid);
+       if (is_fstree(objectid))
+               uuid_le_gen(&uuid);
        memcpy(root->root_item.uuid, uuid.b, BTRFS_UUID_SIZE);
        root->root_item.drop_level = 0;
 
@@ -3394,9 +3395,10 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
        int errors_wait = 0;
        blk_status_t ret;
 
+       lockdep_assert_held(&info->fs_devices->device_list_mutex);
        /* send down all the barriers */
        head = &info->fs_devices->devices;
-       list_for_each_entry_rcu(dev, head, dev_list) {
+       list_for_each_entry(dev, head, dev_list) {
                if (dev->missing)
                        continue;
                if (!dev->bdev)
@@ -3409,7 +3411,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
        }
 
        /* wait for all the barriers */
-       list_for_each_entry_rcu(dev, head, dev_list) {
+       list_for_each_entry(dev, head, dev_list) {
                if (dev->missing)
                        continue;
                if (!dev->bdev) {
@@ -3508,7 +3510,7 @@ int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors)
                }
        }
 
-       list_for_each_entry_rcu(dev, head, dev_list) {
+       list_for_each_entry(dev, head, dev_list) {
                if (!dev->bdev) {
                        total_errors++;
                        continue;
@@ -3549,7 +3551,7 @@ int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors)
        }
 
        total_errors = 0;
-       list_for_each_entry_rcu(dev, head, dev_list) {
+       list_for_each_entry(dev, head, dev_list) {
                if (!dev->bdev)
                        continue;
                if (!dev->in_fs_metadata || !dev->writeable)