btrfs-progs: Refactor btrfs_chunk_readonly to use btrfs_fs_info
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Tue, 13 Jun 2017 09:19:32 +0000 (17:19 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 12 Jul 2017 15:53:50 +0000 (17:53 +0200)
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
extent-tree.c
volumes.c
volumes.h

index 9aa47c5..683cb58 100644 (file)
@@ -3286,7 +3286,7 @@ int btrfs_read_block_groups(struct btrfs_root *root)
                        bit = BLOCK_GROUP_METADATA;
                }
                set_avail_alloc_bits(info, cache->flags);
-               if (btrfs_chunk_readonly(root, cache->key.objectid))
+               if (btrfs_chunk_readonly(info, cache->key.objectid))
                        cache->ro = 1;
 
                account_super_bytes(info, cache);
index 5b3b142..bdaca19 100644 (file)
--- a/volumes.c
+++ b/volumes.c
@@ -1636,11 +1636,11 @@ btrfs_find_device_by_devid(struct btrfs_fs_devices *fs_devices,
        return NULL;
 }
 
-int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset)
+int btrfs_chunk_readonly(struct btrfs_fs_info *fs_info, u64 chunk_offset)
 {
        struct cache_extent *ce;
        struct map_lookup *map;
-       struct btrfs_mapping_tree *map_tree = &root->fs_info->mapping_tree;
+       struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree;
        int readonly = 0;
        int i;
 
@@ -1649,7 +1649,7 @@ int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset)
         * corresponding chunk, we will rebuild it later
         */
        ce = search_cache_extent(&map_tree->cache_tree, chunk_offset);
-       if (!root->fs_info->is_chunk_recover)
+       if (!fs_info->is_chunk_recover)
                BUG_ON(!ce);
        else
                return 0;
index 783b356..44130ad 100644 (file)
--- a/volumes.h
+++ b/volumes.h
@@ -232,7 +232,7 @@ int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len);
 struct list_head *btrfs_scanned_uuids(void);
 int btrfs_add_system_chunk(struct btrfs_fs_info *fs_info, struct btrfs_key *key,
                           struct btrfs_chunk *chunk, int item_size);
-int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset);
+int btrfs_chunk_readonly(struct btrfs_fs_info *fs_info, u64 chunk_offset);
 struct btrfs_device *
 btrfs_find_device_by_devid(struct btrfs_fs_devices *fs_devices,
                           u64 devid, int instance);