Commit 9bc59a6
committed
mac: add readahead control to the posix_fadvise() shim
- Add support for POSIX_FADV_NORMAL in the posix_fadvise() shim by just
ignoring it
- Add support for POSIX_FADV_SEQUENTIAL/POSIX_FADV_RANDOM by mapping
them to enable/disable of readahead via fcntl(..., F_RDAHEAD, ...).
Because macOS only lets you control readahead at the descriptor level
the offset and len values passed will be ignored and range control is
not done.
The impact of being able to tune readahead can be seen below:
./fio --filename=fio.tmp --stonewall --size=128M --filename=fio.tmp --bs=4k \
--name=precache --rw=read --bs=128k \
--name=cached --rw=read \
--name=uncached-readahead --rw=read --invalidate=1 \
--name=uncached-no-readahead --rw=read --invalidate=1 --fadvise=random
[...]
cached: (groupid=1, jobs=1): err= 0: pid=32600: Sat May 17 18:49:22 2025
read: IOPS=349k, BW=1362MiB/s (1428MB/s)(128MiB/94msec)
--
uncached-readahead: (groupid=2, jobs=1): err= 0: pid=32601: Sat May 17 18:49:22 2025
read: IOPS=315k, BW=1231MiB/s (1291MB/s)(128MiB/104msec)
--
uncached-no-readahead: (groupid=3, jobs=1): err= 0: pid=32602: Sat May 17 18:49:22 2025
read: IOPS=40.8k, BW=159MiB/s (167MB/s)(128MiB/803msec)
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>1 parent 0c6f657 commit 9bc59a6
1 file changed
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
61 | 74 | | |
62 | 75 | | |
63 | 76 | | |
64 | 77 | | |
65 | 78 | | |
66 | 79 | | |
| 80 | + | |
| 81 | + | |
67 | 82 | | |
| 83 | + | |
| 84 | + | |
68 | 85 | | |
69 | | - | |
| 86 | + | |
70 | 87 | | |
71 | 88 | | |
72 | 89 | | |
| |||
0 commit comments