From 2f75c8ea623b8a22582f50eee6cdc1618768b35d Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 27 May 2026 21:37:36 +0000 Subject: [PATCH 1/3] support odirect download --- awscrt/s3.py | 13 +++++++++++-- crt/aws-c-common | 2 +- crt/aws-c-s3 | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/awscrt/s3.py b/awscrt/s3.py index 2a732f5ff..3bbc7fb10 100644 --- a/awscrt/s3.py +++ b/awscrt/s3.py @@ -186,8 +186,17 @@ class S3FileIoOptions: """ Enable direct IO to bypass the OS cache. Helpful when the disk I/O outperforms the kernel cache. Notes: - - Only supported on linux for now. - - Only supports upload for now. + - 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 + - For WRITE_TO_POSITION, recv_file_position is not page-aligned + - For CREATE_OR_APPEND, the existing file size is not page-aligned + - The last part of the download has an unaligned length (only that part falls back) - 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. """ diff --git a/crt/aws-c-common b/crt/aws-c-common index d3b926fd8..a068d3ac4 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit d3b926fd87e6c37887ae12bb2253550334e7445a +Subproject commit a068d3ac4f96cfd658123cfb6df09083b50d5eea diff --git a/crt/aws-c-s3 b/crt/aws-c-s3 index f1a52b5e9..d3c63ddae 160000 --- a/crt/aws-c-s3 +++ b/crt/aws-c-s3 @@ -1 +1 @@ -Subproject commit f1a52b5e960c06bd9392cb5e982c6fe04f1ce253 +Subproject commit d3c63ddae4255ad53cefd2b87af519d9ee5e0e7a From 8d0502ca5dcb5be67cf9518e1b25168501ca2fed Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 24 Jun 2026 12:06:21 -0700 Subject: [PATCH 2/3] latest submodule --- crt/aws-c-common | 2 +- crt/aws-c-io | 2 +- crt/aws-c-s3 | 2 +- crt/aws-c-sdkutils | 2 +- crt/aws-lc | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crt/aws-c-common b/crt/aws-c-common index a068d3ac4..2b4c620fe 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit a068d3ac4f96cfd658123cfb6df09083b50d5eea +Subproject commit 2b4c620fecec43fb847da3d2064ce023ebfd3ef9 diff --git a/crt/aws-c-io b/crt/aws-c-io index 1ec8081f2..9156a8f79 160000 --- a/crt/aws-c-io +++ b/crt/aws-c-io @@ -1 +1 @@ -Subproject commit 1ec8081f208ef8d51381889eda3bda9756fd5bb5 +Subproject commit 9156a8f7970d615cbb689900f7adef70f2366c88 diff --git a/crt/aws-c-s3 b/crt/aws-c-s3 index d3c63ddae..9bcccf21b 160000 --- a/crt/aws-c-s3 +++ b/crt/aws-c-s3 @@ -1 +1 @@ -Subproject commit d3c63ddae4255ad53cefd2b87af519d9ee5e0e7a +Subproject commit 9bcccf21bbbef08fda20efacb50b8a180e63f0ac diff --git a/crt/aws-c-sdkutils b/crt/aws-c-sdkutils index f678bda9e..727df06fc 160000 --- a/crt/aws-c-sdkutils +++ b/crt/aws-c-sdkutils @@ -1 +1 @@ -Subproject commit f678bda9e21f7217e4bbf35e0d1ea59540687933 +Subproject commit 727df06fc0e998e673de70fb69e5a634fe4979bc diff --git a/crt/aws-lc b/crt/aws-lc index 44766fa7d..6f246af4c 160000 --- a/crt/aws-lc +++ b/crt/aws-lc @@ -1 +1 @@ -Subproject commit 44766fa7daa88e5afc7fc6de3311c48eeeb02f39 +Subproject commit 6f246af4cd1de8cee8c62d76139bcda299c1aa00 From 9454ef0db59e9625bddd26326bdf7512a2ad103f Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 24 Jun 2026 20:14:34 +0000 Subject: [PATCH 3/3] fix doc --- awscrt/s3.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/awscrt/s3.py b/awscrt/s3.py index 3bbc7fb10..c77f32c81 100644 --- a/awscrt/s3.py +++ b/awscrt/s3.py @@ -185,7 +185,7 @@ class S3FileIoOptions: direct_io: bool = False """ Enable direct IO to bypass the OS cache. Helpful when the disk I/O outperforms the kernel cache. - Notes: + - 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). @@ -193,11 +193,11 @@ class S3FileIoOptions: 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 - - For WRITE_TO_POSITION, recv_file_position is not page-aligned - - For CREATE_OR_APPEND, the existing file size is not page-aligned - - The last part of the download has an unaligned length (only that part falls back) + 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). - 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. """