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 struct btrfs_path
*path
;
16 key
.objectid
= BTRFS_ORPHAN_OBJECTID
;
17 key
.type
= BTRFS_ORPHAN_ITEM_KEY
;
20 path
= btrfs_alloc_path();
24 ret
= btrfs_insert_empty_item(trans
, root
, path
, &key
, 0);
26 btrfs_free_path(path
);
30 int btrfs_del_orphan_item(struct btrfs_trans_handle
*trans
,
31 struct btrfs_root
*root
, u64 offset
)
33 struct btrfs_path
*path
;
37 key
.objectid
= BTRFS_ORPHAN_OBJECTID
;
38 key
.type
= BTRFS_ORPHAN_ITEM_KEY
;
41 path
= btrfs_alloc_path();
45 ret
= btrfs_search_slot(trans
, root
, &key
, path
, -1, 1);
48 if (ret
) { /* JDM: Really? */
53 ret
= btrfs_del_item(trans
, root
, path
);
56 btrfs_free_path(path
);