diff --git a/btrfs/src/v2/tree.rs b/btrfs/src/v2/tree.rs index 0d96e14..0aecf25 100644 --- a/btrfs/src/v2/tree.rs +++ b/btrfs/src/v2/tree.rs @@ -339,26 +339,6 @@ impl Tree { Ok(entry) } - pub fn find_key(&self, key: &K) -> Result> - where - K: PartialEq + PartialOrd, - { - match self.find_node(key)? { - Some(node) => node.parse_item().map(|item| Some(item)), - None => Ok(None), - } - } - - pub fn find_key_rev(&self, key: &K) -> Result> - where - K: PartialEq + PartialOrd, - { - match self.find_node_rev(key)? { - Some(node) => node.parse_item().map(|item| Some(item)), - None => Ok(None), - } - } - pub fn find_range(&self, key: &K) -> Result> where K: PartialEq + PartialOrd, diff --git a/btrfs/src/v2/volume.rs b/btrfs/src/v2/volume.rs index f7c59b5..04c2d04 100644 --- a/btrfs/src/v2/volume.rs +++ b/btrfs/src/v2/volume.rs @@ -322,14 +322,15 @@ impl Volume2 { 0x8dbfc2d2, // crc of "default" ); - let subvol_root = root_tree - .find_key(&key)? - .ok_or(Error::NoDefaultSubvolRoot)?; + let subvol_root = match root_tree.entry(&key)? { + super::tree::entry::Entry::Occupied(entry) => Some(entry.value()?), + super::tree::entry::Entry::Vacant(_) => None, + } + .ok_or(Error::NoDefaultSubvolRoot)?; // if we found the dir entry of the "default subvol" (mharmstone nomenclature) // we then look for the root fs tree in the root tree with the ID found in the `.location` of the dir_item only (from mharmstone) let subvol_id = subvol_root - .1 .as_dir_item() .expect("dir item") .first()