diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-11-17 00:38:54 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-08 19:34:37 -0500 |
commit | 38a77db49ad8f78369dcdfb693b8e5a818a60104 (patch) | |
tree | 0987ff5d4029c016b173f72c7e1883ab9cbc59a9 /fs/btrfs/disk-io.c | |
parent | 1233f546ec29ac32424327baf6ae5df81e3d9eae (diff) |
btrfs: sanitizing ->fs_info, part 3
move assignments to ->fs_info in open_ctree() up, to the place
just after the original allocations. Assignment for tree_root
becomes a no-op - we'd obtained fs_info from tree_root->fs_info
in the first place.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index b8dae517f80c..06480fcf0fb3 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1320,8 +1320,8 @@ struct btrfs_root *btrfs_read_fs_root_no_radix(struct btrfs_root *tree_root, | |||
1320 | root = kzalloc(sizeof(*root), GFP_NOFS); | 1320 | root = kzalloc(sizeof(*root), GFP_NOFS); |
1321 | if (!root) | 1321 | if (!root) |
1322 | return ERR_PTR(-ENOMEM); | 1322 | return ERR_PTR(-ENOMEM); |
1323 | root->fs_info = fs_info; | ||
1323 | if (location->offset == (u64)-1) { | 1324 | if (location->offset == (u64)-1) { |
1324 | root->fs_info = fs_info; | ||
1325 | ret = find_and_setup_root(tree_root, fs_info, | 1325 | ret = find_and_setup_root(tree_root, fs_info, |
1326 | location->objectid, root); | 1326 | location->objectid, root); |
1327 | if (ret) { | 1327 | if (ret) { |
@@ -1331,7 +1331,6 @@ struct btrfs_root *btrfs_read_fs_root_no_radix(struct btrfs_root *tree_root, | |||
1331 | goto out; | 1331 | goto out; |
1332 | } | 1332 | } |
1333 | 1333 | ||
1334 | root->fs_info = fs_info; | ||
1335 | __setup_root(tree_root->nodesize, tree_root->leafsize, | 1334 | __setup_root(tree_root->nodesize, tree_root->leafsize, |
1336 | tree_root->sectorsize, tree_root->stripesize, | 1335 | tree_root->sectorsize, tree_root->stripesize, |
1337 | root, fs_info, location->objectid); | 1336 | root, fs_info, location->objectid); |
@@ -1914,6 +1913,10 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1914 | err = -ENOMEM; | 1913 | err = -ENOMEM; |
1915 | goto fail; | 1914 | goto fail; |
1916 | } | 1915 | } |
1916 | chunk_root->fs_info = fs_info; | ||
1917 | extent_root->fs_info = fs_info; | ||
1918 | dev_root->fs_info = fs_info; | ||
1919 | csum_root->fs_info = fs_info; | ||
1917 | 1920 | ||
1918 | ret = init_srcu_struct(&fs_info->subvol_srcu); | 1921 | ret = init_srcu_struct(&fs_info->subvol_srcu); |
1919 | if (ret) { | 1922 | if (ret) { |
@@ -2057,7 +2060,6 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
2057 | init_waitqueue_head(&fs_info->transaction_blocked_wait); | 2060 | init_waitqueue_head(&fs_info->transaction_blocked_wait); |
2058 | init_waitqueue_head(&fs_info->async_submit_wait); | 2061 | init_waitqueue_head(&fs_info->async_submit_wait); |
2059 | 2062 | ||
2060 | tree_root->fs_info = fs_info; | ||
2061 | __setup_root(4096, 4096, 4096, 4096, tree_root, | 2063 | __setup_root(4096, 4096, 4096, 4096, tree_root, |
2062 | fs_info, BTRFS_ROOT_TREE_OBJECTID); | 2064 | fs_info, BTRFS_ROOT_TREE_OBJECTID); |
2063 | 2065 | ||
@@ -2250,7 +2252,6 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
2250 | btrfs_super_chunk_root_level(disk_super)); | 2252 | btrfs_super_chunk_root_level(disk_super)); |
2251 | generation = btrfs_super_chunk_root_generation(disk_super); | 2253 | generation = btrfs_super_chunk_root_generation(disk_super); |
2252 | 2254 | ||
2253 | chunk_root->fs_info = fs_info; | ||
2254 | __setup_root(nodesize, leafsize, sectorsize, stripesize, | 2255 | __setup_root(nodesize, leafsize, sectorsize, stripesize, |
2255 | chunk_root, fs_info, BTRFS_CHUNK_TREE_OBJECTID); | 2256 | chunk_root, fs_info, BTRFS_CHUNK_TREE_OBJECTID); |
2256 | 2257 | ||
@@ -2300,21 +2301,18 @@ retry_root_backup: | |||
2300 | btrfs_set_root_node(&tree_root->root_item, tree_root->node); | 2301 | btrfs_set_root_node(&tree_root->root_item, tree_root->node); |
2301 | tree_root->commit_root = btrfs_root_node(tree_root); | 2302 | tree_root->commit_root = btrfs_root_node(tree_root); |
2302 | 2303 | ||
2303 | extent_root->fs_info = fs_info; | ||
2304 | ret = find_and_setup_root(tree_root, fs_info, | 2304 | ret = find_and_setup_root(tree_root, fs_info, |
2305 | BTRFS_EXTENT_TREE_OBJECTID, extent_root); | 2305 | BTRFS_EXTENT_TREE_OBJECTID, extent_root); |
2306 | if (ret) | 2306 | if (ret) |
2307 | goto recovery_tree_root; | 2307 | goto recovery_tree_root; |
2308 | extent_root->track_dirty = 1; | 2308 | extent_root->track_dirty = 1; |
2309 | 2309 | ||
2310 | dev_root->fs_info = fs_info; | ||
2311 | ret = find_and_setup_root(tree_root, fs_info, | 2310 | ret = find_and_setup_root(tree_root, fs_info, |
2312 | BTRFS_DEV_TREE_OBJECTID, dev_root); | 2311 | BTRFS_DEV_TREE_OBJECTID, dev_root); |
2313 | if (ret) | 2312 | if (ret) |
2314 | goto recovery_tree_root; | 2313 | goto recovery_tree_root; |
2315 | dev_root->track_dirty = 1; | 2314 | dev_root->track_dirty = 1; |
2316 | 2315 | ||
2317 | csum_root->fs_info = fs_info; | ||
2318 | ret = find_and_setup_root(tree_root, fs_info, | 2316 | ret = find_and_setup_root(tree_root, fs_info, |
2319 | BTRFS_CSUM_TREE_OBJECTID, csum_root); | 2317 | BTRFS_CSUM_TREE_OBJECTID, csum_root); |
2320 | if (ret) | 2318 | if (ret) |