]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
rust: suppress errors on fs probing
authorAlexander Fougner <fougner89@gmail.com>
Sun, 15 Jan 2023 20:57:04 +0000 (21:57 +0100)
committerAlexander Fougner <fougner89@gmail.com>
Sun, 15 Jan 2023 21:20:16 +0000 (22:20 +0100)
suppress errors for any non-bchfs blockdevs found during probing

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
rust-src/mount/src/filesystem.rs

index b1575c26590e684c4df6a9231894beefc79d4ab3..89865bc439b12242ead91dac47f8d56f3dc6b019 100644 (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);