Linux: Use copy_file_range for defrag of the disk cache which should give even better performance on filesystems that support it

This commit is contained in:
Kovid Goyal
2021-11-24 19:42:00 +05:30
parent bd21b79959
commit 617316e8d9
2 changed files with 61 additions and 27 deletions

View File

@@ -326,6 +326,9 @@ def init_env(
cppflags = shlex.split(cppflags_)
for el in extra_logging:
cppflags.append('-DDEBUG_{}'.format(el.upper().replace('-', '_')))
has_copy_file_range = test_compile(cc, src='#define _GNU_SOURCE 1\n#include <unistd.h>\nint main() { copy_file_range(1, NULL, 2, NULL, 0, 0); return 0; }')
if has_copy_file_range:
cppflags.append('-DHAS_COPY_FILE_RANGE')
werror = '' if ignore_compiler_warnings else '-pedantic-errors -Werror'
std = '' if is_openbsd else '-std=c11'
sanitize_flag = ' '.join(sanitize_args)