summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorMatthew Macy <[email protected]>2019-11-30 15:40:22 -0800
committerBrian Behlendorf <[email protected]>2019-11-30 15:40:22 -0800
commitf348c78f97527e7a49859fa7e7ee29dd6b37dfb2 (patch)
tree13326692a8e8a94e37aad9fe88245563585beca3 /module
parent77323bcf5361ded9ca6b8eb1fee77a8dfd34654c (diff)
Mark Linux fallocate extensions as specific to Linux
fallocate(2) is a Linux-specific system call which in unavailable on other platforms. Reviewed-by: Jorgen Lundman <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Matt Macy <[email protected]> Closes #9633
Diffstat (limited to 'module')
-rw-r--r--module/os/linux/zfs/vdev_file.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/module/os/linux/zfs/vdev_file.c b/module/os/linux/zfs/vdev_file.c
index fba5cdced..592ba2b4a 100644
--- a/module/os/linux/zfs/vdev_file.c
+++ b/module/os/linux/zfs/vdev_file.c
@@ -36,9 +36,9 @@
#include <sys/fcntl.h>
#include <sys/vnode.h>
#include <sys/zfs_file.h>
-
+#ifdef _KERNEL
#include <linux/falloc.h>
-
+#endif
/*
* Virtual device vector for files.
*/
@@ -268,10 +268,12 @@ vdev_file_io_start(zio_t *zio)
zio_execute(zio);
return;
} else if (zio->io_type == ZIO_TYPE_TRIM) {
- int mode;
+ int mode = 0;
ASSERT3U(zio->io_size, !=, 0);
+#ifdef __linux__
mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;
+#endif
zio->io_error = zfs_file_fallocate(vf->vf_file,
mode, zio->io_offset, zio->io_size);
zio_execute(zio);