From bb833a90e5a26b4bc086fe9539be81b123d5b5fd Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 30 Mar 2026 23:51:03 +0200 Subject: [PATCH] block: qcow_async: Add large sequential I/O test Write a distinct byte pattern into each of eight consecutive clusters in a single operation, then read the full range back and verify per cluster contents. Signed-off-by: Anatol Belski --- block/src/qcow_async.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/block/src/qcow_async.rs b/block/src/qcow_async.rs index daf8d1634..d58b1b1b7 100644 --- a/block/src/qcow_async.rs +++ b/block/src/qcow_async.rs @@ -923,4 +923,28 @@ mod unit_tests { let buf = async_read(&disk, offset, new_data.len()); assert_eq!(buf, new_data, "should read new data after rewrite"); } + + #[test] + fn test_qcow_async_large_sequential_io() { + let cluster_size = 64 * 1024; + let num_clusters = 8; + let total_len = cluster_size * num_clusters; + let offset = 0u64; + + let mut data = vec![0u8; total_len]; + for (i, chunk) in data.chunks_mut(cluster_size).enumerate() { + chunk.fill((i + 1) as u8); + } + + let (_temp, disk) = create_disk_with_data(100 * 1024 * 1024, &data, offset, true); + + let buf = async_read(&disk, offset, total_len); + assert_eq!(buf.len(), total_len); + for (i, chunk) in buf.chunks(cluster_size).enumerate() { + assert!( + chunk.iter().all(|&b| b == (i + 1) as u8), + "cluster {i} mismatch" + ); + } + } }