From dfff1bbb83603ff016d1e3ac9cf0f1ccf3af7b20 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Fri, 26 Jun 2026 22:13:32 +0000 Subject: [PATCH 1/2] the doc was outdated behavior --- awscrt/s3.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/awscrt/s3.py b/awscrt/s3.py index c77f32c81..1bfa5a54a 100644 --- a/awscrt/s3.py +++ b/awscrt/s3.py @@ -186,16 +186,10 @@ class S3FileIoOptions: """ Enable direct IO to bypass the OS cache. Helpful when the disk I/O outperforms the kernel cache. - - Currently only Linux supports direct I/O. On unsupported platforms, the request transparently - falls back to buffered I/O and a warning is logged. - - Supported for both upload (send_filepath) and download (recv_filepath). - - For upload, part_size MUST be page-aligned when direct_io is enabled (hard fail otherwise). - The client controls part_size and is responsible for ensuring alignment. - - For download, this is a best-effort optimization. The request transparently falls back to - buffered I/O (logging a warning) if any of the following preconditions are not met: - part_size is not page-aligned, recv_file_position is not page-aligned (WRITE_TO_POSITION), - existing file size is not page-aligned (CREATE_OR_APPEND), or the last part has an - unaligned length (only that part falls back). + - This is a BEST-EFFORT optimization. The request transparently falls back to + buffered I/O (logging a warning) on unsupported platforms or when alignment + preconditions are not met (part_size not page-aligned, last part has unaligned + length, etc). - Check NOTES for O_DIRECT for additional info https://man7.org/linux/man-pages/man2/openat.2.html In summary, O_DIRECT is a potentially powerful tool that should be used with caution. From cb43d25f09b8f72bddb9c788f1b4891e1ffbc805 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Fri, 26 Jun 2026 22:31:05 +0000 Subject: [PATCH 2/2] wordsmith --- awscrt/s3.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/awscrt/s3.py b/awscrt/s3.py index 1bfa5a54a..5294f61f8 100644 --- a/awscrt/s3.py +++ b/awscrt/s3.py @@ -186,10 +186,11 @@ class S3FileIoOptions: """ Enable direct IO to bypass the OS cache. Helpful when the disk I/O outperforms the kernel cache. + - Currently only Linux supports direct I/O. On unsupported platforms, the request transparently + falls back to buffered I/O and a warning is logged. + - Supported for both upload (send_filepath) and download (recv_filepath). - This is a BEST-EFFORT optimization. The request transparently falls back to - buffered I/O (logging a warning) on unsupported platforms or when alignment - preconditions are not met (part_size not page-aligned, last part has unaligned - length, etc). + buffered I/O (logging a warning) when direct io write fails. - Check NOTES for O_DIRECT for additional info https://man7.org/linux/man-pages/man2/openat.2.html In summary, O_DIRECT is a potentially powerful tool that should be used with caution.