Allow for more file system support by making a choice to use posix_fallocate instead of fallocate
In the chunkio code there are system calls to expand files by using the system call "fallocate" that limits usage to certain file system types, this is mainly due to performance reasons.
To support more file systems apart from XFS, ext4 etc, it would be good if there could be an option to use posix_fallocate and let the decision on performance be up to usage and configurable.
thanks, this will be added (no ETA)
While the pull request #64 addresses the issue on modern linux operating system it still fails on older linuxes e.g. Suse 11 SP4
suse:/chunkio # ./cio -e 5 -p 400kb.txt
[src/cio_file.c:332 errno=95] Operation not supported
[chunkio] cannot adjust chunk size '/tmp/cio-perf//test-perf/perf-test-0000.txt' to 4096 bytes
[src/cio_file.c:332 errno=95] Operation not supported
[chunkio] cannot adjust chunk size '/tmp/cio-perf//test-perf/perf-test-0001.txt' to 4096 bytes
[src/cio_file.c:332 errno=95] Operation not supported
[chunkio] cannot adjust chunk size '/tmp/cio-perf//test-perf/perf-test-0002.txt' to 4096 bytes
[src/cio_file.c:332 errno=95] Operation not supported
[chunkio] cannot adjust chunk size '/tmp/cio-perf//test-perf/perf-test-0003.txt' to 4096 bytes
[src/cio_file.c:332 errno=95] Operation not supported
[chunkio] cannot adjust chunk size '/tmp/cio-perf//test-perf/perf-test-0004.txt' to 4096 bytes
=== perf write ===
- crc32 checksum : disabled
- fs sync mode : normal
- file size : 400.0K (409600 bytes)
- total files : 5
- file writes : 5
- bytes written : 0b (0 bytes)
- elapsed time : 0.00 seconds
- rate : 0b per second (0.00 bytes)
suse:/chunkio # cat /etc/SuSE-
SuSE-brand SuSE-release
suse:/chunkio # cat /etc/SuSE-
SuSE-brand SuSE-release
suse:/chunkio # cat /etc/SuSE-release
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 4
This is due to the call to fallocate does not return EOPNOTSUPP but rather -1 with the errno 95 (Operation not supported).
To support older operating system it would be better to check for non zero return codes and revert to posix_fallocate in such case.