Commit 0100771
fix(fs): support SEEK_DATA/SEEK_HOLE for AioFileAdaptor (alibaba#1535)
Override lseek in AioFileAdaptor to handle SEEK_DATA/SEEK_HOLE by
delegating to the kernel (::lseek on the real fd) and syncing the
self-managed m_offset with the result; all other whence values keep the
VirtualFile (m_offset-based) route. Guarded by #if defined(SEEK_DATA)
&& defined(SEEK_HOLE) so platforms without these macros (e.g. iocp on
Windows) still compile.
Previously AioFileAdaptor inherited VirtualFile::lseek, which only
supports SEEK_SET/CUR/END and returned -1 for SEEK_DATA/SEEK_HOLE, so
sparse-file queries (e.g. full_file_cache) failed on aio-backed files.
PsyncFileAdaptor keeps its own kernel-offset lseek and is unaffected.
Add LocalFileSystem.aio_seek_data_hole to verify SEEK_DATA/SEEK_HOLE on
an AioFileAdaptor over a sparse file, including m_offset sync.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent c4c51f9 commit 0100771
2 files changed
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
290 | 301 | | |
291 | 302 | | |
292 | 303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
937 | 937 | | |
938 | 938 | | |
939 | 939 | | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
940 | 977 | | |
941 | 978 | | |
942 | 979 | | |
| |||
0 commit comments