mirror of
https://github.com/Zygo/bees.git
synced 2025-05-17 21:35:45 +02:00
btrfs-tree: add a method to get root backref items to BtrfsRootFetcher
This complements the already existing support for reading the fields of a root backref. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
parent
58ee297cde
commit
dd08f6379f
@ -198,6 +198,7 @@ namespace crucible {
|
|||||||
public:
|
public:
|
||||||
BtrfsRootFetcher(const Fd &fd);
|
BtrfsRootFetcher(const Fd &fd);
|
||||||
BtrfsTreeItem root(uint64_t subvol);
|
BtrfsTreeItem root(uint64_t subvol);
|
||||||
|
BtrfsTreeItem root_backref(uint64_t subvol);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Fetch data extent items from extent tree, skipping metadata-only block groups
|
/// Fetch data extent items from extent tree, skipping metadata-only block groups
|
||||||
|
@ -696,17 +696,31 @@ namespace crucible {
|
|||||||
BtrfsTreeObjectFetcher(fd)
|
BtrfsTreeObjectFetcher(fd)
|
||||||
{
|
{
|
||||||
tree(BTRFS_ROOT_TREE_OBJECTID);
|
tree(BTRFS_ROOT_TREE_OBJECTID);
|
||||||
type(BTRFS_ROOT_ITEM_KEY);
|
|
||||||
scale_size(1);
|
scale_size(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
BtrfsTreeItem
|
BtrfsTreeItem
|
||||||
BtrfsRootFetcher::root(uint64_t subvol)
|
BtrfsRootFetcher::root(const uint64_t subvol)
|
||||||
{
|
{
|
||||||
|
const auto my_type = BTRFS_ROOT_ITEM_KEY;
|
||||||
|
type(my_type);
|
||||||
const auto item = at(subvol);
|
const auto item = at(subvol);
|
||||||
if (!!item) {
|
if (!!item) {
|
||||||
THROW_CHECK2(runtime_error, item.objectid(), subvol, subvol == item.objectid());
|
THROW_CHECK2(runtime_error, item.objectid(), subvol, subvol == item.objectid());
|
||||||
THROW_CHECK2(runtime_error, item.type(), BTRFS_ROOT_ITEM_KEY, item.type() == BTRFS_ROOT_ITEM_KEY);
|
THROW_CHECK2(runtime_error, item.type(), my_type, item.type() == my_type);
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
BtrfsTreeItem
|
||||||
|
BtrfsRootFetcher::root_backref(const uint64_t subvol)
|
||||||
|
{
|
||||||
|
const auto my_type = BTRFS_ROOT_BACKREF_KEY;
|
||||||
|
type(my_type);
|
||||||
|
const auto item = at(subvol);
|
||||||
|
if (!!item) {
|
||||||
|
THROW_CHECK2(runtime_error, item.objectid(), subvol, subvol == item.objectid());
|
||||||
|
THROW_CHECK2(runtime_error, item.type(), my_type, item.type() == my_type);
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user