All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/11] configure: Disable CONFIG_POSIX_FALLOCATE on NetBSD even if posix_fallocate(3) compiles
@ 2017-05-01 18:48 kusumi.tomohiro
  2017-05-01 18:48 ` [PATCH 02/11] configure: Add compile_exec_prog() to compile and execute the binary kusumi.tomohiro
                   ` (11 more replies)
  0 siblings, 12 replies; 18+ messages in thread
From: kusumi.tomohiro @ 2017-05-01 18:48 UTC (permalink / raw)
  To: axboe, fio; +Cc: Tomohiro Kusumi

From: Tomohiro Kusumi <tkusumi@tuxera.com>

fio on NetBSD may have CONFIG_POSIX_FALLOCATE configuration enabled
since posix_fallocate(3) compiles (at least on recent versions),
but this is actually not supported on UFS as mentioned in below wiki
and fio result.

https://wiki.netbsd.org/projects/project/ffs-fallocate/
> This functionality is not currently implemented for FFS;

compile_prog() during ./configure fails to catch this as it doesn't
run the test code after compilation (and it needs to use a valid fd
in order to do runtime test).

This commit simply disables CONFIG_POSIX_FALLOCATE on NetBSD regardless
of compilation result on ./configure. It doesn't check the fs type,
but it should be enough provided that UFS is the fs used by majority
of users and there's also no real alternative for disk fs.

-- yes for posix_fallocate(3), but EOPNOTSUPP on runtime
 # uname
 NetBSD
 # gmake clean >/dev/null 2>&1
 # ./configure | grep "POSIX fallocate"
 POSIX fallocate               yes
 # grep -A1 posix_fallocate ./config.log
 Compiling test case posix_fallocate
 gcc -D_GNU_SOURCE -include config-host.h -o /tmp/fio-conf--23834-.exe /tmp/fio-conf--23834-.c -lrt -lz
 # gmake -j8 >/dev/null 2>&1
 # ./fio --name=xxxxx --ioengine=sync --rw=read --bs=2k --size=1m --unlink=1 | grep posix_fallocate
 fio: posix_fallocate fails: Operation not supported

-- try posix_fallocate(3) test in ./configure with a valid fd
 # uname
 NetBSD
 # cat ./test2.c
 #include <stdio.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 int main(int argc, char **argv)
 {
   int r, fd;
   fd = open(argv[1], O_WRONLY | O_CREAT, 0644);
   if (fd < 0)
           return errno;
   r = posix_fallocate(fd, 0, 1024);
   close(fd);
   return r;
 }
 # gcc -Wall -g ./test2.c
 # ./a.out xxx; echo $?
 45

-- try above on Linux
 # uname
 Linux
 # gcc -Wall -g ./test2.c
 # ./a.out xxx; echo $?
 0

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
---
 configure   | 5 +++++
 filesetup.c | 6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index bcb898a..c3e06cd 100755
--- a/configure
+++ b/configure
@@ -781,6 +781,11 @@ EOF
 if compile_prog "" "" "posix_fallocate"; then
     posix_fallocate="yes"
 fi
+# Ignore the result for NetBSD since it's not supported at least on UFS,
+# which is what people basically use on NetBSD.
+if test "$targetos" = "NetBSD"; then
+    posix_fallocate="no"
+fi
 echo "POSIX fallocate               $posix_fallocate"
 
 ##########################################
diff --git a/filesetup.c b/filesetup.c
index 612e794..23fd537 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -109,7 +109,11 @@ static int extend_file(struct thread_data *td, struct fio_file *f)
 			dprint(FD_FILE, "posix_fallocate file %s size %llu\n",
 				 f->file_name,
 				 (unsigned long long) f->real_file_size);
-
+			/*
+			 * Note that some OS/filesystem, for e.g. UFS on NetBSD
+			 * doesn't support posix_fallocate(3) even if it compiles.
+			 * Try to avoid it on ./configure if it's a known issue.
+			 */
 			r = posix_fallocate(f->fd, 0, f->real_file_size);
 			if (r > 0) {
 				log_err("fio: posix_fallocate fails: %s\n",
-- 
2.9.3



^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2017-05-02  5:58 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-01 18:48 [PATCH 01/11] configure: Disable CONFIG_POSIX_FALLOCATE on NetBSD even if posix_fallocate(3) compiles kusumi.tomohiro
2017-05-01 18:48 ` [PATCH 02/11] configure: Add compile_exec_prog() to compile and execute the binary kusumi.tomohiro
2017-05-01 18:48 ` [PATCH 03/11] configure: Use single square brackets (POSIX) kusumi.tomohiro
2017-05-02  5:36   ` Sitsofe Wheeler
2017-05-02  5:58     ` Tomohiro Kusumi
2017-05-01 18:48 ` [PATCH 04/11] configure: Use compile_exec_prog() for s390_z196_facilities kusumi.tomohiro
2017-05-01 18:48 ` [PATCH 05/11] configure: output_sym CONFIG_GFIO kusumi.tomohiro
2017-05-01 18:48 ` [PATCH 06/11] configure: Add missing <string.h> to avoid bogus warning kusumi.tomohiro
2017-05-01 18:48 ` [PATCH 07/11] configure: Add void* cast " kusumi.tomohiro
2017-05-01 18:48 ` [PATCH 08/11] configure: Check gfio test result via return value (not printf) kusumi.tomohiro
2017-05-01 18:48 ` [PATCH 09/11] configure: Add missing ########## kusumi.tomohiro
2017-05-01 18:48 ` [PATCH 10/11] configure: Add missing $val != "yes" test to override compile_prog() result kusumi.tomohiro
2017-05-01 18:48 ` [PATCH 11/11] configure: Add print_config() for "<config>... <yes|no>" outputs kusumi.tomohiro
2017-05-01 20:44 ` [PATCH 01/11] configure: Disable CONFIG_POSIX_FALLOCATE on NetBSD even if posix_fallocate(3) compiles Jens Axboe
2017-05-01 20:54   ` Tomohiro Kusumi
2017-05-01 20:57     ` Jens Axboe
2017-05-01 21:10       ` Tomohiro Kusumi
2017-05-01 20:48 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.