2020-05-22 11:20:23 +00:00
|
|
|
/*-
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
|
|
|
*
|
|
|
|
* Copyright (c) 2020 Andriy Gapon <avg@FreeBSD.org>
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
#include <sys/types.h>
|
2020-05-22 11:20:23 +00:00
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Prevent some headers from getting included and fake some types
|
|
|
|
* in order to allow this file to compile without bringing in
|
|
|
|
* too many kernel build dependencies.
|
|
|
|
*/
|
|
|
|
#define _OPENSOLARIS_SYS_PATHNAME_H_
|
|
|
|
#define _OPENSOLARIS_SYS_POLICY_H_
|
|
|
|
#define _VNODE_PAGER_
|
|
|
|
|
Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.
I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.
Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.
Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.
Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
|
|
|
|
|
|
|
enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD,
|
|
|
|
VMARKER };
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Vnode attributes. A field value of VNOVAL represents a field whose value
|
|
|
|
* is unavailable (getattr) or which is not to be changed (setattr).
|
|
|
|
*/
|
|
|
|
struct vattr {
|
|
|
|
enum vtype va_type; /* vnode type (for create) */
|
|
|
|
u_short va_mode; /* files access mode and type */
|
|
|
|
u_short va_padding0;
|
|
|
|
uid_t va_uid; /* owner user id */
|
|
|
|
gid_t va_gid; /* owner group id */
|
|
|
|
nlink_t va_nlink; /* number of references to file */
|
|
|
|
dev_t va_fsid; /* filesystem id */
|
|
|
|
ino_t va_fileid; /* file id */
|
|
|
|
u_quad_t va_size; /* file size in bytes */
|
|
|
|
long va_blocksize; /* blocksize preferred for i/o */
|
|
|
|
struct timespec va_atime; /* time of last access */
|
|
|
|
struct timespec va_mtime; /* time of last modification */
|
|
|
|
struct timespec va_ctime; /* time file changed */
|
|
|
|
struct timespec va_birthtime; /* time file created */
|
|
|
|
u_long va_gen; /* generation number of file */
|
|
|
|
u_long va_flags; /* flags defined for file */
|
|
|
|
dev_t va_rdev; /* device the special file represents */
|
|
|
|
u_quad_t va_bytes; /* bytes of disk space held by file */
|
|
|
|
u_quad_t va_filerev; /* file modification number */
|
|
|
|
u_int va_vaflags; /* operations flags, see below */
|
|
|
|
long va_spare; /* remain quad aligned */
|
|
|
|
};
|
|
|
|
|
2021-02-18 13:43:58 +00:00
|
|
|
#define _WANT_MOUNT
|
2020-05-22 11:20:23 +00:00
|
|
|
#include <sys/zfs_context.h>
|
|
|
|
#include <sys/zfs_znode.h>
|
|
|
|
|
|
|
|
size_t sizeof_znode_t = sizeof(znode_t);
|
|
|
|
size_t offsetof_z_id = offsetof(znode_t, z_id);
|
|
|
|
size_t offsetof_z_size = offsetof(znode_t, z_size);
|
|
|
|
size_t offsetof_z_mode = offsetof(znode_t, z_mode);
|
2020-05-24 14:54:21 +00:00
|
|
|
|
|
|
|
/* Keep pcpu.h satisfied. */
|
|
|
|
uintptr_t *__start_set_pcpu;
|
|
|
|
uintptr_t *__stop_set_pcpu;
|