rust: suppress errors on fs probing

suppress errors for any non-bchfs blockdevs found during probing

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
This commit is contained in:
Alexander Fougner 2023-01-15 21:57:04 +01:00
parent 87243efa5c
commit bdc290eee0

View File

@ -195,11 +195,16 @@ pub fn probe_filesystems() -> anyhow::Result<HashMap<Uuid, FileSystem>> {
// #[tracing_attributes::instrument(skip(dev, fs_map))]
fn get_super_block_uuid(path: &std::path::Path) -> std::io::Result<std::io::Result<(Uuid, bcachefs::bch_sb_handle)>> {
use gag::{BufferRedirect};
// Stop libbcachefs from spamming the output
let gag = BufferRedirect::stdout().unwrap();
let sb = bch_bindgen::rs::read_super(&path)?;
let super_block = match sb {
Err(e) => { return Ok(Err(e)); }
Ok(sb) => sb,
};
drop(gag);
let uuid = (&super_block).sb().uuid();
tracing::debug!(found="bcachefs superblock", devnode=?path, ?uuid);