From 10394da0c409f21f140d4541b0390189e6a1d7a2 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 15 Dec 2025 23:13:43 +0100 Subject: [PATCH] performance-metrics: Add RAW backing file performance tests Add sequential and random read tests for QCOW2 overlays with RAW backing files. Signed-off-by: Anatol Belski --- performance-metrics/src/main.rs | 32 +++++++++++++++++++- performance-metrics/src/performance_tests.rs | 16 ++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/performance-metrics/src/main.rs b/performance-metrics/src/main.rs index e25a84d34..e99a7b097 100644 --- a/performance-metrics/src/main.rs +++ b/performance-metrics/src/main.rs @@ -319,7 +319,7 @@ mod adjuster { } } -const TEST_LIST: [PerformanceTest; 32] = [ +const TEST_LIST: [PerformanceTest; 34] = [ PerformanceTest { name: "boot_time_ms", func_ptr: performance_boot_time, @@ -740,6 +740,36 @@ const TEST_LIST: [PerformanceTest; 32] = [ }, unit_adjuster: adjuster::Bps_to_MiBps, }, + PerformanceTest { + name: "block_qcow2_backing_raw_read_MiBps", + func_ptr: performance_block_io, + control: PerformanceTestControl { + num_queues: Some(1), + queue_size: Some(128), + block_control: Some(BlockControl { + fio_ops: FioOps::Read, + bandwidth: true, + test_file: OVERLAY_WITH_RAW_BACKING, + }), + ..PerformanceTestControl::default() + }, + unit_adjuster: adjuster::Bps_to_MiBps, + }, + PerformanceTest { + name: "block_qcow2_backing_raw_random_read_MiBps", + func_ptr: performance_block_io, + control: PerformanceTestControl { + num_queues: Some(1), + queue_size: Some(128), + block_control: Some(BlockControl { + fio_ops: FioOps::RandomRead, + bandwidth: true, + test_file: OVERLAY_WITH_RAW_BACKING, + }), + ..PerformanceTestControl::default() + }, + unit_adjuster: adjuster::Bps_to_MiBps, + }, ]; fn run_test_with_timeout( diff --git a/performance-metrics/src/performance_tests.rs b/performance-metrics/src/performance_tests.rs index 140703701..573db69ae 100644 --- a/performance-metrics/src/performance_tests.rs +++ b/performance-metrics/src/performance_tests.rs @@ -35,6 +35,8 @@ enum Error { pub const BLK_IO_TEST_IMG: &str = "/var/tmp/ch-blk-io-test.img"; const QCOW2_BACKING_FILE: &str = "/var/tmp/ch-blk-io-test-qcow2-backing.qcow2"; pub const OVERLAY_WITH_QCOW2_BACKING: &str = "/var/tmp/ch-blk-io-test-overlay-qcow2.qcow2"; +const RAW_BACKING_FILE: &str = "/var/tmp/ch-blk-io-test-raw-backing.raw"; +pub const OVERLAY_WITH_RAW_BACKING: &str = "/var/tmp/ch-blk-io-test-overlay-raw.qcow2"; pub fn init_tests(overrides: &PerformanceTestOverrides) { let mut cmd = format!("dd if=/dev/zero of={BLK_IO_TEST_IMG} bs=1M count=4096"); @@ -66,6 +68,16 @@ pub fn init_tests(overrides: &PerformanceTestOverrides) { "qemu-img create -f qcow2 -b {QCOW2_BACKING_FILE} -F qcow2 {OVERLAY_WITH_QCOW2_BACKING} 4G" ); assert!(exec_host_command_output(&cmd).status.success()); + + // RAW backing file for backing file tests + cmd = format!("dd if=/dev/zero of={RAW_BACKING_FILE} bs=1M count=4096"); + assert!(exec_host_command_output(&cmd).status.success()); + + // QCOW2 overlay with RAW backing + cmd = format!( + "qemu-img create -f qcow2 -b {RAW_BACKING_FILE} -F raw {OVERLAY_WITH_RAW_BACKING} 4G" + ); + assert!(exec_host_command_output(&cmd).status.success()); } pub fn cleanup_tests() { @@ -75,6 +87,10 @@ pub fn cleanup_tests() { .unwrap_or_else(|_| panic!("Failed to remove file '{QCOW2_BACKING_FILE}'.")); fs::remove_file(OVERLAY_WITH_QCOW2_BACKING) .unwrap_or_else(|_| panic!("Failed to remove file '{OVERLAY_WITH_QCOW2_BACKING}'.")); + fs::remove_file(RAW_BACKING_FILE) + .unwrap_or_else(|_| panic!("Failed to remove file '{RAW_BACKING_FILE}'.")); + fs::remove_file(OVERLAY_WITH_RAW_BACKING) + .unwrap_or_else(|_| panic!("Failed to remove file '{OVERLAY_WITH_RAW_BACKING}'.")); } // Performance tests are expected to be executed sequentially, so we can