Expand description
dio-align
§Overview
dio-align reports the logical and physical block sizes required for direct I/O alignment on the
filesystem backing a given path. On Linux 6.1+ it also reports the required memory alignment when
statx(DIOALIGN) is available.
§Installation
[dependencies]
dio-align = "0.1"§Usage
use dio_align::fetch;
fn main() -> std::io::Result<()> {
let info = fetch("src/lib.rs")?;
println!("logical: {}", info.logical_block_size());
println!("physical: {}", info.physical_block_size());
Ok(())
}§Platform notes
- Linux 6.1+: uses
statx(DIOALIGN)for memory and logical alignment and sysfs for physical size. - Linux < 6.1: uses block device ioctls and sysfs; memory alignment is not available.
- macOS and other Apple OSes: uses
statfsand reportsf_bsizeandf_iosize. - Windows: uses
GetDiskFreeSpaceWfor logical size and storage property queries for physical size. Physical size may fall back to the logical size if the query is not supported.
§License
dio-align is under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.
Copyright (c) 2026 Al Liu.
Structs§
- Direct
Info - Direct I/O alignment information for a filesystem path.
Functions§
- fetch
- Fetch direct I/O alignment information for a path.