1fa9e406ahrens/*
2fa9e406ahrens * CDDL HEADER START
3fa9e406ahrens *
4fa9e406ahrens * The contents of this file are subject to the terms of the
5ea8dc4beschrock * Common Development and Distribution License (the "License").
6ea8dc4beschrock * You may not use this file except in compliance with the License.
7fa9e406ahrens *
8fa9e406ahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fa9e406ahrens * or http://www.opensolaris.org/os/licensing.
10fa9e406ahrens * See the License for the specific language governing permissions
11fa9e406ahrens * and limitations under the License.
12fa9e406ahrens *
13fa9e406ahrens * When distributing Covered Code, include this CDDL HEADER in each
14fa9e406ahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fa9e406ahrens * If applicable, add the following below this CDDL HEADER, with the
16fa9e406ahrens * fields enclosed by brackets "[]" replaced with your own identifying
17fa9e406ahrens * information: Portions Copyright [yyyy] [name of copyright owner]
18fa9e406ahrens *
19fa9e406ahrens * CDDL HEADER END
20fa9e406ahrens */
21fa9e406ahrens/*
22744947dTom Erickson * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
237931524Matthew Ahrens * Copyright (c) 2012, 2018 by Delphix. All rights reserved.
24c3d26abMatthew Ahrens * Copyright (c) 2014 Integros [integros.com]
25eb72182Alek Pinchuk * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
26fa9e406ahrens */
27fa9e406ahrens
28fa9e406ahrens#ifndef	_SYS_FS_ZFS_ZNODE_H
29fa9e406ahrens#define	_SYS_FS_ZFS_ZNODE_H
30fa9e406ahrens
31fa9e406ahrens#ifdef _KERNEL
32fa9e406ahrens#include <sys/isa_defs.h>
33fa9e406ahrens#include <sys/types32.h>
34da6c28aamw#include <sys/attr.h>
35fa9e406ahrens#include <sys/list.h>
36fa9e406ahrens#include <sys/dmu.h>
370a586ceMark Shellenbaum#include <sys/sa.h>
38fa9e406ahrens#include <sys/zfs_vfsops.h>
39f18faf3ek#include <sys/rrwlock.h>
400a586ceMark Shellenbaum#include <sys/zfs_sa.h>
4199d5e17Tim Haley#include <sys/zfs_stat.h>
427931524Matthew Ahrens#include <sys/zfs_rlock.h>
43fa9e406ahrens#endif
44fa9e406ahrens#include <sys/zfs_acl.h>
45fa9e406ahrens#include <sys/zil.h>
46f67950bNasf-Fan#include <sys/zfs_project.h>
47fa9e406ahrens
48fa9e406ahrens#ifdef	__cplusplus
49fa9e406ahrensextern "C" {
50fa9e406ahrens#endif
51fa9e406ahrens
52fa9e406ahrens/*
53da6c28aamw * Additional file level attributes, that are stored
54f67950bNasf-Fan * in the upper half of z_pflags
55da6c28aamw */
56da6c28aamw#define	ZFS_READONLY		0x0000000100000000
57da6c28aamw#define	ZFS_HIDDEN		0x0000000200000000
58da6c28aamw#define	ZFS_SYSTEM		0x0000000400000000
59da6c28aamw#define	ZFS_ARCHIVE		0x0000000800000000
60da6c28aamw#define	ZFS_IMMUTABLE		0x0000001000000000
61da6c28aamw#define	ZFS_NOUNLINK		0x0000002000000000
62da6c28aamw#define	ZFS_APPENDONLY		0x0000004000000000
63da6c28aamw#define	ZFS_NODUMP		0x0000008000000000
64da6c28aamw#define	ZFS_OPAQUE		0x0000010000000000
657931524Matthew Ahrens#define	ZFS_AV_QUARANTINED	0x0000020000000000
667931524Matthew Ahrens#define	ZFS_AV_MODIFIED		0x0000040000000000
677a286c4Dai Ngo#define	ZFS_REPARSE		0x0000080000000000
68fd9ee8bjoyce mcintosh#define	ZFS_OFFLINE		0x0000100000000000
69fd9ee8bjoyce mcintosh#define	ZFS_SPARSE		0x0000200000000000
70f67950bNasf-Fan/*
71f67950bNasf-Fan * PROJINHERIT attribute is used to indicate that the child object under the
72f67950bNasf-Fan * directory which has the PROJINHERIT attribute needs to inherit its parent
73f67950bNasf-Fan * project ID that is used by project quota.
74f67950bNasf-Fan */
75f67950bNasf-Fan#define	ZFS_PROJINHERIT		0x0000400000000000
76f67950bNasf-Fan/*
77f67950bNasf-Fan * PROJID attr is used internally to indicate that the object has project ID.
78f67950bNasf-Fan */
79f67950bNasf-Fan#define	ZFS_PROJID		0x0000800000000000
80da6c28aamw
810a586ceMark Shellenbaum#define	ZFS_ATTR_SET(zp, attr, value, pflags, tx) \
82da6c28aamw{ \
83da6c28aamw	if (value) \
840a586ceMark Shellenbaum		pflags |= attr; \
85da6c28aamw	else \
860a586ceMark Shellenbaum		pflags &= ~attr; \
870a586ceMark Shellenbaum	VERIFY(0 == sa_update(zp->z_sa_hdl, SA_ZPL_FLAGS(zp->z_zfsvfs), \
880a586ceMark Shellenbaum	    &pflags, sizeof (pflags), tx)); \
89da6c28aamw}
90da6c28aamw
91da6c28aamw/*
92fa9e406ahrens * Define special zfs pflags
93fa9e406ahrens */
94da6c28aamw#define	ZFS_XATTR		0x1		/* is an extended attribute */
95da6c28aamw#define	ZFS_INHERIT_ACE		0x2		/* ace has inheritable ACEs */
967931524Matthew Ahrens#define	ZFS_ACL_TRIVIAL		0x4		/* files ACL is trivial */
977931524Matthew Ahrens#define	ZFS_ACL_OBJ_ACE		0x8		/* ACL has CMPLX Object ACE */
98da6c28aamw#define	ZFS_ACL_PROTECTED	0x10		/* ACL protected */
99da6c28aamw#define	ZFS_ACL_DEFAULTED	0x20		/* ACL should be defaulted */
100da6c28aamw#define	ZFS_ACL_AUTO_INHERIT	0x40		/* ACL should be inherited */
101da6c28aamw#define	ZFS_BONUS_SCANSTAMP	0x80		/* Scanstamp in bonus area */
102d47621aTim Haley#define	ZFS_NO_EXECS_DENIED	0x100		/* exec was given to everyone */
103da6c28aamw
1040a586ceMark Shellenbaum#define	SA_ZPL_ATIME(z)		z->z_attr_table[ZPL_ATIME]
1050a586ceMark Shellenbaum#define	SA_ZPL_MTIME(z)		z->z_attr_table[ZPL_MTIME]
1060a586ceMark Shellenbaum#define	SA_ZPL_CTIME(z)		z->z_attr_table[ZPL_CTIME]
1070a586ceMark Shellenbaum#define	SA_ZPL_CRTIME(z)	z->z_attr_table[ZPL_CRTIME]
1080a586ceMark Shellenbaum#define	SA_ZPL_GEN(z)		z->z_attr_table[ZPL_GEN]
1090a586ceMark Shellenbaum#define	SA_ZPL_DACL_ACES(z)	z->z_attr_table[ZPL_DACL_ACES]
1100a586ceMark Shellenbaum#define	SA_ZPL_XATTR(z)		z->z_attr_table[ZPL_XATTR]
1110a586ceMark Shellenbaum#define	SA_ZPL_SYMLINK(z)	z->z_attr_table[ZPL_SYMLINK]
1120a586ceMark Shellenbaum#define	SA_ZPL_RDEV(z)		z->z_attr_table[ZPL_RDEV]
1130a586ceMark Shellenbaum#define	SA_ZPL_SCANSTAMP(z)	z->z_attr_table[ZPL_SCANSTAMP]
1140a586ceMark Shellenbaum#define	SA_ZPL_UID(z)		z->z_attr_table[ZPL_UID]
1150a586ceMark Shellenbaum#define	SA_ZPL_GID(z)		z->z_attr_table[ZPL_GID]
1160a586ceMark Shellenbaum#define	SA_ZPL_PARENT(z)	z->z_attr_table[ZPL_PARENT]
1170a586ceMark Shellenbaum#define	SA_ZPL_LINKS(z)		z->z_attr_table[ZPL_LINKS]
1180a586ceMark Shellenbaum#define	SA_ZPL_MODE(z)		z->z_attr_table[ZPL_MODE]
1190a586ceMark Shellenbaum#define	SA_ZPL_DACL_COUNT(z)	z->z_attr_table[ZPL_DACL_COUNT]
1200a586ceMark Shellenbaum#define	SA_ZPL_FLAGS(z)		z->z_attr_table[ZPL_FLAGS]
1210a586ceMark Shellenbaum#define	SA_ZPL_SIZE(z)		z->z_attr_table[ZPL_SIZE]
1220a586ceMark Shellenbaum#define	SA_ZPL_ZNODE_ACL(z)	z->z_attr_table[ZPL_ZNODE_ACL]
1230a586ceMark Shellenbaum#define	SA_ZPL_PAD(z)		z->z_attr_table[ZPL_PAD]
124f67950bNasf-Fan#define	SA_ZPL_PROJID(z)	z->z_attr_table[ZPL_PROJID]
1250a586ceMark Shellenbaum
126da6c28aamw/*
127da6c28aamw * Is ID ephemeral?
128da6c28aamw */
129da6c28aamw#define	IS_EPHEMERAL(x)		(x > MAXUID)
130da6c28aamw
131da6c28aamw/*
132da6c28aamw * Should we use FUIDs?
133da6c28aamw */
1340a586ceMark Shellenbaum#define	USE_FUIDS(version, os)	(version >= ZPL_VERSION_FUID && \
135da6c28aamw    spa_version(dmu_objset_spa(os)) >= SPA_VERSION_FUID)
1360a586ceMark Shellenbaum#define	USE_SA(version, os) (version >= ZPL_VERSION_SA && \
1370a586ceMark Shellenbaum    spa_version(dmu_objset_spa(os)) >= SPA_VERSION_SA)
138fa9e406ahrens
139fa9e406ahrens#define	MASTER_NODE_OBJ	1
140fa9e406ahrens
141fa9e406ahrens/*
142da6c28aamw * Special attributes for master node.
143f67950bNasf-Fan * "userquota@", "groupquota@" and "projectquota@" are also valid (from
1441484342Matthew Ahrens * zfs_userquota_prop_prefixes[]).
145fa9e406ahrens */
146fa9e406ahrens#define	ZFS_FSID		"FSID"
147893a6d3ahrens#define	ZFS_UNLINKED_SET	"DELETE_QUEUE"
148fa9e406ahrens#define	ZFS_ROOT_OBJ		"ROOT"
149e743726ahrens#define	ZPL_VERSION_STR		"VERSION"
150da6c28aamw#define	ZFS_FUID_TABLES		"FUID"
151743a77eAlan Wright#define	ZFS_SHARES_DIR		"SHARES"
1520a586ceMark Shellenbaum#define	ZFS_SA_ATTRS		"SA_ATTRS"
153fa9e406ahrens
154fa9e406ahrens/*
155e743726ahrens * Convert mode bits (zp_mode) to BSD-style DT_* values for storing in
156e743726ahrens * the directory entries.
157e743726ahrens */
158e743726ahrens#define	IFTODT(mode) (((mode) & S_IFMT) >> 12)
159e743726ahrens
160e743726ahrens/*
161b1b8ab3lling * The directory entry has the type (currently unused on Solaris) in the
162b1b8ab3lling * top 4 bits, and the object number in the low 48 bits.  The "middle"
163b1b8ab3lling * 12 bits are unused.
164b1b8ab3lling */
165b1b8ab3lling#define	ZFS_DIRENT_TYPE(de) BF64_GET(de, 60, 4)
166b1b8ab3lling#define	ZFS_DIRENT_OBJ(de) BF64_GET(de, 0, 48)
167b1b8ab3lling
168b1b8ab3lling/*
169fa9e406ahrens * Directory entry locks control access to directory entries.
170fa9e406ahrens * They are used to protect creates, deletes, and renames.
171fa9e406ahrens * Each directory znode has a mutex and a list of locked names.
172fa9e406ahrens */
173fa9e406ahrens#ifdef _KERNEL
174fa9e406ahrenstypedef struct zfs_dirlock {
175fa9e406ahrens	char		*dl_name;	/* directory entry being locked */
176fa9e406ahrens	uint32_t	dl_sharecnt;	/* 0 if exclusive, > 0 if shared */
177afefc7eSanjeev Bagewadi	uint8_t		dl_namelock;	/* 1 if z_name_lock is NOT held */
178fa9e406ahrens	uint16_t	dl_namesize;	/* set if dl_name was allocated */
179fa9e406ahrens	kcondvar_t	dl_cv;		/* wait for entry to be unlocked */
180fa9e406ahrens	struct znode	*dl_dzp;	/* directory znode */
181fa9e406ahrens	struct zfs_dirlock *dl_next;	/* next in z_dirlocks list */
182fa9e406ahrens} zfs_dirlock_t;
183fa9e406ahrens
184fa9e406ahrenstypedef struct znode {
185fa9e406ahrens	struct zfsvfs	*z_zfsvfs;
186fa9e406ahrens	vnode_t		*z_vnode;
187fa9e406ahrens	uint64_t	z_id;		/* object ID for this znode */
188fa9e406ahrens	kmutex_t	z_lock;		/* znode modification lock */
189104e2edperrin	krwlock_t	z_parent_lock;	/* parent lock for directories */
190af2c482maybee	krwlock_t	z_name_lock;	/* "master" lock for dirent locks */
191fa9e406ahrens	zfs_dirlock_t	*z_dirlocks;	/* directory entry lock list */
1927931524Matthew Ahrens	rangelock_t	z_rangelock;	/* file range locks */
193893a6d3ahrens	uint8_t		z_unlinked;	/* file has been unlinked */
194fa9e406ahrens	uint8_t		z_atime_dirty;	/* atime needs to be synced */
1957f6e3e7perrin	uint8_t		z_zn_prefetch;	/* Prefetch znodes? */
196744947dTom Erickson	uint8_t		z_moved;	/* Has this znode been moved? */
197fa9e406ahrens	uint_t		z_blksz;	/* block size in bytes */
198fa9e406ahrens	uint_t		z_seq;		/* modification sequence number */
199ea8dc4beschrock	uint64_t	z_mapcnt;	/* number of pages mapped to file */
20054811daToomas Soome	uint64_t	z_dnodesize;	/* dnode size */
2010a586ceMark Shellenbaum	uint64_t	z_gen;		/* generation (cached) */
2020a586ceMark Shellenbaum	uint64_t	z_size;		/* file size (cached) */
2030a586ceMark Shellenbaum	uint64_t	z_atime[2];	/* atime (cached) */
2040a586ceMark Shellenbaum	uint64_t	z_links;	/* file links (cached) */
2050a586ceMark Shellenbaum	uint64_t	z_pflags;	/* pflags (cached) */
206f1696b2Mark Shellenbaum	uint64_t	z_uid;		/* uid fuid (cached) */
207f1696b2Mark Shellenbaum	uint64_t	z_gid;		/* gid fuid (cached) */
2080a586ceMark Shellenbaum	mode_t		z_mode;		/* mode (cached) */
20967bd71cperrin	uint32_t	z_sync_cnt;	/* synchronous open count */
210fa9e406ahrens	kmutex_t	z_acl_lock;	/* acl data lock */
211d47621aTim Haley	zfs_acl_t	*z_acl_cached;	/* cached acl */
212f67950bNasf-Fan	uint64_t	z_projid;	/* project ID */
213fa9e406ahrens	list_node_t	z_link_node;	/* all znodes in fs link */
2140a586ceMark Shellenbaum	sa_handle_t	*z_sa_hdl;	/* handle to sa data */
2150a586ceMark Shellenbaum	boolean_t	z_is_sa;	/* are we native sa? */
216fa9e406ahrens} znode_t;
217fa9e406ahrens
218f67950bNasf-Fanstatic inline uint64_t
219f67950bNasf-Fanzfs_inherit_projid(znode_t *dzp)
220f67950bNasf-Fan{
221f67950bNasf-Fan	return ((dzp->z_pflags & ZFS_PROJINHERIT) ? dzp->z_projid :
222f67950bNasf-Fan	    ZFS_DEFAULT_PROJID);
223f67950bNasf-Fan}
224104e2edperrin
225fa9e406ahrens/*
226104e2edperrin * Range locking rules
227104e2edperrin * --------------------
228104e2edperrin * 1. When truncating a file (zfs_create, zfs_setattr, zfs_space) the whole
229104e2edperrin *    file range needs to be locked as RL_WRITER. Only then can the pages be
230104e2edperrin *    freed etc and zp_size reset. zp_size must be set within range lock.
231104e2edperrin * 2. For writes and punching holes (zfs_write & zfs_space) just the range
232104e2edperrin *    being written or freed needs to be locked as RL_WRITER.
233104e2edperrin *    Multiple writes at the end of the file must coordinate zp_size updates
234104e2edperrin *    to ensure data isn't lost. A compare and swap loop is currently used
235104e2edperrin *    to ensure the file size is at least the offset last written.
236104e2edperrin * 3. For reads (zfs_read, zfs_get_data & zfs_putapage) just the range being
237104e2edperrin *    read needs to be locked as RL_READER. A check against zp_size can then
238104e2edperrin *    be made for reading beyond end of file.
239fa9e406ahrens */
240fa9e406ahrens
241fa9e406ahrens/*
242fa9e406ahrens * Convert between znode pointers and vnode pointers
243fa9e406ahrens */
244fa9e406ahrens#define	ZTOV(ZP)	((ZP)->z_vnode)
245fa9e406ahrens#define	VTOZ(VP)	((znode_t *)(VP)->v_data)
246fa9e406ahrens
247f717074Will Andrews/* Called on entry to each ZFS vnode and vfs operation  */
248fa9e406ahrens#define	ZFS_ENTER(zfsvfs) \
249fa9e406ahrens	{ \
250c9030f6Alexander Motin		rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \
25191ebeefahrens		if ((zfsvfs)->z_unmounted) { \
252fa9e406ahrens			ZFS_EXIT(zfsvfs); \
253fa9e406ahrens			return (EIO); \
254fa9e406ahrens		} \
255fa9e406ahrens	}
25691ebeefahrens
257f717074Will Andrews/* Must be called before exiting the vop */
258c9030f6Alexander Motin#define	ZFS_EXIT(zfsvfs) rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG)
259f18faf3ek
260f717074Will Andrews/* Verifies the znode is valid */
2613cb34c6ahrens#define	ZFS_VERIFY_ZP(zp) \
2620a586ceMark Shellenbaum	if ((zp)->z_sa_hdl == NULL) { \
2633cb34c6ahrens		ZFS_EXIT((zp)->z_zfsvfs); \
2643cb34c6ahrens		return (EIO); \
2653cb34c6ahrens	} \
266fa9e406ahrens
267fa9e406ahrens/*
268fa9e406ahrens * Macros for dealing with dmu_buf_hold
269fa9e406ahrens */
2704ccbb6eahrens#define	ZFS_OBJ_HASH(obj_num)	((obj_num) & (ZFS_OBJ_MTX_SZ - 1))
271b5fca8ftomee#define	ZFS_OBJ_MUTEX(zfsvfs, obj_num)	\
272b5fca8ftomee	(&(zfsvfs)->z_hold_mtx[ZFS_OBJ_HASH(obj_num)])
273fa9e406ahrens#define	ZFS_OBJ_HOLD_ENTER(zfsvfs, obj_num) \
274b5fca8ftomee	mutex_enter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num)))
275a66b2b3Tom Erickson#define	ZFS_OBJ_HOLD_TRYENTER(zfsvfs, obj_num) \
276a66b2b3Tom Erickson	mutex_tryenter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num)))
277fa9e406ahrens#define	ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num) \
278b5fca8ftomee	mutex_exit(ZFS_OBJ_MUTEX((zfsvfs), (obj_num)))
279fa9e406ahrens
280f717074Will Andrews/* Encode ZFS stored time values from a struct timespec */
281fa9e406ahrens#define	ZFS_TIME_ENCODE(tp, stmp)		\
282fa9e406ahrens{						\
283b5fca8ftomee	(stmp)[0] = (uint64_t)(tp)->tv_sec;	\
2844ccbb6eahrens	(stmp)[1] = (uint64_t)(tp)->tv_nsec;	\
285fa9e406ahrens}
286fa9e406ahrens
287f717074Will Andrews/* Decode ZFS stored time values to a struct timespec */
288fa9e406ahrens#define	ZFS_TIME_DECODE(tp, stmp)		\
289fa9e406ahrens{						\
2904ccbb6eahrens	(tp)->tv_sec = (time_t)(stmp)[0];		\
2914ccbb6eahrens	(tp)->tv_nsec = (long)(stmp)[1];		\
292fa9e406ahrens}
293fa9e406ahrens
294fa9e406ahrens/*
295fa9e406ahrens * Timestamp defines
296fa9e406ahrens */
297fa9e406ahrens#define	ACCESSED		(AT_ATIME)
298fa9e406ahrens#define	STATE_CHANGED		(AT_CTIME)
299fa9e406ahrens#define	CONTENT_MODIFIED	(AT_MTIME | AT_CTIME)
300fa9e406ahrens
301fa9e406ahrens#define	ZFS_ACCESSTIME_STAMP(zfsvfs, zp) \
302fa9e406ahrens	if ((zfsvfs)->z_atime && !((zfsvfs)->z_vfs->vfs_flag & VFS_RDONLY)) \
3030a586ceMark Shellenbaum		zfs_tstamp_update_setup(zp, ACCESSED, NULL, NULL, B_FALSE);
304fa9e406ahrens
305088f389ahrensextern int	zfs_init_fs(zfsvfs_t *, znode_t **);
306fa9e406ahrensextern void	zfs_set_dataprop(objset_t *);
307de8267etimhextern void	zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *,
308da6c28aamw    dmu_tx_t *tx);
3090a586ceMark Shellenbaumextern void	zfs_tstamp_update_setup(znode_t *, uint_t, uint64_t [2],
3100a586ceMark Shellenbaum    uint64_t [2], boolean_t);
311104e2edperrinextern void	zfs_grow_blocksize(znode_t *, uint64_t, dmu_tx_t *);
3125730cc9maybeeextern int	zfs_freesp(znode_t *, uint64_t, uint64_t, int, boolean_t);
313fa9e406ahrensextern void	zfs_znode_init(void);
314fa9e406ahrensextern void	zfs_znode_fini(void);
315fa9e406ahrensextern int	zfs_zget(zfsvfs_t *, uint64_t, znode_t **);
316f18faf3ekextern int	zfs_rezget(znode_t *);
317fa9e406ahrensextern void	zfs_zinactive(znode_t *);
318fa9e406ahrensextern void	zfs_znode_delete(znode_t *, dmu_tx_t *);
319fa9e406ahrensextern void	zfs_znode_free(znode_t *);
320fa9e406ahrensextern void	zfs_remove_op_tables();
321fa9e406ahrensextern int	zfs_create_op_tables();
322fa9e406ahrensextern int	zfs_sync(vfs_t *vfsp, short flag, cred_t *cr);
32372fc53bmarksextern dev_t	zfs_cmpldev(uint64_t);
324de8267etimhextern int	zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value);
325da6c28aamwextern int	zfs_get_stats(objset_t *os, nvlist_t *nv);
326eb72182Alek Pinchukextern boolean_t zfs_get_vfs_flag_unmounted(objset_t *os);
327874395dmaybeeextern void	zfs_znode_dmu_fini(znode_t *);
328da6c28aamw
329da6c28aamwextern void zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
330da6c28aamw    znode_t *dzp, znode_t *zp, char *name, vsecattr_t *, zfs_fuid_info_t *,
331da6c28aamw    vattr_t *vap);
3324ccbb6eahrensextern int zfs_log_create_txtype(zil_create_t, vsecattr_t *vsecp,
333da6c28aamw    vattr_t *vap);
334da6c28aamwextern void zfs_log_remove(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
335d8849d7Chunwei Chen    znode_t *dzp, char *name, uint64_t foid, boolean_t unlinked);
3365002558Neil Perrin#define	ZFS_NO_OBJECT	0	/* no object id */
337da6c28aamwextern void zfs_log_link(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
338fa9e406ahrens    znode_t *dzp, znode_t *zp, char *name);
339da6c28aamwextern void zfs_log_symlink(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
340fa9e406ahrens    znode_t *dzp, znode_t *zp, char *name, char *link);
341da6c28aamwextern void zfs_log_rename(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
34291de656Neil Perrin    znode_t *sdzp, char *sname, znode_t *tdzp, char *dname, znode_t *szp);
343b19a79eperrinextern void zfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype,
344feb08c6billm    znode_t *zp, offset_t off, ssize_t len, int ioflag);
345b19a79eperrinextern void zfs_log_truncate(zilog_t *zilog, dmu_tx_t *tx, int txtype,
346fa9e406ahrens    znode_t *zp, uint64_t off, uint64_t len);
347b19a79eperrinextern void zfs_log_setattr(zilog_t *zilog, dmu_tx_t *tx, int txtype,
348da6c28aamw    znode_t *zp, vattr_t *vap, uint_t mask_applied, zfs_fuid_info_t *fuidp);
349da6c28aamwextern void zfs_log_acl(zilog_t *zilog, dmu_tx_t *tx, znode_t *zp,
350da6c28aamw    vsecattr_t *vsecp, zfs_fuid_info_t *fuidp);
3510a586ceMark Shellenbaumextern void zfs_xvattr_set(znode_t *zp, xvattr_t *xvap, dmu_tx_t *tx);
352da6c28aamwextern void zfs_upgrade(zfsvfs_t *zfsvfs, dmu_tx_t *tx);
3531484342Matthew Ahrensextern int zfs_create_share_dir(zfsvfs_t *zfsvfs, dmu_tx_t *tx);
354fa9e406ahrens
3550fab61bJonathan W Adamsextern caddr_t zfs_map_page(page_t *, enum seg_rw);
3560fab61bJonathan W Adamsextern void zfs_unmap_page(page_t *, caddr_t);
3570fab61bJonathan W Adams
358fa9e406ahrensextern zil_get_data_t zfs_get_data;
359fa9e406ahrensextern zil_replay_func_t *zfs_replay_vector[TX_MAX_TYPE];
360fa9e406ahrensextern int zfsfstype;
361fa9e406ahrens
362fa9e406ahrens#endif /* _KERNEL */
363fa9e406ahrens
36455434c7ekextern int zfs_obj_to_path(objset_t *osp, uint64_t obj, char *buf, int len);
36555434c7ek
366fa9e406ahrens#ifdef	__cplusplus
367fa9e406ahrens}
368fa9e406ahrens#endif
369fa9e406ahrens
370fa9e406ahrens#endif	/* _SYS_FS_ZFS_ZNODE_H */
371