thin-provisioning-tools/src/thin/check.rs

24 lines
575 B
Rust
Raw Normal View History

use std::error::Error;
2020-07-27 20:23:42 +05:30
use std::path::Path;
use std::time::{Duration, Instant};
use std::thread;
use std::sync::{Arc, Mutex};
2020-07-27 20:23:42 +05:30
use crate::block_manager::{Block, IoEngine, SyncIoEngine, BLOCK_SIZE};
2020-07-27 20:23:42 +05:30
pub fn check(dev: &Path) -> Result<(), Box<dyn Error>> {
let mut engine = SyncIoEngine::new(dev)?;
let count = 4096;
2020-07-27 20:23:42 +05:30
let mut blocks = Vec::new();
for n in 0..count {
blocks.push(Block::new(n));
}
2020-07-27 20:23:42 +05:30
let now = Instant::now();
engine.read(&mut blocks)?;
println!("read {} blocks in {} ms", count, now.elapsed().as_millis());
Ok(())
}