Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark Linux fallocate extensions as specific to Linux #9633

Merged
merged 1 commit into from
Nov 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/libzpool/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,11 @@ zfs_file_fsync(zfs_file_t *fp, int flags)
int
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));
#else
return (EOPNOTSUPP);
#endif
}

/*
Expand Down
8 changes: 5 additions & 3 deletions module/os/linux/zfs/vdev_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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__
behlendorf marked this conversation as resolved.
Show resolved Hide resolved
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);
Expand Down