diff options
Diffstat (limited to 'fs/btrfs/uuid-tree.c')
-rw-r--r-- | fs/btrfs/uuid-tree.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c index 7fc89e4adb41..726f928238d0 100644 --- a/fs/btrfs/uuid-tree.c +++ b/fs/btrfs/uuid-tree.c @@ -92,9 +92,10 @@ out: } int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans, - struct btrfs_root *uuid_root, u8 *uuid, u8 type, + struct btrfs_fs_info *fs_info, u8 *uuid, u8 type, u64 subid_cpu) { + struct btrfs_root *uuid_root = fs_info->uuid_root; int ret; struct btrfs_path *path = NULL; struct btrfs_key key; @@ -132,13 +133,13 @@ int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans, * An item with that type already exists. * Extend the item and store the new subid at the end. */ - btrfs_extend_item(uuid_root, path, sizeof(subid_le)); + btrfs_extend_item(fs_info, path, sizeof(subid_le)); eb = path->nodes[0]; slot = path->slots[0]; offset = btrfs_item_ptr_offset(eb, slot); offset += btrfs_item_size_nr(eb, slot) - sizeof(subid_le); } else if (ret < 0) { - btrfs_warn(uuid_root->fs_info, + btrfs_warn(fs_info, "insert uuid item failed %d (0x%016llx, 0x%016llx) type %u!", ret, (unsigned long long)key.objectid, (unsigned long long)key.offset, type); @@ -156,9 +157,10 @@ out: } int btrfs_uuid_tree_rem(struct btrfs_trans_handle *trans, - struct btrfs_root *uuid_root, u8 *uuid, u8 type, + struct btrfs_fs_info *fs_info, u8 *uuid, u8 type, u64 subid) { + struct btrfs_root *uuid_root = fs_info->uuid_root; int ret; struct btrfs_path *path = NULL; struct btrfs_key key; @@ -185,8 +187,8 @@ int btrfs_uuid_tree_rem(struct btrfs_trans_handle *trans, ret = btrfs_search_slot(trans, uuid_root, &key, path, -1, 1); if (ret < 0) { - btrfs_warn(uuid_root->fs_info, - "error %d while searching for uuid item!", ret); + btrfs_warn(fs_info, "error %d while searching for uuid item!", + ret); goto out; } if (ret > 0) { @@ -199,8 +201,7 @@ int btrfs_uuid_tree_rem(struct btrfs_trans_handle *trans, offset = btrfs_item_ptr_offset(eb, slot); item_size = btrfs_item_size_nr(eb, slot); if (!IS_ALIGNED(item_size, sizeof(u64))) { - btrfs_warn(uuid_root->fs_info, - "uuid item with illegal size %lu!", + btrfs_warn(fs_info, "uuid item with illegal size %lu!", (unsigned long)item_size); ret = -ENOENT; goto out; @@ -230,7 +231,7 @@ int btrfs_uuid_tree_rem(struct btrfs_trans_handle *trans, move_src = offset + sizeof(subid); move_len = item_size - (move_src - btrfs_item_ptr_offset(eb, slot)); memmove_extent_buffer(eb, move_dst, move_src, move_len); - btrfs_truncate_item(uuid_root, path, item_size - sizeof(subid), 1); + btrfs_truncate_item(fs_info, path, item_size - sizeof(subid), 1); out: btrfs_free_path(path); @@ -250,8 +251,8 @@ static int btrfs_uuid_iter_rem(struct btrfs_root *uuid_root, u8 *uuid, u8 type, goto out; } - ret = btrfs_uuid_tree_rem(trans, uuid_root, uuid, type, subid); - btrfs_end_transaction(trans, uuid_root); + ret = btrfs_uuid_tree_rem(trans, uuid_root->fs_info, uuid, type, subid); + btrfs_end_transaction(trans); out: return ret; @@ -351,7 +352,5 @@ skip: out: btrfs_free_path(path); - if (ret) - btrfs_warn(fs_info, "btrfs_uuid_tree_iterate failed %d", ret); - return 0; + return ret; } |