Lines Matching full:uuid
7 #include <linux/uuid.h>
15 #include "uuid-tree.h"
18 static void btrfs_uuid_to_key(const u8 *uuid, u8 type, struct btrfs_key *key) in btrfs_uuid_to_key() argument
21 key->objectid = get_unaligned_le64(uuid); in btrfs_uuid_to_key()
22 key->offset = get_unaligned_le64(uuid + sizeof(u64)); in btrfs_uuid_to_key()
26 static int btrfs_uuid_tree_lookup(struct btrfs_root *uuid_root, const u8 *uuid, in btrfs_uuid_tree_lookup() argument
44 btrfs_uuid_to_key(uuid, type, &key); in btrfs_uuid_tree_lookup()
59 "uuid item with illegal size %lu!", in btrfs_uuid_tree_lookup()
78 int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans, const u8 *uuid, u8 type, in btrfs_uuid_tree_add() argument
91 ret = btrfs_uuid_tree_lookup(uuid_root, uuid, type, subid_cpu); in btrfs_uuid_tree_add()
95 btrfs_uuid_to_key(uuid, type, &key); in btrfs_uuid_tree_add()
120 "insert uuid item failed %d (0x%016llx, 0x%016llx) type %u!", in btrfs_uuid_tree_add()
130 int btrfs_uuid_tree_remove(struct btrfs_trans_handle *trans, const u8 *uuid, u8 type, in btrfs_uuid_tree_remove() argument
149 btrfs_uuid_to_key(uuid, type, &key); in btrfs_uuid_tree_remove()
157 btrfs_warn(fs_info, "error %d while searching for uuid item!", in btrfs_uuid_tree_remove()
169 btrfs_warn(fs_info, "uuid item with illegal size %lu!", in btrfs_uuid_tree_remove()
200 * Check if we can add one root ID to a UUID key.
207 const u8 *uuid, u8 type) in btrfs_uuid_tree_check_overflow() argument
221 btrfs_uuid_to_key(uuid, type, &key); in btrfs_uuid_tree_check_overflow()
237 static int btrfs_uuid_iter_rem(struct btrfs_root *uuid_root, u8 *uuid, u8 type, in btrfs_uuid_iter_rem() argument
243 /* 1 - for the uuid item */ in btrfs_uuid_iter_rem()
248 ret = btrfs_uuid_tree_remove(trans, uuid, type, subid); in btrfs_uuid_iter_rem()
254 * Check if there's an matching subvolume for given UUID
262 const u8 *uuid, u8 type, u64 subvolid) in btrfs_check_uuid_tree_entry() argument
281 if (memcmp(uuid, subvol_root->root_item.uuid, BTRFS_UUID_SIZE)) in btrfs_check_uuid_tree_entry()
285 if (memcmp(uuid, subvol_root->root_item.received_uuid, in btrfs_check_uuid_tree_entry()
338 "uuid item with illegal size %lu!", in btrfs_uuid_tree_iterate()
343 u8 uuid[BTRFS_UUID_SIZE]; in btrfs_uuid_tree_iterate() local
347 put_unaligned_le64(key.objectid, uuid); in btrfs_uuid_tree_iterate()
348 put_unaligned_le64(key.offset, uuid + sizeof(u64)); in btrfs_uuid_tree_iterate()
352 ret = btrfs_check_uuid_tree_entry(fs_info, uuid, in btrfs_uuid_tree_iterate()
358 ret = btrfs_uuid_iter_rem(root, uuid, key.type, in btrfs_uuid_tree_iterate()
366 * entry per UUID exists. in btrfs_uuid_tree_iterate()
446 if (!btrfs_is_empty_uuid(root_item.uuid) || in btrfs_uuid_scan_kthread()
453 * 1 - subvol uuid item in btrfs_uuid_scan_kthread()
454 * 1 - received_subvol uuid item in btrfs_uuid_scan_kthread()
467 if (!btrfs_is_empty_uuid(root_item.uuid)) { in btrfs_uuid_scan_kthread()
468 ret = btrfs_uuid_tree_add(trans, root_item.uuid, in btrfs_uuid_scan_kthread()
557 task = kthread_run(btrfs_uuid_scan_kthread, fs_info, "btrfs-uuid"); in btrfs_create_uuid_tree()