1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2008 Red Hat. All rights reserved.
9 int btrfs_insert_orphan_item(struct btrfs_trans_handle *trans,
10 struct btrfs_root *root, u64 offset)
12 BTRFS_PATH_AUTO_FREE(path);
15 key.objectid = BTRFS_ORPHAN_OBJECTID;
16 key.type = BTRFS_ORPHAN_ITEM_KEY;
19 path = btrfs_alloc_path();
23 return btrfs_insert_empty_item(trans, root, path, &key, 0);
26 int btrfs_del_orphan_item(struct btrfs_trans_handle *trans,
27 struct btrfs_root *root, u64 offset)
29 BTRFS_PATH_AUTO_FREE(path);
33 key.objectid = BTRFS_ORPHAN_OBJECTID;
34 key.type = BTRFS_ORPHAN_ITEM_KEY;
37 path = btrfs_alloc_path();
41 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
47 return btrfs_del_item(trans, root, path);