X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=fs%2Fbtrfs%2Froot-tree.c;h=4c6735491ee061cf7d6af58ded5064db2e4874cc;hb=df3c63d39dc95dcfd70d891238b4deccac8259d6;hp=edae751e870ca4431d3681ffa56132e4413e8150;hpb=8eb4adf60b8a2e0857643910c01aac98fe613466;p=karo-tx-linux.git diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c index edae751e870c..4c6735491ee0 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; @@ -150,9 +151,8 @@ 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_print_leaf(fs_info, path->nodes[0]); + btrfs_crit(fs_info, "unable to update root key %llu %u %llu", key->objectid, key->type, key->offset); BUG_ON(1); } @@ -216,8 +216,9 @@ int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, return btrfs_insert_item(trans, root, key, item, sizeof(*item)); } -int btrfs_find_orphan_roots(struct btrfs_root *tree_root) +int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info) { + struct btrfs_root *tree_root = fs_info->tree_root; struct extent_buffer *leaf; struct btrfs_path *path; struct btrfs_key key; @@ -227,7 +228,7 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root) 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(); @@ -275,8 +276,7 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root) * 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)); @@ -297,15 +297,15 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root) 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; } err = btrfs_del_orphan_item(trans, tree_root, root_key.objectid); - btrfs_end_transaction(trans, tree_root); + btrfs_end_transaction(trans); 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; } @@ -320,7 +320,7 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root) 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); @@ -358,11 +358,12 @@ out: } int btrfs_del_root_ref(struct btrfs_trans_handle *trans, - struct btrfs_root *tree_root, + struct btrfs_fs_info *fs_info, u64 root_id, u64 ref_id, u64 dirid, u64 *sequence, const char *name, int name_len) { + struct btrfs_root *tree_root = fs_info->tree_root; struct btrfs_path *path; struct btrfs_root_ref *ref; struct extent_buffer *leaf; @@ -429,10 +430,11 @@ out: * Will return 0, -ENOMEM, or anything from the CoW path */ int btrfs_add_root_ref(struct btrfs_trans_handle *trans, - struct btrfs_root *tree_root, + struct btrfs_fs_info *fs_info, u64 root_id, u64 ref_id, u64 dirid, u64 sequence, const char *name, int name_len) { + struct btrfs_root *tree_root = fs_info->tree_root; struct btrfs_key key; int ret; struct btrfs_path *path;