mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-04-06 17:49:11 +03:00
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 <lundman@lundman.net> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Matt Macy <mmacy@FreeBSD.org> Closes #9633
This commit is contained in:
parent
77323bcf53
commit
f348c78f97
@ -1346,7 +1346,11 @@ zfs_file_fsync(zfs_file_t *fp, int flags)
|
|||||||
int
|
int
|
||||||
zfs_file_fallocate(zfs_file_t *fp, int mode, loff_t offset, loff_t len)
|
zfs_file_fallocate(zfs_file_t *fp, int mode, loff_t offset, loff_t len)
|
||||||
{
|
{
|
||||||
|
#ifdef __linux__
|
||||||
return (fallocate(fp->f_fd, mode, offset, len));
|
return (fallocate(fp->f_fd, mode, offset, len));
|
||||||
|
#else
|
||||||
|
return (EOPNOTSUPP);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -36,9 +36,9 @@
|
|||||||
#include <sys/fcntl.h>
|
#include <sys/fcntl.h>
|
||||||
#include <sys/vnode.h>
|
#include <sys/vnode.h>
|
||||||
#include <sys/zfs_file.h>
|
#include <sys/zfs_file.h>
|
||||||
|
#ifdef _KERNEL
|
||||||
#include <linux/falloc.h>
|
#include <linux/falloc.h>
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* Virtual device vector for files.
|
* Virtual device vector for files.
|
||||||
*/
|
*/
|
||||||
@ -268,10 +268,12 @@ vdev_file_io_start(zio_t *zio)
|
|||||||
zio_execute(zio);
|
zio_execute(zio);
|
||||||
return;
|
return;
|
||||||
} else if (zio->io_type == ZIO_TYPE_TRIM) {
|
} else if (zio->io_type == ZIO_TYPE_TRIM) {
|
||||||
int mode;
|
int mode = 0;
|
||||||
|
|
||||||
ASSERT3U(zio->io_size, !=, 0);
|
ASSERT3U(zio->io_size, !=, 0);
|
||||||
|
#ifdef __linux__
|
||||||
mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;
|
mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;
|
||||||
|
#endif
|
||||||
zio->io_error = zfs_file_fallocate(vf->vf_file,
|
zio->io_error = zfs_file_fallocate(vf->vf_file,
|
||||||
mode, zio->io_offset, zio->io_size);
|
mode, zio->io_offset, zio->io_size);
|
||||||
zio_execute(zio);
|
zio_execute(zio);
|
||||||
|
Loading…
Reference in New Issue
Block a user