summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/root-tree.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2016-06-22 18:54:23 -0400
committerDavid Sterba <dsterba@suse.com>2016-12-06 16:06:59 +0100
commit0b246afa62b0cf5b09d078121f543135f28492ad (patch)
tree200ad296d09f1b2f5329658c8de81bc625007ace /fs/btrfs/root-tree.c
parent6202df6921494f29308307e0ae6f567c2ab2ba19 (diff)
downloadlinux-0b246afa62b0cf5b09d078121f543135f28492ad.tar.bz2
btrfs: root->fs_info cleanup, add fs_info convenience variables
In routines where someptr->fs_info is referenced multiple times, we introduce a convenience variable. This makes the code considerably more readable. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/root-tree.c')
-rw-r--r--fs/btrfs/root-tree.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 60e711ae044a..f7f6cb7d9a62 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -132,6 +132,7 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
*root, struct btrfs_key *key, struct btrfs_root_item
*item)
{
+ struct btrfs_fs_info *fs_info = root->fs_info;
struct btrfs_path *path;
struct extent_buffer *l;
int ret;
@@ -151,8 +152,7 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
if (ret != 0) {
btrfs_print_leaf(root, path->nodes[0]);
- btrfs_crit(root->fs_info,
- "unable to update root key %llu %u %llu",
+ btrfs_crit(fs_info, "unable to update root key %llu %u %llu",
key->objectid, key->type, key->offset);
BUG_ON(1);
}
@@ -228,7 +228,7 @@ int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info)
int ret;
bool can_recover = true;
- if (tree_root->fs_info->sb->s_flags & MS_RDONLY)
+ if (fs_info->sb->s_flags & MS_RDONLY)
can_recover = false;
path = btrfs_alloc_path();
@@ -276,8 +276,7 @@ int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info)
* in turn reads and inserts fs roots while doing backref
* walking.
*/
- root = btrfs_lookup_fs_root(tree_root->fs_info,
- root_key.objectid);
+ root = btrfs_lookup_fs_root(fs_info, root_key.objectid);
if (root) {
WARN_ON(!test_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED,
&root->state));
@@ -298,7 +297,7 @@ int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info)
trans = btrfs_join_transaction(tree_root);
if (IS_ERR(trans)) {
err = PTR_ERR(trans);
- btrfs_handle_fs_error(tree_root->fs_info, err,
+ btrfs_handle_fs_error(fs_info, err,
"Failed to start trans to delete orphan item");
break;
}
@@ -306,7 +305,7 @@ int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info)
root_key.objectid);
btrfs_end_transaction(trans, tree_root);
if (err) {
- btrfs_handle_fs_error(tree_root->fs_info, err,
+ btrfs_handle_fs_error(fs_info, err,
"Failed to delete root orphan item");
break;
}
@@ -321,7 +320,7 @@ int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info)
set_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state);
- err = btrfs_insert_fs_root(root->fs_info, root);
+ err = btrfs_insert_fs_root(fs_info, root);
if (err) {
BUG_ON(err == -EEXIST);
btrfs_free_fs_root(root);