aboutsummaryrefslogtreecommitdiffstats
path: root/include/sys
diff options
context:
space:
mode:
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/Makefile.am4
-rw-r--r--include/sys/Makefile.in17
-rw-r--r--include/sys/dmu.h12
-rw-r--r--include/sys/dsl_pool.h4
-rw-r--r--include/sys/fm/Makefile.in6
-rw-r--r--include/sys/fm/fs/Makefile.in6
-rw-r--r--include/sys/fs/Makefile.in6
-rw-r--r--include/sys/uio_impl.h49
-rw-r--r--include/sys/vdev_disk.h3
-rw-r--r--include/sys/zfs_acl.h6
-rw-r--r--include/sys/zfs_context.h5
-rw-r--r--include/sys/zfs_ctldir.h73
-rw-r--r--include/sys/zfs_dir.h8
-rw-r--r--include/sys/zfs_fuid.h20
-rw-r--r--include/sys/zfs_vfsops.h71
-rw-r--r--include/sys/zfs_vnops.h78
-rw-r--r--include/sys/zfs_znode.h81
-rw-r--r--include/sys/zpl.h65
18 files changed, 356 insertions, 158 deletions
diff --git a/include/sys/Makefile.am b/include/sys/Makefile.am
index 59e137104..bde71b75e 100644
--- a/include/sys/Makefile.am
+++ b/include/sys/Makefile.am
@@ -42,6 +42,7 @@ COMMON_H = \
$(top_srcdir)/include/sys/u8_textprep.h \
$(top_srcdir)/include/sys/uberblock.h \
$(top_srcdir)/include/sys/uberblock_impl.h \
+ $(top_srcdir)/include/sys/uio_impl.h \
$(top_srcdir)/include/sys/unique.h \
$(top_srcdir)/include/sys/uuid.h \
$(top_srcdir)/include/sys/vdev_disk.h \
@@ -53,7 +54,6 @@ COMMON_H = \
$(top_srcdir)/include/sys/zap_leaf.h \
$(top_srcdir)/include/sys/zfs_acl.h \
$(top_srcdir)/include/sys/zfs_context.h \
- $(top_srcdir)/include/sys/zfs_ctldir.h \
$(top_srcdir)/include/sys/zfs_debug.h \
$(top_srcdir)/include/sys/zfs_dir.h \
$(top_srcdir)/include/sys/zfs_fuid.h \
@@ -62,6 +62,7 @@ COMMON_H = \
$(top_srcdir)/include/sys/zfs_stat.h \
$(top_srcdir)/include/sys/zfs_vfsops.h \
$(top_srcdir)/include/sys/zfs_znode.h \
+ $(top_srcdir)/include/sys/zfs_vnops.h \
$(top_srcdir)/include/sys/zil.h \
$(top_srcdir)/include/sys/zil_impl.h \
$(top_srcdir)/include/sys/zio_checksum.h \
@@ -74,6 +75,7 @@ KERNEL_H = \
$(top_srcdir)/include/sys/blkdev.h \
$(top_srcdir)/include/sys/zfs_ioctl.h \
$(top_srcdir)/include/sys/zfs_onexit.h \
+ ${top_srcdir}/include/sys/zpl.h \
$(top_srcdir)/include/sys/zvol.h
USER_H =
diff --git a/include/sys/Makefile.in b/include/sys/Makefile.in
index 8964aae41..37339e255 100644
--- a/include/sys/Makefile.in
+++ b/include/sys/Makefile.in
@@ -52,21 +52,24 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-bytes.m4 \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
+ $(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
+ $(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
+ $(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-ioctl.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
- $(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -132,6 +135,7 @@ am__kernel_HEADERS_DIST = $(top_srcdir)/include/sys/arc.h \
$(top_srcdir)/include/sys/u8_textprep.h \
$(top_srcdir)/include/sys/uberblock.h \
$(top_srcdir)/include/sys/uberblock_impl.h \
+ $(top_srcdir)/include/sys/uio_impl.h \
$(top_srcdir)/include/sys/unique.h \
$(top_srcdir)/include/sys/uuid.h \
$(top_srcdir)/include/sys/vdev_disk.h \
@@ -143,7 +147,6 @@ am__kernel_HEADERS_DIST = $(top_srcdir)/include/sys/arc.h \
$(top_srcdir)/include/sys/zap_leaf.h \
$(top_srcdir)/include/sys/zfs_acl.h \
$(top_srcdir)/include/sys/zfs_context.h \
- $(top_srcdir)/include/sys/zfs_ctldir.h \
$(top_srcdir)/include/sys/zfs_debug.h \
$(top_srcdir)/include/sys/zfs_dir.h \
$(top_srcdir)/include/sys/zfs_fuid.h \
@@ -152,6 +155,7 @@ am__kernel_HEADERS_DIST = $(top_srcdir)/include/sys/arc.h \
$(top_srcdir)/include/sys/zfs_stat.h \
$(top_srcdir)/include/sys/zfs_vfsops.h \
$(top_srcdir)/include/sys/zfs_znode.h \
+ $(top_srcdir)/include/sys/zfs_vnops.h \
$(top_srcdir)/include/sys/zil.h \
$(top_srcdir)/include/sys/zil_impl.h \
$(top_srcdir)/include/sys/zio_checksum.h \
@@ -162,6 +166,7 @@ am__kernel_HEADERS_DIST = $(top_srcdir)/include/sys/arc.h \
$(top_srcdir)/include/sys/blkdev.h \
$(top_srcdir)/include/sys/zfs_ioctl.h \
$(top_srcdir)/include/sys/zfs_onexit.h \
+ ${top_srcdir}/include/sys/zpl.h \
$(top_srcdir)/include/sys/zvol.h
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@@ -226,6 +231,7 @@ am__libzfs_HEADERS_DIST = $(top_srcdir)/include/sys/arc.h \
$(top_srcdir)/include/sys/u8_textprep.h \
$(top_srcdir)/include/sys/uberblock.h \
$(top_srcdir)/include/sys/uberblock_impl.h \
+ $(top_srcdir)/include/sys/uio_impl.h \
$(top_srcdir)/include/sys/unique.h \
$(top_srcdir)/include/sys/uuid.h \
$(top_srcdir)/include/sys/vdev_disk.h \
@@ -237,7 +243,6 @@ am__libzfs_HEADERS_DIST = $(top_srcdir)/include/sys/arc.h \
$(top_srcdir)/include/sys/zap_leaf.h \
$(top_srcdir)/include/sys/zfs_acl.h \
$(top_srcdir)/include/sys/zfs_context.h \
- $(top_srcdir)/include/sys/zfs_ctldir.h \
$(top_srcdir)/include/sys/zfs_debug.h \
$(top_srcdir)/include/sys/zfs_dir.h \
$(top_srcdir)/include/sys/zfs_fuid.h \
@@ -246,6 +251,7 @@ am__libzfs_HEADERS_DIST = $(top_srcdir)/include/sys/arc.h \
$(top_srcdir)/include/sys/zfs_stat.h \
$(top_srcdir)/include/sys/zfs_vfsops.h \
$(top_srcdir)/include/sys/zfs_znode.h \
+ $(top_srcdir)/include/sys/zfs_vnops.h \
$(top_srcdir)/include/sys/zil.h \
$(top_srcdir)/include/sys/zil_impl.h \
$(top_srcdir)/include/sys/zio_checksum.h \
@@ -343,6 +349,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
@@ -495,6 +502,7 @@ COMMON_H = \
$(top_srcdir)/include/sys/u8_textprep.h \
$(top_srcdir)/include/sys/uberblock.h \
$(top_srcdir)/include/sys/uberblock_impl.h \
+ $(top_srcdir)/include/sys/uio_impl.h \
$(top_srcdir)/include/sys/unique.h \
$(top_srcdir)/include/sys/uuid.h \
$(top_srcdir)/include/sys/vdev_disk.h \
@@ -506,7 +514,6 @@ COMMON_H = \
$(top_srcdir)/include/sys/zap_leaf.h \
$(top_srcdir)/include/sys/zfs_acl.h \
$(top_srcdir)/include/sys/zfs_context.h \
- $(top_srcdir)/include/sys/zfs_ctldir.h \
$(top_srcdir)/include/sys/zfs_debug.h \
$(top_srcdir)/include/sys/zfs_dir.h \
$(top_srcdir)/include/sys/zfs_fuid.h \
@@ -515,6 +522,7 @@ COMMON_H = \
$(top_srcdir)/include/sys/zfs_stat.h \
$(top_srcdir)/include/sys/zfs_vfsops.h \
$(top_srcdir)/include/sys/zfs_znode.h \
+ $(top_srcdir)/include/sys/zfs_vnops.h \
$(top_srcdir)/include/sys/zil.h \
$(top_srcdir)/include/sys/zil_impl.h \
$(top_srcdir)/include/sys/zio_checksum.h \
@@ -527,6 +535,7 @@ KERNEL_H = \
$(top_srcdir)/include/sys/blkdev.h \
$(top_srcdir)/include/sys/zfs_ioctl.h \
$(top_srcdir)/include/sys/zfs_onexit.h \
+ ${top_srcdir}/include/sys/zpl.h \
$(top_srcdir)/include/sys/zvol.h
USER_H =
diff --git a/include/sys/dmu.h b/include/sys/dmu.h
index 575cb2d10..7040b6740 100644
--- a/include/sys/dmu.h
+++ b/include/sys/dmu.h
@@ -515,11 +515,13 @@ void dmu_prealloc(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
dmu_tx_t *tx);
#ifdef _KERNEL
int dmu_read_req(objset_t *os, uint64_t object, struct request *req);
-int dmu_write_req(objset_t *os, uint64_t object, struct request *req, dmu_tx_t *tx);
-#endif
-#ifdef HAVE_ZPL
-int dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset,
- uint64_t size, struct page *pp, dmu_tx_t *tx);
+int dmu_write_req(objset_t *os, uint64_t object, struct request *req,
+ dmu_tx_t *tx);
+int dmu_read_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size);
+int dmu_write_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size,
+ dmu_tx_t *tx);
+int dmu_write_uio_dbuf(dmu_buf_t *zdb, struct uio *uio, uint64_t size,
+ dmu_tx_t *tx);
#endif
struct arc_buf *dmu_request_arcbuf(dmu_buf_t *handle, int size);
void dmu_return_arcbuf(struct arc_buf *buf);
diff --git a/include/sys/dsl_pool.h b/include/sys/dsl_pool.h
index 7d25bd7c0..99a131eec 100644
--- a/include/sys/dsl_pool.h
+++ b/include/sys/dsl_pool.h
@@ -75,7 +75,7 @@ typedef struct dsl_pool {
struct dsl_dir *dp_free_dir;
struct dsl_dataset *dp_origin_snap;
uint64_t dp_root_dir_obj;
- struct taskq *dp_vnrele_taskq;
+ struct taskq *dp_iput_taskq;
/* No lock needed - sync context only */
blkptr_t dp_meta_rootbp;
@@ -135,7 +135,7 @@ void dsl_pool_create_origin(dsl_pool_t *dp, dmu_tx_t *tx);
void dsl_pool_upgrade_clones(dsl_pool_t *dp, dmu_tx_t *tx);
void dsl_pool_upgrade_dir_clones(dsl_pool_t *dp, dmu_tx_t *tx);
-taskq_t *dsl_pool_vnrele_taskq(dsl_pool_t *dp);
+taskq_t *dsl_pool_iput_taskq(dsl_pool_t *dp);
extern int dsl_pool_user_hold(dsl_pool_t *dp, uint64_t dsobj,
const char *tag, uint64_t *now, dmu_tx_t *tx);
diff --git a/include/sys/fm/Makefile.in b/include/sys/fm/Makefile.in
index 5e1f4b883..d05018dd1 100644
--- a/include/sys/fm/Makefile.in
+++ b/include/sys/fm/Makefile.in
@@ -52,21 +52,24 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-bytes.m4 \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
+ $(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
+ $(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
+ $(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-ioctl.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
- $(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -207,6 +210,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/include/sys/fm/fs/Makefile.in b/include/sys/fm/fs/Makefile.in
index ed828ebdd..e2ad9533f 100644
--- a/include/sys/fm/fs/Makefile.in
+++ b/include/sys/fm/fs/Makefile.in
@@ -52,21 +52,24 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-bytes.m4 \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
+ $(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
+ $(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
+ $(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-ioctl.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
- $(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -167,6 +170,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/include/sys/fs/Makefile.in b/include/sys/fs/Makefile.in
index 3103ffa67..ce196fb89 100644
--- a/include/sys/fs/Makefile.in
+++ b/include/sys/fs/Makefile.in
@@ -52,21 +52,24 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-bytes.m4 \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
+ $(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
+ $(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
+ $(top_srcdir)/config/kernel-xattr-handler.m4 \
$(top_srcdir)/config/kernel.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-ioctl.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
- $(top_srcdir)/config/user-libshare.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
+ $(top_srcdir)/config/user-selinux.m4 \
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
$(top_srcdir)/config/zfs-build.m4 \
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
@@ -167,6 +170,7 @@ LDFLAGS = @LDFLAGS@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSELINUX = @LIBSELINUX@
LIBTOOL = @LIBTOOL@
LIBUUID = @LIBUUID@
LINUX = @LINUX@
diff --git a/include/sys/uio_impl.h b/include/sys/uio_impl.h
new file mode 100644
index 000000000..37e283da0
--- /dev/null
+++ b/include/sys/uio_impl.h
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
+/* All Rights Reserved */
+
+/*
+ * University Copyright- Copyright (c) 1982, 1986, 1988
+ * The Regents of the University of California
+ * All Rights Reserved
+ *
+ * University Acknowledgment- Portions of this document are derived from
+ * software developed by the University of California, Berkeley, and its
+ * contributors.
+ */
+
+#ifndef _SYS_UIO_IMPL_H
+#define _SYS_UIO_IMPL_H
+
+#include <sys/uio.h>
+
+extern int uiomove(void *, size_t, enum uio_rw, uio_t *);
+extern void uio_prefaultpages(ssize_t, uio_t *);
+extern int uiocopy(void *, size_t, enum uio_rw, uio_t *, size_t *);
+extern void uioskip(uio_t *, size_t);
+
+#endif /* _SYS_UIO_IMPL_H */
diff --git a/include/sys/vdev_disk.h b/include/sys/vdev_disk.h
index 021e66d1a..03e7048ac 100644
--- a/include/sys/vdev_disk.h
+++ b/include/sys/vdev_disk.h
@@ -81,6 +81,9 @@ extern int vdev_disk_read_rootlabel(char *, char *, nvlist_t **);
# define vdev_bdev_block_size(bdev) bdev_hardsect_size(bdev)
#endif
+/* Default Linux IO Scheduler */
+#define VDEV_SCHEDULER "noop"
+
#endif /* _KERNEL */
#ifdef __cplusplus
diff --git a/include/sys/zfs_acl.h b/include/sys/zfs_acl.h
index c1a0aeebd..6f7cef2ad 100644
--- a/include/sys/zfs_acl.h
+++ b/include/sys/zfs_acl.h
@@ -200,13 +200,13 @@ typedef struct zfs_acl_ids {
#define ZFS_ACL_PASSTHROUGH_X 5
struct znode;
-struct zfsvfs;
+struct zfs_sb;
#ifdef _KERNEL
int zfs_acl_ids_create(struct znode *, int, vattr_t *,
cred_t *, vsecattr_t *, zfs_acl_ids_t *);
void zfs_acl_ids_free(zfs_acl_ids_t *);
-boolean_t zfs_acl_ids_overquota(struct zfsvfs *, zfs_acl_ids_t *);
+boolean_t zfs_acl_ids_overquota(struct zfs_sb *, zfs_acl_ids_t *);
int zfs_getacl(struct znode *, vsecattr_t *, boolean_t, cred_t *);
int zfs_setacl(struct znode *, vsecattr_t *, boolean_t, cred_t *);
void zfs_acl_rele(void *);
@@ -223,7 +223,7 @@ int zfs_zaccess_delete(struct znode *, struct znode *, cred_t *);
int zfs_zaccess_rename(struct znode *, struct znode *,
struct znode *, struct znode *, cred_t *cr);
void zfs_acl_free(zfs_acl_t *);
-int zfs_vsec_2_aclp(struct zfsvfs *, vtype_t, vsecattr_t *, cred_t *,
+int zfs_vsec_2_aclp(struct zfs_sb *, umode_t, vsecattr_t *, cred_t *,
struct zfs_fuid_info **, zfs_acl_t **);
int zfs_aclset_common(struct znode *, zfs_acl_t *, cred_t *, dmu_tx_t *);
uint64_t zfs_external_acl(struct znode *);
diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h
index c44990351..a0165bb2f 100644
--- a/include/sys/zfs_context.h
+++ b/include/sys/zfs_context.h
@@ -49,15 +49,15 @@
#include <sys/byteorder.h>
#include <sys/systm.h>
#include <sys/list.h>
-#include <sys/uio.h>
+#include <sys/uio_impl.h>
#include <sys/dirent.h>
#include <sys/time.h>
#include <vm/seg_kmem.h>
#include <sys/zone.h>
-#include <sys/uio.h>
#include <sys/zfs_debug.h>
#include <sys/fm/fs/zfs.h>
#include <sys/sunddi.h>
+#include <linux/dcache_compat.h>
#else /* _KERNEL */
@@ -310,6 +310,7 @@ extern void cv_wait(kcondvar_t *cv, kmutex_t *mp);
extern clock_t cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime);
extern void cv_signal(kcondvar_t *cv);
extern void cv_broadcast(kcondvar_t *cv);
+#define cv_timedwait_interruptible(cv, mp, at) cv_timedwait(cv, mp, at);
/*
* kstat creation, installation and deletion
diff --git a/include/sys/zfs_ctldir.h b/include/sys/zfs_ctldir.h
deleted file mode 100644
index f88ef95fd..000000000
--- a/include/sys/zfs_ctldir.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- */
-
-#ifndef _ZFS_CTLDIR_H
-#define _ZFS_CTLDIR_H
-
-#include <sys/pathname.h>
-#include <sys/vnode.h>
-#include <sys/zfs_vfsops.h>
-#include <sys/zfs_znode.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ZFS_CTLDIR_NAME ".zfs"
-
-#define zfs_has_ctldir(zdp) \
- ((zdp)->z_id == (zdp)->z_zfsvfs->z_root && \
- ((zdp)->z_zfsvfs->z_ctldir != NULL))
-#define zfs_show_ctldir(zdp) \
- (zfs_has_ctldir(zdp) && \
- ((zdp)->z_zfsvfs->z_show_ctldir))
-
-void zfsctl_create(zfsvfs_t *);
-void zfsctl_destroy(zfsvfs_t *);
-vnode_t *zfsctl_root(znode_t *);
-void zfsctl_init(void);
-void zfsctl_fini(void);
-boolean_t zfsctl_is_node(vnode_t *);
-
-int zfsctl_rename_snapshot(const char *from, const char *to);
-int zfsctl_destroy_snapshot(const char *snapname, int force);
-int zfsctl_umount_snapshots(vfs_t *, int, cred_t *);
-
-int zfsctl_root_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, pathname_t *pnp,
- int flags, vnode_t *rdir, cred_t *cr, caller_context_t *ct,
- int *direntflags, pathname_t *realpnp);
-
-int zfsctl_make_fid(zfsvfs_t *zfsvfsp, uint64_t object, uint32_t gen,
- fid_t *fidp);
-int zfsctl_lookup_objset(vfs_t *vfsp, uint64_t objsetid, zfsvfs_t **zfsvfsp);
-
-#define ZFSCTL_INO_ROOT 0x1
-#define ZFSCTL_INO_SNAPDIR 0x2
-#define ZFSCTL_INO_SHARES 0x3
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ZFS_CTLDIR_H */
diff --git a/include/sys/zfs_dir.h b/include/sys/zfs_dir.h
index 349f8ef37..8610fbe08 100644
--- a/include/sys/zfs_dir.h
+++ b/include/sys/zfs_dir.h
@@ -54,7 +54,7 @@ extern void zfs_dirent_unlock(zfs_dirlock_t *);
extern int zfs_link_create(zfs_dirlock_t *, znode_t *, dmu_tx_t *, int);
extern int zfs_link_destroy(zfs_dirlock_t *, znode_t *, dmu_tx_t *, int,
boolean_t *);
-extern int zfs_dirlook(znode_t *, char *, vnode_t **, int, int *,
+extern int zfs_dirlook(znode_t *, char *, struct inode **, int, int *,
pathname_t *);
extern void zfs_mknode(znode_t *, vattr_t *, dmu_tx_t *, cred_t *,
uint_t, znode_t **, zfs_acl_ids_t *);
@@ -62,10 +62,10 @@ extern void zfs_rmnode(znode_t *);
extern void zfs_dl_name_switch(zfs_dirlock_t *dl, char *new, char **old);
extern boolean_t zfs_dirempty(znode_t *);
extern void zfs_unlinked_add(znode_t *, dmu_tx_t *);
-extern void zfs_unlinked_drain(zfsvfs_t *zfsvfs);
+extern void zfs_unlinked_drain(zfs_sb_t *);
extern int zfs_sticky_remove_access(znode_t *, znode_t *, cred_t *cr);
-extern int zfs_get_xattrdir(znode_t *, vnode_t **, cred_t *, int);
-extern int zfs_make_xattrdir(znode_t *, vattr_t *, vnode_t **, cred_t *);
+extern int zfs_get_xattrdir(znode_t *, struct inode **, cred_t *, int);
+extern int zfs_make_xattrdir(znode_t *, vattr_t *, struct inode **, cred_t *);
#ifdef __cplusplus
}
diff --git a/include/sys/zfs_fuid.h b/include/sys/zfs_fuid.h
index d2989c852..deaebcc82 100644
--- a/include/sys/zfs_fuid.h
+++ b/include/sys/zfs_fuid.h
@@ -99,27 +99,25 @@ typedef struct zfs_fuid_info {
} zfs_fuid_info_t;
#ifdef _KERNEL
-#ifdef HAVE_ZPL
struct znode;
-extern uid_t zfs_fuid_map_id(zfsvfs_t *, uint64_t, cred_t *, zfs_fuid_type_t);
+extern uid_t zfs_fuid_map_id(zfs_sb_t *, uint64_t, cred_t *, zfs_fuid_type_t);
extern void zfs_fuid_node_add(zfs_fuid_info_t **, const char *, uint32_t,
uint64_t, uint64_t, zfs_fuid_type_t);
-extern void zfs_fuid_destroy(zfsvfs_t *);
-extern uint64_t zfs_fuid_create_cred(zfsvfs_t *, zfs_fuid_type_t,
+extern void zfs_fuid_destroy(zfs_sb_t *);
+extern uint64_t zfs_fuid_create_cred(zfs_sb_t *, zfs_fuid_type_t,
cred_t *, zfs_fuid_info_t **);
-extern uint64_t zfs_fuid_create(zfsvfs_t *, uint64_t, cred_t *, zfs_fuid_type_t,
+extern uint64_t zfs_fuid_create(zfs_sb_t *, uint64_t, cred_t *, zfs_fuid_type_t,
zfs_fuid_info_t **);
extern void zfs_fuid_map_ids(struct znode *zp, cred_t *cr,
uid_t *uid, uid_t *gid);
extern zfs_fuid_info_t *zfs_fuid_info_alloc(void);
extern void zfs_fuid_info_free(zfs_fuid_info_t *);
-extern boolean_t zfs_groupmember(zfsvfs_t *, uint64_t, cred_t *);
-void zfs_fuid_sync(zfsvfs_t *, dmu_tx_t *);
-extern int zfs_fuid_find_by_domain(zfsvfs_t *, const char *domain,
+extern boolean_t zfs_groupmember(zfs_sb_t *, uint64_t, cred_t *);
+void zfs_fuid_sync(zfs_sb_t *, dmu_tx_t *);
+extern int zfs_fuid_find_by_domain(zfs_sb_t *, const char *domain,
char **retdomain, boolean_t addok);
-extern const char *zfs_fuid_find_by_idx(zfsvfs_t *zfsvfs, uint32_t idx);
-extern void zfs_fuid_txhold(zfsvfs_t *zfsvfs, dmu_tx_t *tx);
-#endif /* HAVE_ZPL */
+extern const char *zfs_fuid_find_by_idx(zfs_sb_t *zsb, uint32_t idx);
+extern void zfs_fuid_txhold(zfs_sb_t *zsb, dmu_tx_t *tx);
#endif
char *zfs_fuid_idx_domain(avl_tree_t *, uint32_t);
diff --git a/include/sys/zfs_vfsops.h b/include/sys/zfs_vfsops.h
index 38c87df43..a2f00acf0 100644
--- a/include/sys/zfs_vfsops.h
+++ b/include/sys/zfs_vfsops.h
@@ -38,13 +38,15 @@
extern "C" {
#endif
-typedef struct zfsvfs zfsvfs_t;
+struct zfs_sb;
struct znode;
-struct zfsvfs {
- vfs_t *z_vfs; /* generic fs struct */
- zfsvfs_t *z_parent; /* parent fs */
+typedef struct zfs_sb {
+ struct vfsmount *z_vfs; /* generic vfs struct */
+ struct super_block *z_sb; /* generic super_block */
+ struct zfs_sb *z_parent; /* parent fs */
objset_t *z_os; /* objset reference */
+ uint64_t z_flags; /* super_block flags */
uint64_t z_root; /* id of root znode */
uint64_t z_unlinkedobj; /* id of unlinked zapobj */
uint64_t z_max_blksz; /* maximum block size for files */
@@ -67,7 +69,7 @@ struct zfsvfs {
krwlock_t z_teardown_inactive_lock;
list_t z_all_znodes; /* all vnodes in the fs */
kmutex_t z_znodes_lock; /* lock for z_all_znodes */
- vnode_t *z_ctldir; /* .zfs directory pointer */
+ struct inode *z_ctldir; /* .zfs directory inode */
boolean_t z_show_ctldir; /* expose .zfs in the root dir */
boolean_t z_issnap; /* true if this is a snapshot */
boolean_t z_vscan; /* virus scan on/off */
@@ -83,7 +85,36 @@ struct zfsvfs {
sa_attr_type_t *z_attr_table; /* SA attr mapping->id */
#define ZFS_OBJ_MTX_SZ 64
kmutex_t z_hold_mtx[ZFS_OBJ_MTX_SZ]; /* znode hold locks */
-};
+} zfs_sb_t;
+
+#define ZFS_SUPER_MAGIC 0x2fc12fc1
+
+#define ZSB_XATTR_USER 0x0001 /* Enable user xattrs */
+
+
+/*
+ * Minimal snapshot helpers, the bulk of the Linux snapshot implementation
+ * lives in the zpl_snap.c file which is part of the zpl source.
+ */
+#define ZFS_CTLDIR_NAME ".zfs"
+
+#define zfs_has_ctldir(zdp) \
+ ((zdp)->z_id == ZTOZSB(zdp)->z_root && \
+ (ZTOZSB(zdp)->z_ctldir != NULL))
+#define zfs_show_ctldir(zdp) \
+ (zfs_has_ctldir(zdp) && \
+ (ZTOZSB(zdp)->z_show_ctldir))
+
+#define ZFSCTL_INO_ROOT 0x1
+#define ZFSCTL_INO_SNAPDIR 0x2
+#define ZFSCTL_INO_SHARES 0x3
+
+/*
+ * Allow a maximum number of links. While ZFS does not internally limit
+ * this most Linux filesystems do. It's probably a good idea to limit
+ * this to a large value until it is validated that this is safe.
+ */
+#define ZFS_LINK_MAX 65536
/*
* Normal filesystems (those not under .zfs/snapshot) have a total
@@ -135,23 +166,31 @@ typedef struct zfid_long {
extern uint_t zfs_fsyncer_key;
-extern int zfs_suspend_fs(zfsvfs_t *zfsvfs);
-extern int zfs_resume_fs(zfsvfs_t *zfsvfs, const char *osname);
-extern int zfs_userspace_one(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type,
+extern int zfs_suspend_fs(zfs_sb_t *zsb);
+extern int zfs_resume_fs(zfs_sb_t *zsb, const char *osname);
+extern int zfs_userspace_one(zfs_sb_t *zsb, zfs_userquota_prop_t type,
const char *domain, uint64_t rid, uint64_t *valuep);
-extern int zfs_userspace_many(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type,
+extern int zfs_userspace_many(zfs_sb_t *zsb, zfs_userquota_prop_t type,
uint64_t *cookiep, void *vbuf, uint64_t *bufsizep);
-extern int zfs_set_userquota(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type,
+extern int zfs_set_userquota(zfs_sb_t *zsb, zfs_userquota_prop_t type,
const char *domain, uint64_t rid, uint64_t quota);
-extern boolean_t zfs_owner_overquota(zfsvfs_t *zfsvfs, struct znode *,
+extern boolean_t zfs_owner_overquota(zfs_sb_t *zsb, struct znode *,
boolean_t isgroup);
-extern boolean_t zfs_fuid_overquota(zfsvfs_t *zfsvfs, boolean_t isgroup,
+extern boolean_t zfs_fuid_overquota(zfs_sb_t *zsb, boolean_t isgroup,
uint64_t fuid);
-extern int zfs_set_version(zfsvfs_t *zfsvfs, uint64_t newvers);
-extern int zfsvfs_create(const char *name, zfsvfs_t **zfvp);
-extern void zfsvfs_free(zfsvfs_t *zfsvfs);
+extern int zfs_set_version(zfs_sb_t *zsb, uint64_t newvers);
+extern int zfs_sb_create(const char *name, zfs_sb_t **zsbp);
+extern void zfs_sb_free(zfs_sb_t *zsb);
extern int zfs_check_global_label(const char *dsname, const char *hexsl);
+extern int zfs_register_callbacks(zfs_sb_t *zsb);
+extern void zfs_unregister_callbacks(zfs_sb_t *zsb);
+extern int zfs_domount(struct super_block *sb, void *data, int silent);
+extern int zfs_umount(struct super_block *sb);
+extern int zfs_root(zfs_sb_t *zsb, struct inode **ipp);
+extern int zfs_statvfs(struct dentry *dentry, struct kstatfs *statp);
+extern int zfs_vget(struct vfsmount *vfsp, struct inode **ipp, fid_t *fidp);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/sys/zfs_vnops.h b/include/sys/zfs_vnops.h
new file mode 100644
index 000000000..2cacb9c6f
--- /dev/null
+++ b/include/sys/zfs_vnops.h
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#ifndef _SYS_FS_ZFS_VNOPS_H
+#define _SYS_FS_ZFS_VNOPS_H
+
+#include <sys/vnode.h>
+#include <sys/uio.h>
+#include <sys/cred.h>
+#include <sys/fcntl.h>
+#include <sys/pathname.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int zfs_read(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr);
+extern int zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr);
+extern int zfs_access(struct inode *ip, int mode, int flag, cred_t *cr);
+extern int zfs_lookup(struct inode *dip, char *nm, struct inode **ipp,
+ int flags, cred_t *cr, int *direntflags, pathname_t *realpnp);
+extern int zfs_create(struct inode *dip, char *name, vattr_t *vap, int excl,
+ int mode, struct inode **ipp, cred_t *cr, int flag, vsecattr_t *vsecp);
+extern int zfs_remove(struct inode *dip, char *name, cred_t *cr);
+extern int zfs_mkdir(struct inode *dip, char *dirname, vattr_t *vap,
+ struct inode **ipp, cred_t *cr, int flags, vsecattr_t *vsecp);
+extern int zfs_rmdir(struct inode *dip, char *name, struct inode *cwd,
+ cred_t *cr, int flags);
+extern int zfs_readdir(struct inode *ip, void *dirent, filldir_t filldir,
+ loff_t *pos, cred_t *cr);
+extern int zfs_fsync(struct inode *ip, int syncflag, cred_t *cr);
+extern int zfs_getattr(struct inode *ip, struct kstat *stat, int flag,
+ cred_t *cr);
+extern int zfs_setattr(struct inode *ip, struct iattr *attr, int flag,
+ cred_t *cr);
+extern int zfs_rename(struct inode *sdip, char *snm, struct inode *tdip,
+ char *tnm, cred_t *cr, int flags);
+extern int zfs_symlink(struct inode *dip, char *name, vattr_t *vap,
+ char *link, struct inode **ipp, cred_t *cr, int flags);
+extern int zfs_follow_link(struct dentry *dentry, struct nameidata *nd);
+extern int zfs_readlink(struct inode *ip, uio_t *uio, cred_t *cr);
+extern int zfs_link(struct inode *tdip, struct inode *sip,
+ char *name, cred_t *cr);
+extern void zfs_inactive(struct inode *ip);
+extern int zfs_space(struct inode *ip, int cmd, flock64_t *bfp, int flag,
+ offset_t offset, cred_t *cr);
+extern int zfs_fid(struct inode *ip, fid_t *fidp);
+extern int zfs_getsecattr(struct inode *ip, vsecattr_t *vsecp, int flag,
+ cred_t *cr);
+extern int zfs_setsecattr(struct inode *ip, vsecattr_t *vsecp, int flag,
+ cred_t *cr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_FS_ZFS_VNOPS_H */
diff --git a/include/sys/zfs_znode.h b/include/sys/zfs_znode.h
index aa1f449ac..9d12a118e 100644
--- a/include/sys/zfs_znode.h
+++ b/include/sys/zfs_znode.h
@@ -69,7 +69,7 @@ extern "C" {
pflags |= attr; \
else \
pflags &= ~attr; \
- VERIFY(0 == sa_update(zp->z_sa_hdl, SA_ZPL_FLAGS(zp->z_zfsvfs), \
+ VERIFY(0 == sa_update(zp->z_sa_hdl, SA_ZPL_FLAGS(zp->z_sb), \
&pflags, sizeof (pflags), tx)); \
}
@@ -181,8 +181,6 @@ typedef struct zfs_dirlock {
} zfs_dirlock_t;
typedef struct znode {
- struct zfsvfs *z_zfsvfs;
- vnode_t *z_vnode;
uint64_t z_id; /* object ID for this znode */
kmutex_t z_lock; /* znode modification lock */
krwlock_t z_parent_lock; /* parent lock for directories */
@@ -211,6 +209,9 @@ typedef struct znode {
list_node_t z_link_node; /* all znodes in fs link */
sa_handle_t *z_sa_hdl; /* handle to sa data */
boolean_t z_is_sa; /* are we native sa? */
+ boolean_t z_is_zvol; /* are we used by the zvol */
+ boolean_t z_is_mapped; /* are we mmap'ed */
+ struct inode z_inode; /* generic vfs inode */
} znode_t;
@@ -231,45 +232,54 @@ typedef struct znode {
*/
/*
- * Convert between znode pointers and vnode pointers
+ * Convert between znode pointers and inode pointers
*/
-#define ZTOV(ZP) ((ZP)->z_vnode)
-#define VTOZ(VP) ((znode_t *)(VP)->v_data)
+#define ZTOI(znode) (&((znode)->z_inode))
+#define ITOZ(inode) (container_of((inode), znode_t, z_inode))
+#define VTOZSB(vfs) ((zfs_sb_t *)((vfs)->mnt_sb->s_fs_info))
+#define ZTOZSB(znode) ((zfs_sb_t *)(ZTOI(znode)->i_sb->s_fs_info))
+#define ITOZSB(inode) ((zfs_sb_t *)((inode)->i_sb->s_fs_info))
+
+#define S_ISDEV(mode) (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode))
/*
- * ZFS_ENTER() is called on entry to each ZFS vnode and vfs operation.
+ * ZFS_ENTER() is called on entry to each ZFS inode and vfs operation.
* ZFS_EXIT() must be called before exitting the vop.
* ZFS_VERIFY_ZP() verifies the znode is valid.
*/
-#define ZFS_ENTER(zfsvfs) \
+#define ZFS_ENTER(zsb) \
{ \
- rrw_enter(&(zfsvfs)->z_teardown_lock, RW_READER, FTAG); \
- if ((zfsvfs)->z_unmounted) { \
- ZFS_EXIT(zfsvfs); \
+ rrw_enter(&(zsb)->z_teardown_lock, RW_READER, FTAG); \
+ if ((zsb)->z_unmounted) { \
+ ZFS_EXIT(zsb); \
return (EIO); \
} \
}
-#define ZFS_EXIT(zfsvfs) rrw_exit(&(zfsvfs)->z_teardown_lock, FTAG)
+#define ZFS_EXIT(zsb) \
+ { \
+ rrw_exit(&(zsb)->z_teardown_lock, FTAG); \
+ tsd_exit(); \
+ }
#define ZFS_VERIFY_ZP(zp) \
if ((zp)->z_sa_hdl == NULL) { \
- ZFS_EXIT((zp)->z_zfsvfs); \
+ ZFS_EXIT(ZTOZSB(zp)); \
return (EIO); \
- } \
+ }
/*
* Macros for dealing with dmu_buf_hold
*/
#define ZFS_OBJ_HASH(obj_num) ((obj_num) & (ZFS_OBJ_MTX_SZ - 1))
-#define ZFS_OBJ_MUTEX(zfsvfs, obj_num) \
- (&(zfsvfs)->z_hold_mtx[ZFS_OBJ_HASH(obj_num)])
-#define ZFS_OBJ_HOLD_ENTER(zfsvfs, obj_num) \
- mutex_enter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num)))
-#define ZFS_OBJ_HOLD_TRYENTER(zfsvfs, obj_num) \
- mutex_tryenter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num)))
-#define ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num) \
- mutex_exit(ZFS_OBJ_MUTEX((zfsvfs), (obj_num)))
+#define ZFS_OBJ_MUTEX(zsb, obj_num) \
+ (&(zsb)->z_hold_mtx[ZFS_OBJ_HASH(obj_num)])
+#define ZFS_OBJ_HOLD_ENTER(zsb, obj_num) \
+ mutex_enter(ZFS_OBJ_MUTEX((zsb), (obj_num)))
+#define ZFS_OBJ_HOLD_TRYENTER(zsb, obj_num) \
+ mutex_tryenter(ZFS_OBJ_MUTEX((zsb), (obj_num)))
+#define ZFS_OBJ_HOLD_EXIT(zsb, obj_num) \
+ mutex_exit(ZFS_OBJ_MUTEX((zsb), (obj_num)))
/*
* Macros to encode/decode ZFS stored time values from/to struct timespec
@@ -289,15 +299,15 @@ typedef struct znode {
/*
* Timestamp defines
*/
-#define ACCESSED (AT_ATIME)
-#define STATE_CHANGED (AT_CTIME)
-#define CONTENT_MODIFIED (AT_MTIME | AT_CTIME)
+#define ACCESSED (ATTR_ATIME)
+#define STATE_CHANGED (ATTR_CTIME)
+#define CONTENT_MODIFIED (ATTR_MTIME | ATTR_CTIME)
-#define ZFS_ACCESSTIME_STAMP(zfsvfs, zp) \
- if ((zfsvfs)->z_atime && !((zfsvfs)->z_vfs->vfs_flag & VFS_RDONLY)) \
+#define ZFS_ACCESSTIME_STAMP(zsb, zp) \
+ if ((zsb)->z_atime && !((zsb)->z_vfs->mnt_flags & MNT_READONLY)) \
zfs_tstamp_update_setup(zp, ACCESSED, NULL, NULL, B_FALSE);
-extern int zfs_init_fs(zfsvfs_t *, znode_t **);
+extern int zfs_init_fs(zfs_sb_t *, znode_t **);
extern void zfs_set_dataprop(objset_t *);
extern void zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *,
dmu_tx_t *tx);
@@ -307,18 +317,20 @@ extern void zfs_grow_blocksize(znode_t *, uint64_t, dmu_tx_t *);
extern int zfs_freesp(znode_t *, uint64_t, uint64_t, int, boolean_t);
extern void zfs_znode_init(void);
extern void zfs_znode_fini(void);
-extern int zfs_zget(zfsvfs_t *, uint64_t, znode_t **);
+extern int zfs_zget(zfs_sb_t *, uint64_t, znode_t **);
extern int zfs_rezget(znode_t *);
extern void zfs_zinactive(znode_t *);
extern void zfs_znode_delete(znode_t *, dmu_tx_t *);
-extern void zfs_znode_free(znode_t *);
extern void zfs_remove_op_tables(void);
extern int zfs_create_op_tables(void);
-extern int zfs_sync(vfs_t *vfsp, short flag, cred_t *cr);
+extern int zfs_sync(zfs_sb_t *, short, cred_t *);
extern dev_t zfs_cmpldev(uint64_t);
extern int zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value);
extern int zfs_get_stats(objset_t *os, nvlist_t *nv);
extern void zfs_znode_dmu_fini(znode_t *);
+extern int zfs_inode_alloc(struct super_block *, struct inode **ip);
+extern void zfs_inode_destroy(struct inode *);
+extern void zfs_inode_update(znode_t *);
extern void zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
znode_t *dzp, znode_t *zp, char *name, vsecattr_t *, zfs_fuid_info_t *,
@@ -339,12 +351,13 @@ extern void zfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype,
extern void zfs_log_truncate(zilog_t *zilog, dmu_tx_t *tx, int txtype,
znode_t *zp, uint64_t off, uint64_t len);
extern void zfs_log_setattr(zilog_t *zilog, dmu_tx_t *tx, int txtype,
- znode_t *zp, vattr_t *vap, uint_t mask_applied, zfs_fuid_info_t *fuidp);
+ znode_t *zp, struct iattr *attr, uint_t mask_applied,
+ zfs_fuid_info_t *fuidp);
extern void zfs_log_acl(zilog_t *zilog, dmu_tx_t *tx, znode_t *zp,
vsecattr_t *vsecp, zfs_fuid_info_t *fuidp);
extern void zfs_xvattr_set(znode_t *zp, xvattr_t *xvap, dmu_tx_t *tx);
-extern void zfs_upgrade(zfsvfs_t *zfsvfs, dmu_tx_t *tx);
-extern int zfs_create_share_dir(zfsvfs_t *zfsvfs, dmu_tx_t *tx);
+extern void zfs_upgrade(zfs_sb_t *zsb, dmu_tx_t *tx);
+extern int zfs_create_share_dir(zfs_sb_t *zsb, dmu_tx_t *tx);
#if defined(HAVE_UIO_RW)
extern caddr_t zfs_map_page(page_t *, enum seg_rw);
diff --git a/include/sys/zpl.h b/include/sys/zpl.h
new file mode 100644
index 000000000..b6da0d271
--- /dev/null
+++ b/include/sys/zpl.h
@@ -0,0 +1,65 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2011, Lawrence Livermore National Security, LLC.
+ */
+
+#ifndef _SYS_ZPL_H
+#define _SYS_ZPL_H
+
+#include <sys/vfs.h>
+#include <linux/vfs_compat.h>
+#include <linux/xattr_compat.h>
+
+/* zpl_inode.c */
+extern const struct inode_operations zpl_inode_operations;
+extern const struct inode_operations zpl_dir_inode_operations;
+extern const struct inode_operations zpl_symlink_inode_operations;
+extern const struct inode_operations zpl_special_inode_operations;
+
+/* zpl_file.c */
+extern ssize_t zpl_read_common(struct inode *ip, const char *buf,
+ size_t len, loff_t pos, uio_seg_t segment, int flags, cred_t *cr);
+extern ssize_t zpl_write_common(struct inode *ip, const char *buf,
+ size_t len, loff_t pos, uio_seg_t segment, int flags, cred_t *cr);
+
+extern const struct address_space_operations zpl_address_space_operations;
+extern const struct file_operations zpl_file_operations;
+extern const struct file_operations zpl_dir_file_operations;
+
+/* zpl_super.c */
+typedef struct zpl_mount_data {
+ const char *z_osname; /* Dataset name */
+ void *z_data; /* Mount options string */
+ struct vfsmount *z_vfs; /* VFS mount point */
+} zpl_mount_data_t;
+
+extern const struct super_operations zpl_super_operations;
+/* extern const struct export_operations zpl_export_operations; */
+extern struct file_system_type zpl_fs_type;
+
+/* zpl_xattr.c */
+extern ssize_t zpl_xattr_list(struct dentry *dentry, char *buf, size_t size);
+extern int zpl_xattr_security_init(struct inode *ip, struct inode *dip);
+
+extern xattr_handler_t *zpl_xattr_handlers[];
+
+#endif /* _SYS_ZPL_H */