From 028c99b39c9f8a4b366d4759f1a9c5f8e8860fd5 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 17 Jul 2026 16:13:25 +0200 Subject: [PATCH] block: raw: Remove EOPNOTSUPP skip from test_write_zeroes The WriteZeroesAt fallback means write_zeroes no longer fails on filesystems that lack fallocate support. The skip is now dead code. Signed-off-by: Anatol Belski --- block/src/formats/raw/tests.rs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/block/src/formats/raw/tests.rs b/block/src/formats/raw/tests.rs index eb0c14023..61b940792 100644 --- a/block/src/formats/raw/tests.rs +++ b/block/src/formats/raw/tests.rs @@ -13,7 +13,7 @@ use std::fs::File; use std::io::{Read, Seek, SeekFrom, Write}; -use crate::async_io::{AsyncIo, AsyncIoError}; +use crate::async_io::AsyncIo; fn next_completion(async_io: &mut dyn AsyncIo) -> (u64, i32) { let completion = async_io.next_completed_request().expect("No completion"); @@ -67,8 +67,7 @@ pub fn test_punch_hole(async_io: &mut dyn AsyncIo, file: &mut File) { } /// Tests writing zeroes to a 512 KB region inside a 4 MB file and verifying -/// surrounding data is preserved. Gracefully skips when the filesystem does -/// not support `FALLOC_FL_ZERO_RANGE`. +/// surrounding data is preserved. pub fn test_write_zeroes(async_io: &mut dyn AsyncIo, file: &mut File) { // Write 4MB of data let data = vec![0xBB; 4 * 1024 * 1024]; @@ -78,17 +77,7 @@ pub fn test_write_zeroes(async_io: &mut dyn AsyncIo, file: &mut File) { // Write zeros in the middle (512KB at offset 2MB) let offset = 2 * 1024 * 1024; let length = 512 * 1024; - let write_zeroes_result = async_io.write_zeroes(offset, length, 2); - - // FALLOC_FL_ZERO_RANGE might not be supported on all filesystems (e.g., tmpfs) - // If it fails with ENOTSUP, skip the test - if let Err(AsyncIoError::WriteZeroes(ref e)) = write_zeroes_result - && (e.raw_os_error() == Some(libc::EOPNOTSUPP) || e.raw_os_error() == Some(libc::ENOTSUP)) - { - eprintln!("Skipping test_write_zeroes: filesystem doesn't support FALLOC_FL_ZERO_RANGE"); - return; - } - write_zeroes_result.unwrap(); + async_io.write_zeroes(offset, length, 2).unwrap(); // Check completion let (user_data, result) = next_completion(async_io);