1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2008 Red Hat. All rights reserved.
10 int btrfs_insert_orphan_item(struct btrfs_trans_handle *trans,
11 struct btrfs_root *root, u64 offset)
13 struct btrfs_path *path;
17 key.objectid = BTRFS_ORPHAN_OBJECTID;
18 key.type = BTRFS_ORPHAN_ITEM_KEY;
21 path = btrfs_alloc_path();
25 ret = btrfs_insert_empty_item(trans, root, path, &key, 0);
27 btrfs_free_path(path);
31 int btrfs_del_orphan_item(struct btrfs_trans_handle *trans,
32 struct btrfs_root *root, u64 offset)
34 struct btrfs_path *path;
38 key.objectid = BTRFS_ORPHAN_OBJECTID;
39 key.type = BTRFS_ORPHAN_ITEM_KEY;
42 path = btrfs_alloc_path();
46 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
49 if (ret) { /* JDM: Really? */
54 ret = btrfs_del_item(trans, root, path);
57 btrfs_free_path(path);