From fd606af35c99686dfe3ab7867b6fd382502fb2e0 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 5 Dec 2008 12:12:37 -0800 Subject: [PATCH 01/35] Refresh linux-kernel-module --- .topdeps | 4 +- .topmsg | 22 ++-- zfs/lib/libavl/avl.c | 33 ++++++ zfs/lib/libavl/zu.c | 4 + zfs/lib/libnvpair/nvpair.c | 131 ++++++++++++++++++++++++ zfs/lib/libnvpair/nvpair_alloc_spl.c | 75 ++++++++++++++ zfs/lib/libnvpair/zu.c | 4 + zfs/lib/libumem/zu.c | 4 + zfs/lib/libuutil/zu.c | 4 + zfs/lib/libzcommon/zfs_comutil.c | 4 + zfs/lib/libzcommon/zfs_deleg.c | 6 ++ zfs/lib/libzcommon/zfs_namecheck.c | 7 ++ zfs/lib/libzcommon/zfs_prop.c | 21 ++++ zfs/lib/libzcommon/zpool_prop.c | 16 +++ zfs/lib/libzcommon/zprop_common.c | 17 +++ zfs/lib/libzfs/libzfs_sendrecv.c | 1 + zfs/lib/libzfs/zu.c | 4 + zfs/lib/libzpool/arc.c | 24 ++++- zfs/lib/libzpool/dbuf.c | 6 ++ zfs/lib/libzpool/dmu.c | 20 ++++ zfs/lib/libzpool/dmu_object.c | 8 ++ zfs/lib/libzpool/dmu_objset.c | 35 +++++++ zfs/lib/libzpool/dmu_traverse.c | 4 + zfs/lib/libzpool/dmu_tx.c | 12 +++ zfs/lib/libzpool/dmu_zfetch.c | 6 ++ zfs/lib/libzpool/dsl_dataset.c | 48 ++++++++- zfs/lib/libzpool/dsl_deleg.c | 5 + zfs/lib/libzpool/dsl_dir.c | 7 ++ zfs/lib/libzpool/dsl_prop.c | 7 ++ zfs/lib/libzpool/dsl_synctask.c | 5 + zfs/lib/libzpool/fletcher.c | 9 ++ zfs/lib/libzpool/include/sys/zfs_fuid.h | 4 +- zfs/lib/libzpool/include/sys/zil.h | 2 +- zfs/lib/libzpool/spa.c | 72 ++++++++++++- zfs/lib/libzpool/spa_config.c | 10 ++ zfs/lib/libzpool/spa_errlog.c | 15 +++ zfs/lib/libzpool/spa_history.c | 12 +++ zfs/lib/libzpool/spa_misc.c | 62 +++++++++++ zfs/lib/libzpool/txg.c | 4 + zfs/lib/libzpool/vdev.c | 8 ++ zfs/lib/libzpool/vdev_queue.c | 11 ++ zfs/lib/libzpool/zap_micro.c | 6 ++ zfs/lib/libzpool/zfs_znode.c | 5 + zfs/lib/libzpool/zil.c | 7 +- zfs/lib/libzpool/zio.c | 24 ++++- zfs/lib/libzpool/zu.c | 4 + 46 files changed, 766 insertions(+), 33 deletions(-) create mode 100644 zfs/lib/libavl/zu.c create mode 100644 zfs/lib/libnvpair/nvpair_alloc_spl.c create mode 100644 zfs/lib/libnvpair/zu.c create mode 100644 zfs/lib/libumem/zu.c create mode 100644 zfs/lib/libuutil/zu.c create mode 100644 zfs/lib/libzfs/zu.c create mode 100644 zfs/lib/libzpool/zu.c diff --git a/.topdeps b/.topdeps index 607c231780..7f16cbcdd5 100644 --- a/.topdeps +++ b/.topdeps @@ -1,3 +1 @@ -gcc-branch -fix-branch -feature-branch +zfs-branch diff --git a/.topmsg b/.topmsg index e9722e1075..82610d817e 100644 --- a/.topmsg +++ b/.topmsg @@ -1,19 +1,11 @@ From: Brian Behlendorf -Subject: [PATCH] zfs branch +Subject: [PATCH] linux kernel module -Merged result of all changes which are relevant to both Solaris -and Linux builds of the ZFS code. These are changes where there -is a reasonable chance they will be accepted upstream. - -Additionally, since this is effectively the root of the linux -ZFS tree the core linux build system is added here. This -includes autogen.sh, configure.ac, m4 macros, some scripts/*, -and makefiles for all the core ZFS components. Linux-only -features which require tweaks to the build system should appear -on the relevant topic branches. All autotools products which -result from autogen.sh are commited to the linux-configure-branch. - -This branch also contains the META, ChangeLog, AUTHORS, -README, and GIT files. +Setup linux kernel module support, this includes: +- zfs context for kernel/user +- kernel module build system integration +- kernel module macros +- kernel module symbol export +- kernel module options Signed-off-by: Brian Behlendorf diff --git a/zfs/lib/libavl/avl.c b/zfs/lib/libavl/avl.c index c9727c643b..cb989f2ccf 100644 --- a/zfs/lib/libavl/avl.c +++ b/zfs/lib/libavl/avl.c @@ -1031,3 +1031,36 @@ done: return (AVL_NODE2DATA(node, off)); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +static int __init avl_init(void) +{ + return 0; +} + +static void avl_fini(void) +{ + return; +} + +module_init(avl_init); +module_exit(avl_fini); + +MODULE_AUTHOR("Sun Microsystems, Inc"); +MODULE_DESCRIPTION("Generic AVL tree implementation"); +MODULE_LICENSE("CDDL"); + +EXPORT_SYMBOL(avl_create); +EXPORT_SYMBOL(avl_find); +EXPORT_SYMBOL(avl_insert); +EXPORT_SYMBOL(avl_insert_here); +EXPORT_SYMBOL(avl_walk); +EXPORT_SYMBOL(avl_first); +EXPORT_SYMBOL(avl_last); +EXPORT_SYMBOL(avl_nearest); +EXPORT_SYMBOL(avl_add); +EXPORT_SYMBOL(avl_remove); +EXPORT_SYMBOL(avl_numnodes); +EXPORT_SYMBOL(avl_destroy_nodes); +EXPORT_SYMBOL(avl_destroy); +#endif diff --git a/zfs/lib/libavl/zu.c b/zfs/lib/libavl/zu.c new file mode 100644 index 0000000000..31dbf45bf9 --- /dev/null +++ b/zfs/lib/libavl/zu.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/zfs/lib/libnvpair/nvpair.c b/zfs/lib/libnvpair/nvpair.c index cee02a04bd..34d9259eea 100644 --- a/zfs/lib/libnvpair/nvpair.c +++ b/zfs/lib/libnvpair/nvpair.c @@ -3244,3 +3244,134 @@ nvs_xdr(nvstream_t *nvs, nvlist_t *nvl, char *buf, size_t *buflen) return (err); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +static int __init nvpair_init(void) +{ + return 0; +} + +static void nvpair_fini(void) +{ + return; +} + +module_init(nvpair_init); +module_exit(nvpair_fini); + +MODULE_AUTHOR("Sun Microsystems, Inc"); +MODULE_DESCRIPTION("Generic name/value pair implementation"); +MODULE_LICENSE("CDDL"); + +EXPORT_SYMBOL(nv_alloc_init); +EXPORT_SYMBOL(nv_alloc_reset); +EXPORT_SYMBOL(nv_alloc_fini); + +/* list management */ +EXPORT_SYMBOL(nvlist_alloc); +EXPORT_SYMBOL(nvlist_free); +EXPORT_SYMBOL(nvlist_size); +EXPORT_SYMBOL(nvlist_pack); +EXPORT_SYMBOL(nvlist_unpack); +EXPORT_SYMBOL(nvlist_dup); +EXPORT_SYMBOL(nvlist_merge); + +EXPORT_SYMBOL(nvlist_xalloc); +EXPORT_SYMBOL(nvlist_xpack); +EXPORT_SYMBOL(nvlist_xunpack); +EXPORT_SYMBOL(nvlist_xdup); +EXPORT_SYMBOL(nvlist_lookup_nv_alloc); + +EXPORT_SYMBOL(nvlist_add_nvpair); +EXPORT_SYMBOL(nvlist_add_boolean); +EXPORT_SYMBOL(nvlist_add_boolean_value); +EXPORT_SYMBOL(nvlist_add_byte); +EXPORT_SYMBOL(nvlist_add_int8); +EXPORT_SYMBOL(nvlist_add_uint8); +EXPORT_SYMBOL(nvlist_add_int16); +EXPORT_SYMBOL(nvlist_add_uint16); +EXPORT_SYMBOL(nvlist_add_int32); +EXPORT_SYMBOL(nvlist_add_uint32); +EXPORT_SYMBOL(nvlist_add_int64); +EXPORT_SYMBOL(nvlist_add_uint64); +EXPORT_SYMBOL(nvlist_add_string); +EXPORT_SYMBOL(nvlist_add_nvlist); +EXPORT_SYMBOL(nvlist_add_boolean_array); +EXPORT_SYMBOL(nvlist_add_byte_array); +EXPORT_SYMBOL(nvlist_add_int8_array); +EXPORT_SYMBOL(nvlist_add_uint8_array); +EXPORT_SYMBOL(nvlist_add_int16_array); +EXPORT_SYMBOL(nvlist_add_uint16_array); +EXPORT_SYMBOL(nvlist_add_int32_array); +EXPORT_SYMBOL(nvlist_add_uint32_array); +EXPORT_SYMBOL(nvlist_add_int64_array); +EXPORT_SYMBOL(nvlist_add_uint64_array); +EXPORT_SYMBOL(nvlist_add_string_array); +EXPORT_SYMBOL(nvlist_add_nvlist_array); +EXPORT_SYMBOL(nvlist_add_hrtime); + +EXPORT_SYMBOL(nvlist_remove); +EXPORT_SYMBOL(nvlist_remove_all); + +EXPORT_SYMBOL(nvlist_lookup_boolean); +EXPORT_SYMBOL(nvlist_lookup_boolean_value); +EXPORT_SYMBOL(nvlist_lookup_byte); +EXPORT_SYMBOL(nvlist_lookup_int8); +EXPORT_SYMBOL(nvlist_lookup_uint8); +EXPORT_SYMBOL(nvlist_lookup_int16); +EXPORT_SYMBOL(nvlist_lookup_uint16); +EXPORT_SYMBOL(nvlist_lookup_int32); +EXPORT_SYMBOL(nvlist_lookup_uint32); +EXPORT_SYMBOL(nvlist_lookup_int64); +EXPORT_SYMBOL(nvlist_lookup_uint64); +EXPORT_SYMBOL(nvlist_lookup_string); +EXPORT_SYMBOL(nvlist_lookup_nvlist); +EXPORT_SYMBOL(nvlist_lookup_boolean_array); +EXPORT_SYMBOL(nvlist_lookup_byte_array); +EXPORT_SYMBOL(nvlist_lookup_int8_array); +EXPORT_SYMBOL(nvlist_lookup_uint8_array); +EXPORT_SYMBOL(nvlist_lookup_int16_array); +EXPORT_SYMBOL(nvlist_lookup_uint16_array); +EXPORT_SYMBOL(nvlist_lookup_int32_array); +EXPORT_SYMBOL(nvlist_lookup_uint32_array); +EXPORT_SYMBOL(nvlist_lookup_int64_array); +EXPORT_SYMBOL(nvlist_lookup_uint64_array); +EXPORT_SYMBOL(nvlist_lookup_string_array); +EXPORT_SYMBOL(nvlist_lookup_nvlist_array); +EXPORT_SYMBOL(nvlist_lookup_hrtime); +EXPORT_SYMBOL(nvlist_lookup_pairs); + +EXPORT_SYMBOL(nvlist_lookup_nvpair); +EXPORT_SYMBOL(nvlist_exists); + +/* processing nvpair */ +EXPORT_SYMBOL(nvlist_next_nvpair); +EXPORT_SYMBOL(nvpair_name); +EXPORT_SYMBOL(nvpair_type); +EXPORT_SYMBOL(nvpair_value_boolean_value); +EXPORT_SYMBOL(nvpair_value_byte); +EXPORT_SYMBOL(nvpair_value_int8); +EXPORT_SYMBOL(nvpair_value_uint8); +EXPORT_SYMBOL(nvpair_value_int16); +EXPORT_SYMBOL(nvpair_value_uint16); +EXPORT_SYMBOL(nvpair_value_int32); +EXPORT_SYMBOL(nvpair_value_uint32); +EXPORT_SYMBOL(nvpair_value_int64); +EXPORT_SYMBOL(nvpair_value_uint64); +EXPORT_SYMBOL(nvpair_value_string); +EXPORT_SYMBOL(nvpair_value_nvlist); +EXPORT_SYMBOL(nvpair_value_boolean_array); +EXPORT_SYMBOL(nvpair_value_byte_array); +EXPORT_SYMBOL(nvpair_value_int8_array); +EXPORT_SYMBOL(nvpair_value_uint8_array); +EXPORT_SYMBOL(nvpair_value_int16_array); +EXPORT_SYMBOL(nvpair_value_uint16_array); +EXPORT_SYMBOL(nvpair_value_int32_array); +EXPORT_SYMBOL(nvpair_value_uint32_array); +EXPORT_SYMBOL(nvpair_value_int64_array); +EXPORT_SYMBOL(nvpair_value_uint64_array); +EXPORT_SYMBOL(nvpair_value_string_array); +EXPORT_SYMBOL(nvpair_value_nvlist_array); +EXPORT_SYMBOL(nvpair_value_hrtime); + +#endif diff --git a/zfs/lib/libnvpair/nvpair_alloc_spl.c b/zfs/lib/libnvpair/nvpair_alloc_spl.c new file mode 100644 index 0000000000..d26d26913d --- /dev/null +++ b/zfs/lib/libnvpair/nvpair_alloc_spl.c @@ -0,0 +1,75 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include +#include + +static void * +nv_alloc_sleep_spl(nv_alloc_t *nva, size_t size) +{ + return (kmem_alloc(size, KM_SLEEP)); +} + +static void * +nv_alloc_nosleep_spl(nv_alloc_t *nva, size_t size) +{ + return (kmem_alloc(size, KM_NOSLEEP)); +} + +static void +nv_free_spl(nv_alloc_t *nva, void *buf, size_t size) +{ + kmem_free(buf, size); +} + +const nv_alloc_ops_t spl_sleep_ops_def = { + NULL, /* nv_ao_init() */ + NULL, /* nv_ao_fini() */ + nv_alloc_sleep_spl, /* nv_ao_alloc() */ + nv_free_spl, /* nv_ao_free() */ + NULL /* nv_ao_reset() */ +}; + +const nv_alloc_ops_t spl_nosleep_ops_def = { + NULL, /* nv_ao_init() */ + NULL, /* nv_ao_fini() */ + nv_alloc_nosleep_spl, /* nv_ao_alloc() */ + nv_free_spl, /* nv_ao_free() */ + NULL /* nv_ao_reset() */ +}; + +nv_alloc_t nv_alloc_sleep_def = { + &spl_sleep_ops_def, + NULL +}; + +nv_alloc_t nv_alloc_nosleep_def = { + &spl_nosleep_ops_def, + NULL +}; + +nv_alloc_t *nv_alloc_sleep = &nv_alloc_sleep_def; +nv_alloc_t *nv_alloc_nosleep = &nv_alloc_nosleep_def; diff --git a/zfs/lib/libnvpair/zu.c b/zfs/lib/libnvpair/zu.c new file mode 100644 index 0000000000..31dbf45bf9 --- /dev/null +++ b/zfs/lib/libnvpair/zu.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/zfs/lib/libumem/zu.c b/zfs/lib/libumem/zu.c new file mode 100644 index 0000000000..64672cca56 --- /dev/null +++ b/zfs/lib/libumem/zu.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/zfs/lib/libuutil/zu.c b/zfs/lib/libuutil/zu.c new file mode 100644 index 0000000000..64672cca56 --- /dev/null +++ b/zfs/lib/libuutil/zu.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/zfs/lib/libzcommon/zfs_comutil.c b/zfs/lib/libzcommon/zfs_comutil.c index 74517a3f69..e5cb3921ce 100644 --- a/zfs/lib/libzcommon/zfs_comutil.c +++ b/zfs/lib/libzcommon/zfs_comutil.c @@ -63,3 +63,7 @@ zfs_allocatable_devs(nvlist_t *nv) } return (B_FALSE); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(zfs_allocatable_devs); +#endif diff --git a/zfs/lib/libzcommon/zfs_deleg.c b/zfs/lib/libzcommon/zfs_deleg.c index 1b94a28561..eb48570523 100644 --- a/zfs/lib/libzcommon/zfs_deleg.c +++ b/zfs/lib/libzcommon/zfs_deleg.c @@ -232,3 +232,9 @@ zfs_deleg_whokey(char *attr, zfs_deleg_who_type_t type, ASSERT(!"bad zfs_deleg_who_type_t"); } } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(zfs_deleg_verify_nvlist); +EXPORT_SYMBOL(zfs_deleg_whokey); +EXPORT_SYMBOL(zfs_deleg_canonicalize_perm); +#endif diff --git a/zfs/lib/libzcommon/zfs_namecheck.c b/zfs/lib/libzcommon/zfs_namecheck.c index a9d109be20..085532b16e 100644 --- a/zfs/lib/libzcommon/zfs_namecheck.c +++ b/zfs/lib/libzcommon/zfs_namecheck.c @@ -361,3 +361,10 @@ dataset_name_hidden(const char *name) return (0); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(snapshot_namecheck); +EXPORT_SYMBOL(pool_namecheck); +EXPORT_SYMBOL(dataset_name_hidden); +EXPORT_SYMBOL(dataset_namecheck); +#endif diff --git a/zfs/lib/libzcommon/zfs_prop.c b/zfs/lib/libzcommon/zfs_prop.c index effd2dba70..658bb60639 100644 --- a/zfs/lib/libzcommon/zfs_prop.c +++ b/zfs/lib/libzcommon/zfs_prop.c @@ -494,3 +494,24 @@ zfs_prop_align_right(zfs_prop_t prop) } #endif + +#if defined(_KERNEL) && defined(HAVE_SPL) +/* zfs dataset property functions */ +EXPORT_SYMBOL(zfs_prop_init); +EXPORT_SYMBOL(zfs_prop_get_type); +EXPORT_SYMBOL(zfs_prop_delegatable); +EXPORT_SYMBOL(zfs_prop_get_table); + +/* Dataset property functions shared between libzfs and kernel. */ +EXPORT_SYMBOL(zfs_prop_default_string); +EXPORT_SYMBOL(zfs_prop_default_numeric); +EXPORT_SYMBOL(zfs_prop_readonly); +EXPORT_SYMBOL(zfs_prop_inheritable); +EXPORT_SYMBOL(zfs_prop_setonce); +EXPORT_SYMBOL(zfs_prop_to_name); +EXPORT_SYMBOL(zfs_name_to_prop); +EXPORT_SYMBOL(zfs_prop_user); +EXPORT_SYMBOL(zfs_prop_index_to_string); +EXPORT_SYMBOL(zfs_prop_string_to_index); +EXPORT_SYMBOL(zfs_prop_valid_for_type); +#endif diff --git a/zfs/lib/libzcommon/zpool_prop.c b/zfs/lib/libzcommon/zpool_prop.c index f5efe18d24..888cd8dad8 100644 --- a/zfs/lib/libzcommon/zpool_prop.c +++ b/zfs/lib/libzcommon/zpool_prop.c @@ -184,3 +184,19 @@ zpool_prop_align_right(zpool_prop_t prop) return (zpool_prop_table[prop].pd_rightalign); } #endif + +#if defined(_KERNEL) && defined(HAVE_SPL) +/* zpool property functions */ +EXPORT_SYMBOL(zpool_prop_init); +EXPORT_SYMBOL(zpool_prop_get_type); +EXPORT_SYMBOL(zpool_prop_get_table); + +/* Pool property functions shared between libzfs and kernel. */ +EXPORT_SYMBOL(zpool_name_to_prop); +EXPORT_SYMBOL(zpool_prop_to_name); +EXPORT_SYMBOL(zpool_prop_default_string); +EXPORT_SYMBOL(zpool_prop_default_numeric); +EXPORT_SYMBOL(zpool_prop_readonly); +EXPORT_SYMBOL(zpool_prop_index_to_string); +EXPORT_SYMBOL(zpool_prop_string_to_index); +#endif diff --git a/zfs/lib/libzcommon/zprop_common.c b/zfs/lib/libzcommon/zprop_common.c index c3314be179..dfd73acaa8 100644 --- a/zfs/lib/libzcommon/zprop_common.c +++ b/zfs/lib/libzcommon/zprop_common.c @@ -404,3 +404,20 @@ zprop_width(int prop, boolean_t *fixed, zfs_type_t type) } #endif + +#if defined(_KERNEL) && defined(HAVE_SPL) +/* Common routines to initialize property tables */ +EXPORT_SYMBOL(register_impl); +EXPORT_SYMBOL(register_string); +EXPORT_SYMBOL(register_number); +EXPORT_SYMBOL(register_index); +EXPORT_SYMBOL(register_hidden); + +/* Common routines for zfs and zpool property management */ +EXPORT_SYMBOL(zprop_iter_common); +EXPORT_SYMBOL(zprop_name_to_prop); +EXPORT_SYMBOL(zprop_string_to_index); +EXPORT_SYMBOL(zprop_index_to_string); +EXPORT_SYMBOL(zprop_values); +EXPORT_SYMBOL(zprop_valid_for_type); +#endif diff --git a/zfs/lib/libzfs/libzfs_sendrecv.c b/zfs/lib/libzfs/libzfs_sendrecv.c index a7acf3974f..0e8efa0765 100644 --- a/zfs/lib/libzfs/libzfs_sendrecv.c +++ b/zfs/lib/libzfs/libzfs_sendrecv.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include diff --git a/zfs/lib/libzfs/zu.c b/zfs/lib/libzfs/zu.c new file mode 100644 index 0000000000..64672cca56 --- /dev/null +++ b/zfs/lib/libzfs/zu.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/zfs/lib/libzpool/arc.c b/zfs/lib/libzpool/arc.c index a4dd7b874a..a92a7e9cd9 100644 --- a/zfs/lib/libzpool/arc.c +++ b/zfs/lib/libzpool/arc.c @@ -168,9 +168,9 @@ static boolean_t arc_warm; /* * These tunables are for performance analysis. */ -uint64_t zfs_arc_max; -uint64_t zfs_arc_min; -uint64_t zfs_arc_meta_limit = 0; +unsigned long zfs_arc_max = 0; +unsigned long zfs_arc_min = 0; +unsigned long zfs_arc_meta_limit = 0; int zfs_mdcomp_disable = 0; /* @@ -4479,3 +4479,21 @@ l2arc_stop(void) cv_wait(&l2arc_feed_thr_cv, &l2arc_feed_thr_lock); mutex_exit(&l2arc_feed_thr_lock); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(arc_read); +EXPORT_SYMBOL(arc_buf_remove_ref); +EXPORT_SYMBOL(arc_getbuf_func); + +module_param(zfs_arc_min, ulong, 0644); +MODULE_PARM_DESC(zfs_arc_min, "Minimum arc size"); + +module_param(zfs_arc_max, ulong, 0644); +MODULE_PARM_DESC(zfs_arc_max, "Maximum arc size"); + +module_param(zfs_arc_meta_limit, ulong, 0644); +MODULE_PARM_DESC(zfs_arc_meta_limit, "Meta limit for arc size"); + +module_param(zfs_mdcomp_disable, int, 0644); +MODULE_PARM_DESC(zfs_mdcomp_disable, "Meta compression disable"); +#endif diff --git a/zfs/lib/libzpool/dbuf.c b/zfs/lib/libzpool/dbuf.c index 4ca8c98fca..b8f4cc69f8 100644 --- a/zfs/lib/libzpool/dbuf.c +++ b/zfs/lib/libzpool/dbuf.c @@ -24,6 +24,7 @@ */ #include +#include #include #include #include @@ -2369,3 +2370,8 @@ dbuf_write_done(zio_t *zio, arc_buf_t *buf, void *vdb) dbuf_rele(db, (void *)(uintptr_t)txg); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(dmu_buf_rele); +EXPORT_SYMBOL(dmu_buf_will_dirty); +#endif diff --git a/zfs/lib/libzpool/dmu.c b/zfs/lib/libzpool/dmu.c index b6205bd500..79ea277bbf 100644 --- a/zfs/lib/libzpool/dmu.c +++ b/zfs/lib/libzpool/dmu.c @@ -1225,3 +1225,23 @@ dmu_fini(void) dbuf_fini(); l2arc_fini(); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(dmu_bonus_hold); +EXPORT_SYMBOL(dmu_free_range); +EXPORT_SYMBOL(dmu_read); +EXPORT_SYMBOL(dmu_write); + +/* Get information on a DMU object. */ +EXPORT_SYMBOL(dmu_object_info); +EXPORT_SYMBOL(dmu_object_info_from_dnode); +EXPORT_SYMBOL(dmu_object_info_from_db); +EXPORT_SYMBOL(dmu_object_size_from_db); + +EXPORT_SYMBOL(dmu_object_set_blocksize); +EXPORT_SYMBOL(dmu_object_set_checksum); +EXPORT_SYMBOL(dmu_object_set_compress); +EXPORT_SYMBOL(dmu_get_replication_level); + +EXPORT_SYMBOL(dmu_ot); +#endif diff --git a/zfs/lib/libzpool/dmu_object.c b/zfs/lib/libzpool/dmu_object.c index 1b9247d66e..5d965c36e3 100644 --- a/zfs/lib/libzpool/dmu_object.c +++ b/zfs/lib/libzpool/dmu_object.c @@ -160,3 +160,11 @@ dmu_object_next(objset_t *os, uint64_t *objectp, boolean_t hole, uint64_t txg) return (error); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(dmu_object_alloc); +EXPORT_SYMBOL(dmu_object_claim); +EXPORT_SYMBOL(dmu_object_reclaim); +EXPORT_SYMBOL(dmu_object_free); +EXPORT_SYMBOL(dmu_object_next); +#endif diff --git a/zfs/lib/libzpool/dmu_objset.c b/zfs/lib/libzpool/dmu_objset.c index b4c4c98cc6..046f5b0a24 100644 --- a/zfs/lib/libzpool/dmu_objset.c +++ b/zfs/lib/libzpool/dmu_objset.c @@ -726,9 +726,11 @@ dmu_objset_snapshot_one(char *name, void *arg) * doing a recursive snapshot. The permission checks for the starting * dataset have already been performed in zfs_secpolicy_snapshot() */ +#ifdef HAVE_ZPL if (sn->checkperms == B_TRUE && (err = zfs_secpolicy_snapshot_perms(name, CRED()))) return (err); +#endif err = dmu_objset_open(name, DMU_OST_ANY, DS_MODE_USER, &os); if (err != 0) @@ -1226,3 +1228,36 @@ dmu_objset_get_user(objset_t *os) ASSERT(MUTEX_HELD(&os->os->os_user_ptr_lock)); return (os->os->os_user_ptr); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(dmu_objset_spa); +EXPORT_SYMBOL(dmu_objset_zil); +EXPORT_SYMBOL(dmu_objset_pool); +EXPORT_SYMBOL(dmu_objset_ds); +EXPORT_SYMBOL(dmu_objset_name); +EXPORT_SYMBOL(dmu_objset_type); +EXPORT_SYMBOL(dmu_objset_id); +EXPORT_SYMBOL(dmu_snapshot_list_next); +EXPORT_SYMBOL(dmu_dir_list_next); +EXPORT_SYMBOL(dmu_objset_set_user); +EXPORT_SYMBOL(dmu_objset_get_user); + +/* Public routines to create, destroy, open, and close objsets. */ +EXPORT_SYMBOL(dmu_objset_open); +EXPORT_SYMBOL(dmu_objset_open_ds); +EXPORT_SYMBOL(dmu_objset_close); +EXPORT_SYMBOL(dmu_objset_evict_dbufs); +EXPORT_SYMBOL(dmu_objset_create); +EXPORT_SYMBOL(dmu_objset_create_impl); +EXPORT_SYMBOL(dmu_objset_destroy); +EXPORT_SYMBOL(dmu_snapshots_destroy); +EXPORT_SYMBOL(dmu_objset_rollback); +EXPORT_SYMBOL(dmu_objset_snapshot); +EXPORT_SYMBOL(dmu_objset_rename); +EXPORT_SYMBOL(dmu_objset_find); +EXPORT_SYMBOL(dmu_objset_byteswap); + +/* Get stats on a dataset. */ +EXPORT_SYMBOL(dmu_objset_fast_stat); +EXPORT_SYMBOL(dmu_objset_stats); +#endif diff --git a/zfs/lib/libzpool/dmu_traverse.c b/zfs/lib/libzpool/dmu_traverse.c index 5124014707..66605b00b1 100644 --- a/zfs/lib/libzpool/dmu_traverse.c +++ b/zfs/lib/libzpool/dmu_traverse.c @@ -404,3 +404,7 @@ traverse_pool(spa_t *spa, blkptr_cb_t func, void *arg) err = 0; return (err); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(traverse_dsl_dataset); +#endif diff --git a/zfs/lib/libzpool/dmu_tx.c b/zfs/lib/libzpool/dmu_tx.c index 42ce01d23c..1729e9848a 100644 --- a/zfs/lib/libzpool/dmu_tx.c +++ b/zfs/lib/libzpool/dmu_tx.c @@ -1127,3 +1127,15 @@ dmu_tx_callback_data_destroy(void *dcb_data) return (0); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(dmu_tx_create); +EXPORT_SYMBOL(dmu_tx_hold_write); +EXPORT_SYMBOL(dmu_tx_hold_free); +EXPORT_SYMBOL(dmu_tx_hold_zap); +EXPORT_SYMBOL(dmu_tx_hold_bonus); +EXPORT_SYMBOL(dmu_tx_abort); +EXPORT_SYMBOL(dmu_tx_assign); +EXPORT_SYMBOL(dmu_tx_wait); +EXPORT_SYMBOL(dmu_tx_commit); +#endif diff --git a/zfs/lib/libzpool/dmu_zfetch.c b/zfs/lib/libzpool/dmu_zfetch.c index 4d79fe98e1..caf736000a 100644 --- a/zfs/lib/libzpool/dmu_zfetch.c +++ b/zfs/lib/libzpool/dmu_zfetch.c @@ -649,3 +649,9 @@ dmu_zfetch(zfetch_t *zf, uint64_t offset, uint64_t size, int prefetched) } } } + +#if defined(_KERNEL) && defined(HAVE_SPL) +module_param(zfs_prefetch_disable, int, 0644); +MODULE_PARM_DESC(zfs_prefetch_disable, "Disable all ZFS prefetching"); +#endif + diff --git a/zfs/lib/libzpool/dsl_dataset.c b/zfs/lib/libzpool/dsl_dataset.c index 4f9083f17e..a98c142c54 100644 --- a/zfs/lib/libzpool/dsl_dataset.c +++ b/zfs/lib/libzpool/dsl_dataset.c @@ -2093,6 +2093,7 @@ dsl_snapshot_rename_one(char *name, void *arg) * For recursive snapshot renames the parent won't be changing * so we just pass name for both the to/from argument. */ +#ifdef HAVE_ZPL err = zfs_secpolicy_rename_perms(name, name, CRED()); if (err == ENOENT) { return (0); @@ -2100,8 +2101,10 @@ dsl_snapshot_rename_one(char *name, void *arg) (void) strcpy(ra->failed, name); return (err); } +#endif -#ifdef _KERNEL +/* XXX: Ignore for SPL version until mounting the FS is supported */ +#if defined(_KERNEL) && !defined(HAVE_SPL) /* * For all filesystems undergoing rename, we'll need to unmount it. */ @@ -3101,3 +3104,46 @@ dsl_dataset_set_reservation(const char *dsname, uint64_t reservation) dsl_dataset_rele(ds, FTAG); return (err); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(dsl_dataset_open_spa); +EXPORT_SYMBOL(dsl_dataset_open); +EXPORT_SYMBOL(dsl_dataset_open_obj); +EXPORT_SYMBOL(dsl_dataset_name); +EXPORT_SYMBOL(dsl_dataset_close); +EXPORT_SYMBOL(dsl_dataset_downgrade); +EXPORT_SYMBOL(dsl_dataset_tryupgrade); +EXPORT_SYMBOL(dsl_dataset_create_sync_impl); +EXPORT_SYMBOL(dsl_dataset_create_sync); +EXPORT_SYMBOL(dsl_dataset_destroy); +EXPORT_SYMBOL(dsl_snapshots_destroy); +EXPORT_SYMBOL(dsl_dataset_destroy_check); +EXPORT_SYMBOL(dsl_dataset_destroy_sync); +EXPORT_SYMBOL(dsl_dataset_snapshot_check); +EXPORT_SYMBOL(dsl_dataset_snapshot_sync); +EXPORT_SYMBOL(dsl_dataset_rollback); +EXPORT_SYMBOL(dsl_dataset_rename); +EXPORT_SYMBOL(dsl_dataset_promote); +EXPORT_SYMBOL(dsl_dataset_clone_swap); +EXPORT_SYMBOL(dsl_dataset_set_user_ptr); +EXPORT_SYMBOL(dsl_dataset_get_user_ptr); +EXPORT_SYMBOL(dsl_dataset_set_blkptr); +EXPORT_SYMBOL(dsl_dataset_get_spa); +EXPORT_SYMBOL(dsl_dataset_modified_since_lastsnap); +EXPORT_SYMBOL(dsl_dataset_sync); +EXPORT_SYMBOL(dsl_dataset_block_born); +EXPORT_SYMBOL(dsl_dataset_block_kill); +EXPORT_SYMBOL(dsl_dataset_block_freeable); +EXPORT_SYMBOL(dsl_dataset_prev_snap_txg); +EXPORT_SYMBOL(dsl_dataset_dirty); +EXPORT_SYMBOL(dsl_dataset_stats); +EXPORT_SYMBOL(dsl_dataset_fast_stat); +EXPORT_SYMBOL(dsl_dataset_space); +EXPORT_SYMBOL(dsl_dataset_fsid_guid); +EXPORT_SYMBOL(dsl_dataset_create_root); +EXPORT_SYMBOL(dsl_dsobj_to_dsname); +EXPORT_SYMBOL(dsl_dataset_check_quota); +EXPORT_SYMBOL(dsl_dataset_set_quota); +EXPORT_SYMBOL(dsl_dataset_set_quota_sync); +EXPORT_SYMBOL(dsl_dataset_set_reservation); +#endif diff --git a/zfs/lib/libzpool/dsl_deleg.c b/zfs/lib/libzpool/dsl_deleg.c index 24f68b89db..e1be43045e 100644 --- a/zfs/lib/libzpool/dsl_deleg.c +++ b/zfs/lib/libzpool/dsl_deleg.c @@ -733,3 +733,8 @@ dsl_delegation_on(objset_t *os) { return (os->os->os_spa->spa_delegation); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(dsl_deleg_get); +EXPORT_SYMBOL(dsl_deleg_set); +#endif diff --git a/zfs/lib/libzpool/dsl_dir.c b/zfs/lib/libzpool/dsl_dir.c index 9a76d989a0..4ffacdf682 100644 --- a/zfs/lib/libzpool/dsl_dir.c +++ b/zfs/lib/libzpool/dsl_dir.c @@ -1328,3 +1328,10 @@ dsl_dir_transfer_possible(dsl_dir_t *sdd, dsl_dir_t *tdd, uint64_t space) return (0); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(dsl_dir_set_quota); +EXPORT_SYMBOL(dsl_dir_set_reservation); +EXPORT_SYMBOL(dsl_dir_open); +EXPORT_SYMBOL(dsl_dir_close); +#endif diff --git a/zfs/lib/libzpool/dsl_prop.c b/zfs/lib/libzpool/dsl_prop.c index bb19f3e9e8..579b1e43a1 100644 --- a/zfs/lib/libzpool/dsl_prop.c +++ b/zfs/lib/libzpool/dsl_prop.c @@ -600,3 +600,10 @@ dsl_prop_nvlist_add_string(nvlist_t *nv, zfs_prop_t prop, const char *value) VERIFY(nvlist_add_nvlist(nv, zfs_prop_to_name(prop), propval) == 0); nvlist_free(propval); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(dsl_prop_set); +EXPORT_SYMBOL(dsl_prop_get_all); +EXPORT_SYMBOL(dsl_prop_nvlist_add_uint64); +EXPORT_SYMBOL(dsl_prop_get_integer); +#endif diff --git a/zfs/lib/libzpool/dsl_synctask.c b/zfs/lib/libzpool/dsl_synctask.c index 9bb9c45804..99e6f7a323 100644 --- a/zfs/lib/libzpool/dsl_synctask.c +++ b/zfs/lib/libzpool/dsl_synctask.c @@ -223,3 +223,8 @@ dsl_sync_task_do_nowait(dsl_pool_t *dp, arg1, arg2, blocks_modified); dsl_sync_task_group_nowait(dstg, tx); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(dsl_sync_task_do); +EXPORT_SYMBOL(dsl_sync_task_do_nowait); +#endif diff --git a/zfs/lib/libzpool/fletcher.c b/zfs/lib/libzpool/fletcher.c index edda3c9a9d..f71d59d9ea 100644 --- a/zfs/lib/libzpool/fletcher.c +++ b/zfs/lib/libzpool/fletcher.c @@ -143,3 +143,12 @@ fletcher_4_incremental_byteswap(const void *buf, uint64_t size, ZIO_SET_CHECKSUM(zcp, a, b, c, d); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(fletcher_2_native); +EXPORT_SYMBOL(fletcher_2_byteswap); +EXPORT_SYMBOL(fletcher_4_native); +EXPORT_SYMBOL(fletcher_4_byteswap); +EXPORT_SYMBOL(fletcher_4_incremental_native); +EXPORT_SYMBOL(fletcher_4_incremental_byteswap); +#endif diff --git a/zfs/lib/libzpool/include/sys/zfs_fuid.h b/zfs/lib/libzpool/include/sys/zfs_fuid.h index 810ffc81a8..41f5846f5c 100644 --- a/zfs/lib/libzpool/include/sys/zfs_fuid.h +++ b/zfs/lib/libzpool/include/sys/zfs_fuid.h @@ -100,6 +100,7 @@ typedef struct zfs_fuid_info { } zfs_fuid_info_t; #ifdef _KERNEL +#ifndef HAVE_SPL struct znode; extern uid_t zfs_fuid_map_id(zfsvfs_t *, uint64_t, cred_t *, zfs_fuid_type_t); extern void zfs_fuid_destroy(zfsvfs_t *); @@ -112,7 +113,7 @@ extern void zfs_fuid_map_ids(struct znode *zp, cred_t *cr, uid_t *uid, extern zfs_fuid_info_t *zfs_fuid_info_alloc(void); extern void zfs_fuid_info_free(); extern boolean_t zfs_groupmember(zfsvfs_t *, uint64_t, cred_t *); -#endif +#endif /* !HAVE_SPL */ char *zfs_fuid_idx_domain(avl_tree_t *, uint32_t); uint64_t zfs_fuid_table_load(objset_t *, uint64_t, avl_tree_t *, avl_tree_t *); @@ -121,5 +122,6 @@ void zfs_fuid_table_destroy(avl_tree_t *, avl_tree_t *); #ifdef __cplusplus } #endif +#endif #endif /* _SYS_FS_ZFS_FUID_H */ diff --git a/zfs/lib/libzpool/include/sys/zil.h b/zfs/lib/libzpool/include/sys/zil.h index 4d02d14f70..f8176c9dd0 100644 --- a/zfs/lib/libzpool/include/sys/zil.h +++ b/zfs/lib/libzpool/include/sys/zil.h @@ -334,7 +334,7 @@ typedef void zil_parse_blk_func_t(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t txg); typedef void zil_parse_lr_func_t(zilog_t *zilog, lr_t *lr, void *arg, uint64_t txg); -typedef int zil_replay_func_t(); +typedef int zil_replay_func_t(void *, char *, boolean_t); typedef void zil_replay_cleaner_t(); typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf, zio_t *zio); diff --git a/zfs/lib/libzpool/spa.c b/zfs/lib/libzpool/spa.c index bd4ce35b28..942f967696 100644 --- a/zfs/lib/libzpool/spa.c +++ b/zfs/lib/libzpool/spa.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -167,9 +168,11 @@ spa_prop_get(spa_t *spa, nvlist_t **nvp) zap_cursor_t zc; zap_attribute_t za; objset_t *mos = spa->spa_meta_objset; - int err; + int err = 0; - VERIFY(nvlist_alloc(nvp, NV_UNIQUE_NAME, KM_SLEEP) == 0); + err = nvlist_alloc(nvp, NV_UNIQUE_NAME, KM_SLEEP); + if (err) + return err; mutex_enter(&spa->spa_props_lock); @@ -181,7 +184,7 @@ spa_prop_get(spa_t *spa, nvlist_t **nvp) /* If no pool property object, no more prop to get. */ if (spa->spa_pool_props_object == 0) { mutex_exit(&spa->spa_props_lock); - return (0); + goto out; } /* @@ -2276,8 +2279,6 @@ spa_build_rootpool_config(nvlist_t *config) * Get the root pool information from the root disk, then import the root pool * during the system boot up time. */ -extern int vdev_disk_read_rootlabel(char *, char *, nvlist_t **); - int spa_check_rootconf(char *devpath, char *devid, nvlist_t **bestconf, uint64_t *besttxg) @@ -4301,3 +4302,64 @@ done: sysevent_free(ev); #endif } + +#if defined(_KERNEL) && defined(HAVE_SPL) +/* state manipulation functions */ +EXPORT_SYMBOL(spa_open); +EXPORT_SYMBOL(spa_get_stats); +EXPORT_SYMBOL(spa_create); +EXPORT_SYMBOL(spa_import); +EXPORT_SYMBOL(spa_tryimport); +EXPORT_SYMBOL(spa_destroy); +EXPORT_SYMBOL(spa_export); +EXPORT_SYMBOL(spa_reset); +EXPORT_SYMBOL(spa_async_request); +EXPORT_SYMBOL(spa_async_suspend); +EXPORT_SYMBOL(spa_async_resume); +EXPORT_SYMBOL(spa_inject_addref); +EXPORT_SYMBOL(spa_inject_delref); + +/* device maniion */ +EXPORT_SYMBOL(spa_vdev_add); +EXPORT_SYMBOL(spa_vdev_attach); +EXPORT_SYMBOL(spa_vdev_detach); +EXPORT_SYMBOL(spa_vdev_remove); +EXPORT_SYMBOL(spa_vdev_setpath); + +/* spare statech is global across all pools) */ +EXPORT_SYMBOL(spa_spare_add); +EXPORT_SYMBOL(spa_spare_remove); +EXPORT_SYMBOL(spa_spare_exists); +EXPORT_SYMBOL(spa_spare_activate); + +/* L2ARC statech is global across all pools) */ +EXPORT_SYMBOL(spa_l2cache_add); +EXPORT_SYMBOL(spa_l2cache_remove); +EXPORT_SYMBOL(spa_l2cache_exists); +EXPORT_SYMBOL(spa_l2cache_activate); +EXPORT_SYMBOL(spa_l2cache_drop); +EXPORT_SYMBOL(spa_l2cache_space_update); + +/* scrubbing */ +EXPORT_SYMBOL(spa_scrub); +EXPORT_SYMBOL(spa_scrub_suspend); +EXPORT_SYMBOL(spa_scrub_resume); +EXPORT_SYMBOL(spa_scrub_restart); + +/* spa syncing */ +EXPORT_SYMBOL(spa_sync); /* only for DMU use */ +EXPORT_SYMBOL(spa_sync_allpools); + +/* properties */ +EXPORT_SYMBOL(spa_prop_set); +EXPORT_SYMBOL(spa_prop_get); +EXPORT_SYMBOL(spa_prop_clear_bootfs); + +#if defined(HAVE_SYSEVENT) +/* asynchronous event notification */ +EXPORT_SYMBOL(spa_event_notify); +#endif + +module_param(zio_taskq_threads, int, 0644); +MODULE_PARM_DESC(zio_taskq_threads, "Number of zio_taskq_threads"); +#endif diff --git a/zfs/lib/libzpool/spa_config.c b/zfs/lib/libzpool/spa_config.c index ee425a9169..58e88f1efd 100644 --- a/zfs/lib/libzpool/spa_config.c +++ b/zfs/lib/libzpool/spa_config.c @@ -442,3 +442,13 @@ spa_config_update_common(spa_t *spa, int what, boolean_t isroot) if (what == SPA_CONFIG_UPDATE_POOL) spa_config_update_common(spa, SPA_CONFIG_UPDATE_VDEVS, isroot); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(spa_config_sync); +EXPORT_SYMBOL(spa_config_check); +EXPORT_SYMBOL(spa_config_load); +EXPORT_SYMBOL(spa_all_configs); +EXPORT_SYMBOL(spa_config_set); +EXPORT_SYMBOL(spa_config_generate); +EXPORT_SYMBOL(spa_config_update); +#endif diff --git a/zfs/lib/libzpool/spa_errlog.c b/zfs/lib/libzpool/spa_errlog.c index c642bd768b..a1d7d5457c 100644 --- a/zfs/lib/libzpool/spa_errlog.c +++ b/zfs/lib/libzpool/spa_errlog.c @@ -435,3 +435,18 @@ spa_errlog_sync(spa_t *spa, uint64_t txg) mutex_exit(&spa->spa_errlog_lock); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +/* error handling */ +EXPORT_SYMBOL(spa_log_error); +EXPORT_SYMBOL(zfs_ereport_post); +EXPORT_SYMBOL(zfs_post_ok); +EXPORT_SYMBOL(zfs_post_remove); +EXPORT_SYMBOL(zfs_post_autoreplace); +EXPORT_SYMBOL(spa_get_errlog_size); +EXPORT_SYMBOL(spa_get_errlog); +EXPORT_SYMBOL(spa_errlog_rotate); +EXPORT_SYMBOL(spa_errlog_drain); +EXPORT_SYMBOL(spa_errlog_sync); +EXPORT_SYMBOL(spa_get_errlists); +#endif diff --git a/zfs/lib/libzpool/spa_history.c b/zfs/lib/libzpool/spa_history.c index 8b422cf8b9..f525edbbbf 100644 --- a/zfs/lib/libzpool/spa_history.c +++ b/zfs/lib/libzpool/spa_history.c @@ -179,7 +179,11 @@ static char * spa_history_zone(void) { #ifdef _KERNEL +#ifdef HAVE_SPL + return ("linux"); +#else return (curproc->p_zone->zone_name); +#endif #else return ("global"); #endif @@ -426,3 +430,11 @@ spa_history_internal_log(history_internal_events_t event, spa_t *spa, } /* spa_history_log_sync() will free hap and str */ } + +#if defined(_KERNEL) && defined(HAVE_SPL) +/* history logging */ +EXPORT_SYMBOL(spa_history_create_obj); +EXPORT_SYMBOL(spa_history_get); +EXPORT_SYMBOL(spa_history_log); +EXPORT_SYMBOL(spa_history_internal_log); +#endif diff --git a/zfs/lib/libzpool/spa_misc.c b/zfs/lib/libzpool/spa_misc.c index e188b2da16..cdc5fb5f96 100644 --- a/zfs/lib/libzpool/spa_misc.c +++ b/zfs/lib/libzpool/spa_misc.c @@ -1408,3 +1408,65 @@ spa_is_root(spa_t *spa) { return (spa->spa_is_root); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +/* Namespace manipulation */ +EXPORT_SYMBOL(spa_lookup); +EXPORT_SYMBOL(spa_add); +EXPORT_SYMBOL(spa_remove); +EXPORT_SYMBOL(spa_next); + +/* Refcount functions */ +EXPORT_SYMBOL(spa_open_ref); +EXPORT_SYMBOL(spa_close); +EXPORT_SYMBOL(spa_refcount_zero); + +/* Pool configuration lock */ +EXPORT_SYMBOL(spa_config_enter); +EXPORT_SYMBOL(spa_config_exit); +EXPORT_SYMBOL(spa_config_held); + +/* Pool vdev add/remove lock */ +EXPORT_SYMBOL(spa_vdev_enter); +EXPORT_SYMBOL(spa_vdev_exit); + +/* Accessor functions */ +EXPORT_SYMBOL(spa_traverse_rwlock); +EXPORT_SYMBOL(spa_traverse_wanted); +EXPORT_SYMBOL(spa_get_dsl); +EXPORT_SYMBOL(spa_get_rootblkptr); +EXPORT_SYMBOL(spa_set_rootblkptr); +EXPORT_SYMBOL(spa_altroot); +EXPORT_SYMBOL(spa_sync_pass); +EXPORT_SYMBOL(spa_name); +EXPORT_SYMBOL(spa_guid); +EXPORT_SYMBOL(spa_last_synced_txg); +EXPORT_SYMBOL(spa_first_txg); +EXPORT_SYMBOL(spa_version); +EXPORT_SYMBOL(spa_state); +EXPORT_SYMBOL(spa_freeze_txg); +EXPORT_SYMBOL(spa_get_alloc); +EXPORT_SYMBOL(spa_get_space); +EXPORT_SYMBOL(spa_get_dspace); +EXPORT_SYMBOL(spa_get_asize); +EXPORT_SYMBOL(spa_max_replication); +EXPORT_SYMBOL(spa_busy); +EXPORT_SYMBOL(spa_get_failmode); + +/* Miscellaneous support routines */ +EXPORT_SYMBOL(spa_rename); +EXPORT_SYMBOL(spa_guid_exists); +EXPORT_SYMBOL(spa_strdup); +EXPORT_SYMBOL(spa_strfree); +EXPORT_SYMBOL(spa_get_random); +EXPORT_SYMBOL(sprintf_blkptr); +EXPORT_SYMBOL(spa_freeze); +EXPORT_SYMBOL(spa_upgrade); +EXPORT_SYMBOL(spa_evict_all); +EXPORT_SYMBOL(spa_lookup_by_guid); +EXPORT_SYMBOL(spa_has_spare); +EXPORT_SYMBOL(bp_get_dasize); +EXPORT_SYMBOL(spa_has_slogs); + +EXPORT_SYMBOL(spa_namespace_lock); +#endif diff --git a/zfs/lib/libzpool/txg.c b/zfs/lib/libzpool/txg.c index b150ebd3cf..c796979255 100644 --- a/zfs/lib/libzpool/txg.c +++ b/zfs/lib/libzpool/txg.c @@ -719,3 +719,7 @@ txg_list_next(txg_list_t *tl, void *p, uint64_t txg) return (tn == NULL ? NULL : (char *)tn - tl->tl_offset); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(txg_wait_synced); +#endif diff --git a/zfs/lib/libzpool/vdev.c b/zfs/lib/libzpool/vdev.c index 140b6ef2db..6f0cf613d6 100644 --- a/zfs/lib/libzpool/vdev.c +++ b/zfs/lib/libzpool/vdev.c @@ -2422,3 +2422,11 @@ vdev_is_bootable(vdev_t *vd) } return (B_TRUE); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(vdev_fault); +EXPORT_SYMBOL(vdev_degrade); +EXPORT_SYMBOL(vdev_online); +EXPORT_SYMBOL(vdev_offline); +EXPORT_SYMBOL(vdev_clear); +#endif diff --git a/zfs/lib/libzpool/vdev_queue.c b/zfs/lib/libzpool/vdev_queue.c index 46fca0e3b6..069c29e9e3 100644 --- a/zfs/lib/libzpool/vdev_queue.c +++ b/zfs/lib/libzpool/vdev_queue.c @@ -306,3 +306,14 @@ vdev_queue_io_done(zio_t *zio) mutex_exit(&vq->vq_lock); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +module_param(zfs_vdev_max_pending, int, 0644); +MODULE_PARM_DESC(zfs_vdev_max_pending, "Maximum pending VDEV IO"); + +module_param(zfs_vdev_min_pending, int, 0644); +MODULE_PARM_DESC(zfs_vdev_min_pending, "Minimum pending VDEV IO"); + +module_param(zfs_vdev_aggregation_limit, int, 0644); +MODULE_PARM_DESC(zfs_vdev_aggregation_limit, "Maximum VDEV IO aggregation"); +#endif diff --git a/zfs/lib/libzpool/zap_micro.c b/zfs/lib/libzpool/zap_micro.c index 02c13120c4..4829195ad3 100644 --- a/zfs/lib/libzpool/zap_micro.c +++ b/zfs/lib/libzpool/zap_micro.c @@ -1106,3 +1106,9 @@ zap_get_stats(objset_t *os, uint64_t zapobj, zap_stats_t *zs) zap_unlockdir(zap); return (0); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(zap_update); +EXPORT_SYMBOL(zap_lookup); +EXPORT_SYMBOL(zap_lookup_norm); +#endif diff --git a/zfs/lib/libzpool/zfs_znode.c b/zfs/lib/libzpool/zfs_znode.c index 4a1820940c..43290897f8 100644 --- a/zfs/lib/libzpool/zfs_znode.c +++ b/zfs/lib/libzpool/zfs_znode.c @@ -1672,3 +1672,8 @@ zfs_obj_to_path(objset_t *osp, uint64_t obj, char *buf, int len) (void) memmove(buf, path, buf + len - path); return (error); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(zfs_create_fs); +EXPORT_SYMBOL(zfs_obj_to_path); +#endif diff --git a/zfs/lib/libzpool/zil.c b/zfs/lib/libzpool/zil.c index 95101882ba..c892db124b 100644 --- a/zfs/lib/libzpool/zil.c +++ b/zfs/lib/libzpool/zil.c @@ -1673,7 +1673,10 @@ zil_replay(objset_t *os, void *arg, uint64_t *txgp, zr.zr_arg = arg; zr.zr_txgp = txgp; zr.zr_byteswap = BP_SHOULD_BYTESWAP(&zh->zh_log); - zr.zr_lrbuf = kmem_alloc(2 * SPA_MAXBLOCKSIZE, KM_SLEEP); + /* XXX: Changed to use vmem_alloc instead of kmem_alloc for + * large allocation size (I think this is safe here). + */ + zr.zr_lrbuf = vmem_alloc(2 * SPA_MAXBLOCKSIZE, KM_SLEEP); /* * Wait for in-progress removes to sync before starting replay. @@ -1685,7 +1688,7 @@ zil_replay(objset_t *os, void *arg, uint64_t *txgp, ASSERT(zilog->zl_replay_blks == 0); (void) zil_parse(zilog, zil_incr_blks, zil_replay_log_record, &zr, zh->zh_claim_txg); - kmem_free(zr.zr_lrbuf, 2 * SPA_MAXBLOCKSIZE); + vmem_free(zr.zr_lrbuf, 2 * SPA_MAXBLOCKSIZE); zil_destroy(zilog, B_FALSE); txg_wait_synced(zilog->zl_dmu_pool, zilog->zl_destroy_txg); diff --git a/zfs/lib/libzpool/zio.c b/zfs/lib/libzpool/zio.c index a20f971c90..495f6e7b65 100644 --- a/zfs/lib/libzpool/zio.c +++ b/zfs/lib/libzpool/zio.c @@ -71,6 +71,7 @@ char *zio_type_name[ZIO_TYPES] = { kmem_cache_t *zio_cache; kmem_cache_t *zio_buf_cache[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]; kmem_cache_t *zio_data_buf_cache[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]; +int zio_bulk_flags = 0; #ifdef _KERNEL extern vmem_t *zio_alloc_arena; @@ -121,12 +122,13 @@ zio_init(void) char name[36]; (void) sprintf(name, "zio_buf_%lu", (ulong_t)size); zio_buf_cache[c] = kmem_cache_create(name, size, - align, NULL, NULL, NULL, NULL, NULL, KMC_NODEBUG); + align, NULL, NULL, NULL, NULL, NULL, + KMC_NODEBUG | zio_bulk_flags); (void) sprintf(name, "zio_data_buf_%lu", (ulong_t)size); zio_data_buf_cache[c] = kmem_cache_create(name, size, align, NULL, NULL, NULL, NULL, data_alloc_arena, - KMC_NODEBUG); + KMC_NODEBUG | zio_bulk_flags); } } @@ -2271,3 +2273,21 @@ static zio_pipe_stage_t *zio_pipeline[ZIO_STAGES] = { zio_checksum_verify, zio_done }; + +#if defined(_KERNEL) && defined(HAVE_SPL) +/* Delegate I/O to a child vdev. */ +EXPORT_SYMBOL(zio_vdev_resume_io); + +/* Fault injection */ +EXPORT_SYMBOL(zio_injection_enabled); +EXPORT_SYMBOL(zio_inject_fault); +EXPORT_SYMBOL(zio_inject_list_next); +EXPORT_SYMBOL(zio_clear_fault); +EXPORT_SYMBOL(zio_priority_table); + +module_param(zio_resume_threads, int, 0644); +MODULE_PARM_DESC(zio_resume_threads, "Number of threads to reissue IO"); + +module_param(zio_bulk_flags, int, 0644); +MODULE_PARM_DESC(zio_bulk_flags, "Additional flags to pass to bulk buffers"); +#endif diff --git a/zfs/lib/libzpool/zu.c b/zfs/lib/libzpool/zu.c new file mode 100644 index 0000000000..31dbf45bf9 --- /dev/null +++ b/zfs/lib/libzpool/zu.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} From a221fd4a0f7b9b99f43379ef9a94c280d7a822f0 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 5 Dec 2008 14:28:05 -0800 Subject: [PATCH 02/35] Moving zu.c build system files to zfs-branch with the rest of the core build system --- zfs/lib/libavl/zu.c | 4 ---- zfs/lib/libnvpair/zu.c | 4 ---- zfs/lib/libumem/zu.c | 4 ---- zfs/lib/libuutil/zu.c | 4 ---- zfs/lib/libzfs/zu.c | 4 ---- zfs/lib/libzpool/zu.c | 4 ---- 6 files changed, 24 deletions(-) delete mode 100644 zfs/lib/libavl/zu.c delete mode 100644 zfs/lib/libnvpair/zu.c delete mode 100644 zfs/lib/libumem/zu.c delete mode 100644 zfs/lib/libuutil/zu.c delete mode 100644 zfs/lib/libzfs/zu.c delete mode 100644 zfs/lib/libzpool/zu.c diff --git a/zfs/lib/libavl/zu.c b/zfs/lib/libavl/zu.c deleted file mode 100644 index 31dbf45bf9..0000000000 --- a/zfs/lib/libavl/zu.c +++ /dev/null @@ -1,4 +0,0 @@ -int main(void) -{ - return 0; -} diff --git a/zfs/lib/libnvpair/zu.c b/zfs/lib/libnvpair/zu.c deleted file mode 100644 index 31dbf45bf9..0000000000 --- a/zfs/lib/libnvpair/zu.c +++ /dev/null @@ -1,4 +0,0 @@ -int main(void) -{ - return 0; -} diff --git a/zfs/lib/libumem/zu.c b/zfs/lib/libumem/zu.c deleted file mode 100644 index 64672cca56..0000000000 --- a/zfs/lib/libumem/zu.c +++ /dev/null @@ -1,4 +0,0 @@ -int main(void) -{ - return 0; -} diff --git a/zfs/lib/libuutil/zu.c b/zfs/lib/libuutil/zu.c deleted file mode 100644 index 64672cca56..0000000000 --- a/zfs/lib/libuutil/zu.c +++ /dev/null @@ -1,4 +0,0 @@ -int main(void) -{ - return 0; -} diff --git a/zfs/lib/libzfs/zu.c b/zfs/lib/libzfs/zu.c deleted file mode 100644 index 64672cca56..0000000000 --- a/zfs/lib/libzfs/zu.c +++ /dev/null @@ -1,4 +0,0 @@ -int main(void) -{ - return 0; -} diff --git a/zfs/lib/libzpool/zu.c b/zfs/lib/libzpool/zu.c deleted file mode 100644 index 31dbf45bf9..0000000000 --- a/zfs/lib/libzpool/zu.c +++ /dev/null @@ -1,4 +0,0 @@ -int main(void) -{ - return 0; -} From 6cc6f50a02ccca8464cf1bdeae3f3c0cf0cc6b08 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 11 Dec 2008 15:21:20 -0800 Subject: [PATCH 03/35] Move to new home --- {zfs/lib/libnvpair => module/nvpair}/nvpair_alloc_spl.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {zfs/lib/libnvpair => module/nvpair}/nvpair_alloc_spl.c (100%) diff --git a/zfs/lib/libnvpair/nvpair_alloc_spl.c b/module/nvpair/nvpair_alloc_spl.c similarity index 100% rename from zfs/lib/libnvpair/nvpair_alloc_spl.c rename to module/nvpair/nvpair_alloc_spl.c From 09de417e20ff2fb3890d75f4f7f415e6007db10c Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 22 Dec 2008 11:01:35 -0800 Subject: [PATCH 04/35] Move #endif up to expose userspace bits --- module/zfs/include/sys/zfs_fuid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/include/sys/zfs_fuid.h b/module/zfs/include/sys/zfs_fuid.h index 41f5846f5c..7ef8dd7a30 100644 --- a/module/zfs/include/sys/zfs_fuid.h +++ b/module/zfs/include/sys/zfs_fuid.h @@ -114,6 +114,7 @@ extern zfs_fuid_info_t *zfs_fuid_info_alloc(void); extern void zfs_fuid_info_free(); extern boolean_t zfs_groupmember(zfsvfs_t *, uint64_t, cred_t *); #endif /* !HAVE_SPL */ +#endif /* _KERNEL */ char *zfs_fuid_idx_domain(avl_tree_t *, uint32_t); uint64_t zfs_fuid_table_load(objset_t *, uint64_t, avl_tree_t *, avl_tree_t *); @@ -122,6 +123,5 @@ void zfs_fuid_table_destroy(avl_tree_t *, avl_tree_t *); #ifdef __cplusplus } #endif -#endif #endif /* _SYS_FS_ZFS_FUID_H */ From 46badfb03b3c328cbcaf734199c1cfe43ea1320f Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 22 Dec 2008 13:33:06 -0800 Subject: [PATCH 05/35] Only allow this for the kernel --- module/zfs/spa_boot.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module/zfs/spa_boot.c b/module/zfs/spa_boot.c index 49e9e50193..920feecb24 100644 --- a/module/zfs/spa_boot.c +++ b/module/zfs/spa_boot.c @@ -24,6 +24,8 @@ * Use is subject to license terms. */ +#ifdef _KERNEL + #pragma ident "%Z%%M% %I% %E% SMI" #include @@ -45,3 +47,5 @@ spa_free_bootprop(char *value) { ddi_prop_free(value); } + +#endif /* _KERNEL */ From 7725fe743116fb93a14d94ec154c1502d100bfe4 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 23 Dec 2008 13:11:03 -0800 Subject: [PATCH 06/35] Remove CPU_SEQID from context, available in SPL. Additionally add module magic for zcommon --- module/zcommon/zfs_prop.c | 18 ++++++++++++++++++ module/zfs/include/sys/zfs_context.h | 2 -- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/module/zcommon/zfs_prop.c b/module/zcommon/zfs_prop.c index fc2ce65810..150d28109a 100644 --- a/module/zcommon/zfs_prop.c +++ b/module/zcommon/zfs_prop.c @@ -514,4 +514,22 @@ EXPORT_SYMBOL(zfs_prop_user); EXPORT_SYMBOL(zfs_prop_index_to_string); EXPORT_SYMBOL(zfs_prop_string_to_index); EXPORT_SYMBOL(zfs_prop_valid_for_type); + +static int __init zcommon_init(void) +{ + return 0; +} + +static void zcommon_fini(void) +{ + return; +} + +module_init(zcommon_init); +module_exit(zcommon_fini); + +MODULE_AUTHOR("Sun Microsystems, Inc"); +MODULE_DESCRIPTION("Generic ZFS support"); +MODULE_LICENSE("CDDL"); + #endif diff --git a/module/zfs/include/sys/zfs_context.h b/module/zfs/include/sys/zfs_context.h index a5be3e1303..effef35ee6 100644 --- a/module/zfs/include/sys/zfs_context.h +++ b/module/zfs/include/sys/zfs_context.h @@ -64,8 +64,6 @@ extern "C" { #include #include -#define CPU_SEQID (CPU->cpu_seqid) - #ifdef __cplusplus } #endif From 0c9de0c356585569d71f31c3b1a785d39f47e9b2 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 5 Jan 2009 13:57:26 -0800 Subject: [PATCH 07/35] Linux kernel modularize unicode --- module/unicode/u8_textprep.c | 23 +++++++++++++++++++++++ module/unicode/uconv.c | 9 +++++++++ 2 files changed, 32 insertions(+) diff --git a/module/unicode/u8_textprep.c b/module/unicode/u8_textprep.c index 8faf1a97e4..72299b51f3 100644 --- a/module/unicode/u8_textprep.c +++ b/module/unicode/u8_textprep.c @@ -2130,3 +2130,26 @@ u8_textprep_str(char *inarray, size_t *inlen, char *outarray, size_t *outlen, return (ret_val); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +static int __init unicode_init(void) +{ + return 0; +} + +static void unicode_fini(void) +{ + return; +} + +module_init(unicode_init); +module_exit(unicode_fini); + +MODULE_AUTHOR("Sun Microsystems, Inc"); +MODULE_DESCRIPTION("Unicode implementation"); +MODULE_LICENSE("CDDL"); + +EXPORT_SYMBOL(u8_validate); +EXPORT_SYMBOL(u8_strcmp); +EXPORT_SYMBOL(u8_textprep_str); +#endif diff --git a/module/unicode/uconv.c b/module/unicode/uconv.c index fd65fc99b5..a9fa9cf33a 100644 --- a/module/unicode/uconv.c +++ b/module/unicode/uconv.c @@ -853,3 +853,12 @@ uconv_u8tou32(const uchar_t *u8s, size_t *utf8len, return (0); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(uconv_u16tou32); +EXPORT_SYMBOL(uconv_u16tou8); +EXPORT_SYMBOL(uconv_u32tou16); +EXPORT_SYMBOL(uconv_u32tou8); +EXPORT_SYMBOL(uconv_u8tou16); +EXPORT_SYMBOL(uconv_u8tou32); +#endif From d8f95977305dbadff6113318259bd46191586721 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 5 Jan 2009 14:12:03 -0800 Subject: [PATCH 08/35] Always include u8_textprep --- module/unicode/u8_textprep.c | 2 +- module/unicode/uconv.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/module/unicode/u8_textprep.c b/module/unicode/u8_textprep.c index 72299b51f3..93b8f0ba65 100644 --- a/module/unicode/u8_textprep.c +++ b/module/unicode/u8_textprep.c @@ -45,11 +45,11 @@ #include #include #else -#include #include #endif /* _KERNEL */ #include #include +#include #include diff --git a/module/unicode/uconv.c b/module/unicode/uconv.c index a9fa9cf33a..e3aee2acab 100644 --- a/module/unicode/uconv.c +++ b/module/unicode/uconv.c @@ -42,11 +42,10 @@ #include #include #include -#else -#include #endif /* _KERNEL */ #include #include +#include /* From eb58273a29e0965ddbf337ca5983b62aaac5a98f Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 5 Jan 2009 15:19:35 -0800 Subject: [PATCH 09/35] Update exported symbol names for new traversal code --- module/zfs/dmu_traverse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/zfs/dmu_traverse.c b/module/zfs/dmu_traverse.c index 5ff30b6424..7a02fe81b7 100644 --- a/module/zfs/dmu_traverse.c +++ b/module/zfs/dmu_traverse.c @@ -409,5 +409,6 @@ traverse_pool(spa_t *spa, blkptr_cb_t func, void *arg) } #if defined(_KERNEL) && defined(HAVE_SPL) -EXPORT_SYMBOL(traverse_dsl_dataset); +EXPORT_SYMBOL(traverse_dataset); +EXPORT_SYMBOL(traverse_pool); #endif From 4c741b2f9dbcce4c72c38bab7501b94786187024 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 5 Jan 2009 15:40:56 -0800 Subject: [PATCH 10/35] Revert changes and resolve include issue by adjusting include path ordering --- module/unicode/u8_textprep.c | 2 +- module/unicode/uconv.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/module/unicode/u8_textprep.c b/module/unicode/u8_textprep.c index 93b8f0ba65..72299b51f3 100644 --- a/module/unicode/u8_textprep.c +++ b/module/unicode/u8_textprep.c @@ -45,11 +45,11 @@ #include #include #else +#include #include #endif /* _KERNEL */ #include #include -#include #include diff --git a/module/unicode/uconv.c b/module/unicode/uconv.c index e3aee2acab..a9fa9cf33a 100644 --- a/module/unicode/uconv.c +++ b/module/unicode/uconv.c @@ -42,10 +42,11 @@ #include #include #include +#else +#include #endif /* _KERNEL */ #include #include -#include /* From 76d40e2e81fc74a89c714b5cc1bdf125fe422d4c Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 5 Jan 2009 15:58:50 -0800 Subject: [PATCH 11/35] Update exported symbols --- module/zfs/dsl_dataset.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c index a98c142c54..8369cec10e 100644 --- a/module/zfs/dsl_dataset.c +++ b/module/zfs/dsl_dataset.c @@ -3106,15 +3106,18 @@ dsl_dataset_set_reservation(const char *dsname, uint64_t reservation) } #if defined(_KERNEL) && defined(HAVE_SPL) -EXPORT_SYMBOL(dsl_dataset_open_spa); -EXPORT_SYMBOL(dsl_dataset_open); -EXPORT_SYMBOL(dsl_dataset_open_obj); +EXPORT_SYMBOL(dsl_dataset_hold); +EXPORT_SYMBOL(dsl_dataset_hold_obj); +EXPORT_SYMBOL(dsl_dataset_own); +EXPORT_SYMBOL(dsl_dataset_own_obj); EXPORT_SYMBOL(dsl_dataset_name); -EXPORT_SYMBOL(dsl_dataset_close); -EXPORT_SYMBOL(dsl_dataset_downgrade); -EXPORT_SYMBOL(dsl_dataset_tryupgrade); -EXPORT_SYMBOL(dsl_dataset_create_sync_impl); +EXPORT_SYMBOL(dsl_dataset_rele); +EXPORT_SYMBOL(dsl_dataset_disown); +EXPORT_SYMBOL(dsl_dataset_drop_ref); +EXPORT_SYMBOL(dsl_dataset_tryown); +EXPORT_SYMBOL(dsl_dataset_make_exclusive); EXPORT_SYMBOL(dsl_dataset_create_sync); +EXPORT_SYMBOL(dsl_dataset_create_sync_dd); EXPORT_SYMBOL(dsl_dataset_destroy); EXPORT_SYMBOL(dsl_snapshots_destroy); EXPORT_SYMBOL(dsl_dataset_destroy_check); @@ -3127,6 +3130,7 @@ EXPORT_SYMBOL(dsl_dataset_promote); EXPORT_SYMBOL(dsl_dataset_clone_swap); EXPORT_SYMBOL(dsl_dataset_set_user_ptr); EXPORT_SYMBOL(dsl_dataset_get_user_ptr); +EXPORT_SYMBOL(dsl_dataset_get_blkptr); EXPORT_SYMBOL(dsl_dataset_set_blkptr); EXPORT_SYMBOL(dsl_dataset_get_spa); EXPORT_SYMBOL(dsl_dataset_modified_since_lastsnap); @@ -3140,10 +3144,11 @@ EXPORT_SYMBOL(dsl_dataset_stats); EXPORT_SYMBOL(dsl_dataset_fast_stat); EXPORT_SYMBOL(dsl_dataset_space); EXPORT_SYMBOL(dsl_dataset_fsid_guid); -EXPORT_SYMBOL(dsl_dataset_create_root); EXPORT_SYMBOL(dsl_dsobj_to_dsname); EXPORT_SYMBOL(dsl_dataset_check_quota); EXPORT_SYMBOL(dsl_dataset_set_quota); EXPORT_SYMBOL(dsl_dataset_set_quota_sync); EXPORT_SYMBOL(dsl_dataset_set_reservation); +EXPORT_SYMBOL(dsl_dataset_set_flags); +EXPORT_SYMBOL(dsl_dataset_new_refreservation); #endif From 90ff5268415f8a897e8da5c5963ab5f380be5abc Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 5 Jan 2009 16:55:15 -0800 Subject: [PATCH 12/35] Remove symbol exports no longer needed with the dsl scrub rewrite --- module/zfs/spa.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/module/zfs/spa.c b/module/zfs/spa.c index 8a288b25f1..0afe877a3b 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -4353,9 +4353,6 @@ EXPORT_SYMBOL(spa_l2cache_space_update); /* scrubbing */ EXPORT_SYMBOL(spa_scrub); -EXPORT_SYMBOL(spa_scrub_suspend); -EXPORT_SYMBOL(spa_scrub_resume); -EXPORT_SYMBOL(spa_scrub_restart); /* spa syncing */ EXPORT_SYMBOL(spa_sync); /* only for DMU use */ From 1c496f0235dcde124f9312bdb045196582defe2d Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 6 Jan 2009 08:59:36 -0800 Subject: [PATCH 13/35] Refresh exported spa_config symbols --- module/zfs/spa_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/spa_config.c b/module/zfs/spa_config.c index 58e88f1efd..a43102cbfe 100644 --- a/module/zfs/spa_config.c +++ b/module/zfs/spa_config.c @@ -445,10 +445,10 @@ spa_config_update_common(spa_t *spa, int what, boolean_t isroot) #if defined(_KERNEL) && defined(HAVE_SPL) EXPORT_SYMBOL(spa_config_sync); -EXPORT_SYMBOL(spa_config_check); EXPORT_SYMBOL(spa_config_load); EXPORT_SYMBOL(spa_all_configs); EXPORT_SYMBOL(spa_config_set); EXPORT_SYMBOL(spa_config_generate); EXPORT_SYMBOL(spa_config_update); +EXPORT_SYMBOL(spa_config_update_common); #endif From d71643eb940abcd9fa60f63173a40ffc50e484e7 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 6 Jan 2009 09:14:10 -0800 Subject: [PATCH 14/35] Refresh exported symbols --- module/zfs/spa_errlog.c | 1 - module/zfs/spa_misc.c | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/module/zfs/spa_errlog.c b/module/zfs/spa_errlog.c index a1d7d5457c..68592c42be 100644 --- a/module/zfs/spa_errlog.c +++ b/module/zfs/spa_errlog.c @@ -440,7 +440,6 @@ spa_errlog_sync(spa_t *spa, uint64_t txg) /* error handling */ EXPORT_SYMBOL(spa_log_error); EXPORT_SYMBOL(zfs_ereport_post); -EXPORT_SYMBOL(zfs_post_ok); EXPORT_SYMBOL(zfs_post_remove); EXPORT_SYMBOL(zfs_post_autoreplace); EXPORT_SYMBOL(spa_get_errlog_size); diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c index 032cb7cc74..187dd53e02 100644 --- a/module/zfs/spa_misc.c +++ b/module/zfs/spa_misc.c @@ -1432,6 +1432,7 @@ EXPORT_SYMBOL(spa_close); EXPORT_SYMBOL(spa_refcount_zero); /* Pool configuration lock */ +EXPORT_SYMBOL(spa_config_tryenter); EXPORT_SYMBOL(spa_config_enter); EXPORT_SYMBOL(spa_config_exit); EXPORT_SYMBOL(spa_config_held); @@ -1440,9 +1441,12 @@ EXPORT_SYMBOL(spa_config_held); EXPORT_SYMBOL(spa_vdev_enter); EXPORT_SYMBOL(spa_vdev_exit); +/* Pool vdev state change lock */ +EXPORT_SYMBOL(spa_vdev_state_enter); +EXPORT_SYMBOL(spa_vdev_state_exit); + /* Accessor functions */ -EXPORT_SYMBOL(spa_traverse_rwlock); -EXPORT_SYMBOL(spa_traverse_wanted); +EXPORT_SYMBOL(spa_shutting_down); EXPORT_SYMBOL(spa_get_dsl); EXPORT_SYMBOL(spa_get_rootblkptr); EXPORT_SYMBOL(spa_set_rootblkptr); @@ -1462,6 +1466,7 @@ EXPORT_SYMBOL(spa_get_asize); EXPORT_SYMBOL(spa_max_replication); EXPORT_SYMBOL(spa_busy); EXPORT_SYMBOL(spa_get_failmode); +EXPORT_SYMBOL(spa_suspended); /* Miscellaneous support routines */ EXPORT_SYMBOL(spa_rename); @@ -1477,6 +1482,7 @@ EXPORT_SYMBOL(spa_lookup_by_guid); EXPORT_SYMBOL(spa_has_spare); EXPORT_SYMBOL(bp_get_dasize); EXPORT_SYMBOL(spa_has_slogs); +EXPORT_SYMBOL(spa_is_root); EXPORT_SYMBOL(spa_namespace_lock); #endif From da647d38a3bdbfc15dbb1ff181e967457e96dc45 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 6 Jan 2009 09:38:39 -0800 Subject: [PATCH 15/35] Refresh exported symbols, remove zio_resume_threads as out of date --- module/zfs/zio.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/module/zfs/zio.c b/module/zfs/zio.c index 792d7a6464..8d98e73f3f 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -2284,18 +2284,16 @@ static zio_pipe_stage_t *zio_pipeline[ZIO_STAGES] = { }; #if defined(_KERNEL) && defined(HAVE_SPL) -/* Delegate I/O to a child vdev. */ -EXPORT_SYMBOL(zio_vdev_resume_io); - /* Fault injection */ EXPORT_SYMBOL(zio_injection_enabled); EXPORT_SYMBOL(zio_inject_fault); EXPORT_SYMBOL(zio_inject_list_next); EXPORT_SYMBOL(zio_clear_fault); +EXPORT_SYMBOL(zio_handle_fault_injection); +EXPORT_SYMBOL(zio_handle_device_injection); +EXPORT_SYMBOL(zio_handle_label_injection); EXPORT_SYMBOL(zio_priority_table); - -module_param(zio_resume_threads, int, 0644); -MODULE_PARM_DESC(zio_resume_threads, "Number of threads to reissue IO"); +EXPORT_SYMBOL(zio_type_name); module_param(zio_bulk_flags, int, 0644); MODULE_PARM_DESC(zio_bulk_flags, "Additional flags to pass to bulk buffers"); From 57aad95a520385d3776581f9ae95c664bad172be Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 6 Jan 2009 12:59:50 -0800 Subject: [PATCH 16/35] Refresh exported symbols --- module/zfs/dmu.c | 1 - module/zfs/dsl_dataset.c | 2 -- module/zfs/zfs_byteswap.c | 6 ++++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c index 1d56ec5147..e7485efa93 100644 --- a/module/zfs/dmu.c +++ b/module/zfs/dmu.c @@ -1241,7 +1241,6 @@ EXPORT_SYMBOL(dmu_object_size_from_db); EXPORT_SYMBOL(dmu_object_set_blocksize); EXPORT_SYMBOL(dmu_object_set_checksum); EXPORT_SYMBOL(dmu_object_set_compress); -EXPORT_SYMBOL(dmu_get_replication_level); EXPORT_SYMBOL(dmu_ot); #endif diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c index 8369cec10e..3ee7eac129 100644 --- a/module/zfs/dsl_dataset.c +++ b/module/zfs/dsl_dataset.c @@ -3149,6 +3149,4 @@ EXPORT_SYMBOL(dsl_dataset_check_quota); EXPORT_SYMBOL(dsl_dataset_set_quota); EXPORT_SYMBOL(dsl_dataset_set_quota_sync); EXPORT_SYMBOL(dsl_dataset_set_reservation); -EXPORT_SYMBOL(dsl_dataset_set_flags); -EXPORT_SYMBOL(dsl_dataset_new_refreservation); #endif diff --git a/module/zfs/zfs_byteswap.c b/module/zfs/zfs_byteswap.c index 177ff552c0..e1c64022dc 100644 --- a/module/zfs/zfs_byteswap.c +++ b/module/zfs/zfs_byteswap.c @@ -173,3 +173,9 @@ zfs_znode_byteswap(void *buf, size_t size) zfs_oldace_byteswap((ace_t *)&zp->zp_acl.z_ace_data[0], ACE_SLOT_CNT); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(zfs_oldacl_byteswap); +EXPORT_SYMBOL(zfs_acl_byteswap); +EXPORT_SYMBOL(zfs_znode_byteswap); +#endif From dd50143ea1df2efc583755ddc74dfb1967be92c7 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 9 Jan 2009 11:21:59 -0800 Subject: [PATCH 17/35] Add module load/unload entry point hooks and ioctl integration --- module/zfs/zfs_ioctl.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index b77ee4da38..b10033fd15 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -3101,15 +3101,27 @@ static struct dev_ops zfs_dev_ops = { }; static struct modldrv zfs_modldrv = { +#ifdef HAVE_SPL + NULL, +#else &mod_driverops, +#endif /* HAVE_SPL */ "ZFS storage pool", &zfs_dev_ops }; static struct modlinkage modlinkage = { MODREV_1, +#ifdef HAVE_ZPL (void *)&zfs_modlfs, +#else + NULL, +#endif /* HAVE_ZPL */ (void *)&zfs_modldrv, +#ifdef HAVE_SPL + ZFS_MAJOR, + ZFS_MINORS, +#endif /* HAVE_SPL */ NULL }; @@ -3172,8 +3184,17 @@ _fini(void) return (error); } +#ifdef HAVE_SPL +module_init(_init); +module_exit(_fini); + +MODULE_AUTHOR("Sun Microsystems, Inc"); +MODULE_DESCRIPTION("ZFS"); +MODULE_LICENSE("CDDL"); +#else int _info(struct modinfo *modinfop) { return (mod_info(&modlinkage, modinfop)); } +#endif /* HAVE_SPL */ From f0f1f7362d72b7fb51adaba60e961626ee54b8a1 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 9 Jan 2009 11:42:31 -0800 Subject: [PATCH 18/35] Remove invalid tunable --- module/zfs/spa.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/module/zfs/spa.c b/module/zfs/spa.c index 0afe877a3b..7b73dcb392 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -4367,7 +4367,4 @@ EXPORT_SYMBOL(spa_prop_clear_bootfs); /* asynchronous event notification */ EXPORT_SYMBOL(spa_event_notify); #endif - -module_param(zio_taskq_threads, int, 0644); -MODULE_PARM_DESC(zio_taskq_threads, "Number of zio_taskq_threads"); #endif From 68585e71a85811a95b94fac1ef45d7e26ae4c91a Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 9 Jan 2009 13:28:42 -0800 Subject: [PATCH 19/35] Get correct exit prototype --- module/zfs/zfs_ioctl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index 919dc65f04..8d6dbf7b8b 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -3181,8 +3181,14 @@ _fini(void) } #ifdef HAVE_SPL +void +__fini(void) +{ + _fini(); +} + module_init(_init); -module_exit(_fini); +module_exit(__fini); MODULE_AUTHOR("Sun Microsystems, Inc"); MODULE_DESCRIPTION("ZFS"); From 1dc5e6d02e9439279eb0442c87b934bce9e04bf9 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 9 Jan 2009 15:50:00 -0800 Subject: [PATCH 20/35] Remove HAVE_SPL should be HAVE_ZPL --- module/zfs/include/sys/zfs_fuid.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/module/zfs/include/sys/zfs_fuid.h b/module/zfs/include/sys/zfs_fuid.h index 7ef8dd7a30..810ffc81a8 100644 --- a/module/zfs/include/sys/zfs_fuid.h +++ b/module/zfs/include/sys/zfs_fuid.h @@ -100,7 +100,6 @@ typedef struct zfs_fuid_info { } zfs_fuid_info_t; #ifdef _KERNEL -#ifndef HAVE_SPL struct znode; extern uid_t zfs_fuid_map_id(zfsvfs_t *, uint64_t, cred_t *, zfs_fuid_type_t); extern void zfs_fuid_destroy(zfsvfs_t *); @@ -113,8 +112,7 @@ extern void zfs_fuid_map_ids(struct znode *zp, cred_t *cr, uid_t *uid, extern zfs_fuid_info_t *zfs_fuid_info_alloc(void); extern void zfs_fuid_info_free(); extern boolean_t zfs_groupmember(zfsvfs_t *, uint64_t, cred_t *); -#endif /* !HAVE_SPL */ -#endif /* _KERNEL */ +#endif char *zfs_fuid_idx_domain(avl_tree_t *, uint32_t); uint64_t zfs_fuid_table_load(objset_t *, uint64_t, avl_tree_t *, avl_tree_t *); From d9a45283ce567c3d6659904734f0b831e9d47b16 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 9 Jan 2009 16:28:26 -0800 Subject: [PATCH 21/35] Add ZFS load/unload console messages --- module/zfs/zfs_ioctl.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index f23e3c38ef..e42513365a 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -3181,13 +3181,26 @@ _fini(void) } #ifdef HAVE_SPL +int +__init(void) +{ + int rc; + + rc = _init(); + if (!rc) + printk(KERN_INFO "ZFS: Loaded v%s\n", VERSION); + + return rc; +} + void __fini(void) { - _fini(); + (void)_fini(); + printk(KERN_INFO "ZFS: Unloaded v%s\n", VERSION); } -module_init(_init); +module_init(__init); module_exit(__fini); MODULE_AUTHOR("Sun Microsystems, Inc"); From 7001fd57faa629d29fb5ae538c245296c7eb046e Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 9 Jan 2009 16:38:13 -0800 Subject: [PATCH 22/35] Register sensible init/fini hooks --- module/zfs/zfs_ioctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index e42513365a..f4bfc90831 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -3182,7 +3182,7 @@ _fini(void) #ifdef HAVE_SPL int -__init(void) +init(void) { int rc; @@ -3194,14 +3194,14 @@ __init(void) } void -__fini(void) +fini(void) { (void)_fini(); printk(KERN_INFO "ZFS: Unloaded v%s\n", VERSION); } -module_init(__init); -module_exit(__fini); +module_init(init); +module_exit(fini); MODULE_AUTHOR("Sun Microsystems, Inc"); MODULE_DESCRIPTION("ZFS"); From e22bfeab4e35c3457abf0d17d8b44b64b331deb3 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 9 Jan 2009 16:50:08 -0800 Subject: [PATCH 23/35] Update load/unload message, mknod /dev/zfs when udev is unavailable --- lib/libzfs/libzfs_util.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 22e3d0aa16..c377d51504 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -560,6 +560,12 @@ libzfs_init(void) return (NULL); } +#if defined(HAVE_SPL) && !defined(HAVE_GPL_ONLY_SYMBOLS) + /* If we don't have access to GPL-only symbols then we may not + * use the udev APIs, therefore we must mknod the device ourselves. */ + (void)mknod(ZFS_DEV, S_IFCHR | 0600, makedev(ZFS_MAJOR, 0)); +#endif + if ((hdl->libzfs_fd = open(ZFS_DEV, O_RDWR)) < 0) { free(hdl); return (NULL); From 3977cefecced68d7d76177b92db6f2a9760cca52 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 9 Jan 2009 16:50:28 -0800 Subject: [PATCH 24/35] Update load/unload message, mknod /dev/zfs when udev is unavailable --- module/zfs/zfs_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index f4bfc90831..c582cc8eff 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -3188,7 +3188,7 @@ init(void) rc = _init(); if (!rc) - printk(KERN_INFO "ZFS: Loaded v%s\n", VERSION); + printk(KERN_INFO "ZFS: Loaded ZFS Filesystem v%s\n", VERSION); return rc; } @@ -3197,7 +3197,7 @@ void fini(void) { (void)_fini(); - printk(KERN_INFO "ZFS: Unloaded v%s\n", VERSION); + printk(KERN_INFO "ZFS: Unloaded ZFS Filesystem v%s\n", VERSION); } module_init(init); From ef6d827a88d9c4afe93b28d80a7a2bfbadd258c6 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 13 Jan 2009 09:53:35 -0800 Subject: [PATCH 25/35] Don't check HAVE_SPL unavailable in userspace build --- lib/libzfs/libzfs_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index c377d51504..605c91a4ce 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -560,7 +560,7 @@ libzfs_init(void) return (NULL); } -#if defined(HAVE_SPL) && !defined(HAVE_GPL_ONLY_SYMBOLS) +#if !defined(HAVE_GPL_ONLY_SYMBOLS) /* If we don't have access to GPL-only symbols then we may not * use the udev APIs, therefore we must mknod the device ourselves. */ (void)mknod(ZFS_DEV, S_IFCHR | 0600, makedev(ZFS_MAJOR, 0)); From 5a36a4b40b2e80e8e9e0e57d837e8aa7e69ad3e9 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 13 Jan 2009 12:28:26 -0800 Subject: [PATCH 26/35] Pull in needed hunk from old patch stack for a ZFS build without the ZPL support --- module/zfs/spa.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/module/zfs/spa.c b/module/zfs/spa.c index 7b73dcb392..d38bf1760b 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -60,6 +60,7 @@ #include #include #include +#include #include "zfs_prop.h" #include "zfs_comutil.h" @@ -2087,6 +2088,44 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props, spa->spa_minref = refcount_count(&spa->spa_refcount); +#if defined(_KERNEL) && !defined(HAVE_ZPL) + { + objset_t *os; + nvlist_t *zprops; + + /* + * Create the pool's root filesystem. + */ + error = dmu_objset_open(pool, DMU_OST_ZFS, DS_MODE_OWNER, &os); + if (error != 0) + return (error); + + tx = dmu_tx_create(os); + + dmu_tx_hold_zap(tx, DMU_NEW_OBJECT, TRUE, NULL); /* master */ + dmu_tx_hold_zap(tx, DMU_NEW_OBJECT, TRUE, NULL); /* del queue */ + dmu_tx_hold_bonus(tx, DMU_NEW_OBJECT); /* root node */ + + error = dmu_tx_assign(tx, TXG_WAIT); + ASSERT3U(error, ==, 0); + + if (spa_version(dmu_objset_spa(os)) >= SPA_VERSION_FUID) + version = ZPL_VERSION; + else + version = MIN(ZPL_VERSION, ZPL_VERSION_FUID - 1); + + VERIFY(nvlist_alloc(&zprops, NV_UNIQUE_NAME, KM_SLEEP) == 0); + VERIFY(nvlist_add_uint64(zprops, zfs_prop_to_name(ZFS_PROP_VERSION), + version) == 0); + + zfs_create_fs(os, CRED(), zprops, tx); + nvlist_free(zprops); + + dmu_tx_commit(tx); + dmu_objset_close(os); + } +#endif + return (0); } From f63f4dd2cd20e7785e474bad518696ca920e94f7 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 14 Jan 2009 08:26:09 -0800 Subject: [PATCH 27/35] Remove unneeded chunk, create a FS the real way with an ioctl --- module/zfs/spa.c | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/module/zfs/spa.c b/module/zfs/spa.c index d38bf1760b..f4e4021977 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -2088,44 +2088,6 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props, spa->spa_minref = refcount_count(&spa->spa_refcount); -#if defined(_KERNEL) && !defined(HAVE_ZPL) - { - objset_t *os; - nvlist_t *zprops; - - /* - * Create the pool's root filesystem. - */ - error = dmu_objset_open(pool, DMU_OST_ZFS, DS_MODE_OWNER, &os); - if (error != 0) - return (error); - - tx = dmu_tx_create(os); - - dmu_tx_hold_zap(tx, DMU_NEW_OBJECT, TRUE, NULL); /* master */ - dmu_tx_hold_zap(tx, DMU_NEW_OBJECT, TRUE, NULL); /* del queue */ - dmu_tx_hold_bonus(tx, DMU_NEW_OBJECT); /* root node */ - - error = dmu_tx_assign(tx, TXG_WAIT); - ASSERT3U(error, ==, 0); - - if (spa_version(dmu_objset_spa(os)) >= SPA_VERSION_FUID) - version = ZPL_VERSION; - else - version = MIN(ZPL_VERSION, ZPL_VERSION_FUID - 1); - - VERIFY(nvlist_alloc(&zprops, NV_UNIQUE_NAME, KM_SLEEP) == 0); - VERIFY(nvlist_add_uint64(zprops, zfs_prop_to_name(ZFS_PROP_VERSION), - version) == 0); - - zfs_create_fs(os, CRED(), zprops, tx); - nvlist_free(zprops); - - dmu_tx_commit(tx); - dmu_objset_close(os); - } -#endif - return (0); } From c0edd1f94800d3513cc86cbfb5d5dd99646b3796 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 14 Jan 2009 13:30:32 -0800 Subject: [PATCH 28/35] Remove unneeded header --- module/zfs/spa.c | 1 - 1 file changed, 1 deletion(-) diff --git a/module/zfs/spa.c b/module/zfs/spa.c index f4e4021977..7b73dcb392 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -60,7 +60,6 @@ #include #include #include -#include #include "zfs_prop.h" #include "zfs_comutil.h" From 4fdb04d0a1ac0d298d2d6c1147c3dbd6bd85a450 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 14 Jan 2009 14:25:25 -0800 Subject: [PATCH 29/35] A little hackery to handle using zdb when the module stack isn't loaded. This is a hack and should be addressed upstream, zdb should not be attempting to initialize services it doesn't need --- lib/libzfs/libzfs_util.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 605c91a4ce..1a1025f3bf 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -567,8 +567,16 @@ libzfs_init(void) #endif if ((hdl->libzfs_fd = open(ZFS_DEV, O_RDWR)) < 0) { - free(hdl); - return (NULL); + /* XXX: Allow this failure on linux systems for now. It + * occurs when we attempt to open the /dev/zfs without the + * ZFS module stack loaded. This is normally a problem but + * tools such as zdb call this function and never use the + * ioctl() interface. Long term this should be cleaned up. + */ + if (errno != ENXIO) { + free(hdl); + return (NULL); + } } if ((hdl->libzfs_mnttab = fopen(MNTTAB, "r")) == NULL) { @@ -588,7 +596,8 @@ libzfs_init(void) void libzfs_fini(libzfs_handle_t *hdl) { - (void) close(hdl->libzfs_fd); + if (hdl->libzfs_fd != -1) + (void) close(hdl->libzfs_fd); if (hdl->libzfs_mnttab) (void) fclose(hdl->libzfs_mnttab); if (hdl->libzfs_sharetab) From 9cd029b5433fcd50f7c5ff2e29d70218b25cdac0 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 3 Feb 2009 09:38:53 -0800 Subject: [PATCH 30/35] Remove mknod from library. This is all nowhandled in the SPL. When HAVE_GPL_ONLY_SYMBOLS is defined because the module license is set to GPL we can leverage the udev interfaces which will create the device. When HAVE_GPL_ONLY_SYMBOLS is not defined we resort to an ugly hack and the SPL invokes a usermode helper to create to missing device file for us in /dev/. Using GPL version modules is off course preperable when possible. --- lib/libzfs/libzfs_util.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index b5eb285cc1..221d97f88d 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -560,12 +560,6 @@ libzfs_init(void) return (NULL); } -#if !defined(HAVE_GPL_ONLY_SYMBOLS) - /* If we don't have access to GPL-only symbols then we may not - * use the udev APIs, therefore we must mknod the device ourselves. */ - (void)mknod(ZFS_DEV, S_IFCHR | 0600, makedev(ZFS_MAJOR, 0)); -#endif - if ((hdl->libzfs_fd = open(ZFS_DEV, O_RDWR)) < 0) { /* XXX: Allow this failure on linux systems for now. It * occurs when we attempt to open the /dev/zfs without the From 86801389684056eda3bbad669976ebf2f8c39326 Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Wed, 11 Mar 2009 06:24:27 +0000 Subject: [PATCH 31/35] Add missing EXPORT_SYMBOL() macro. ZFS consumers such as Lustre should have access to these symbols. --- module/zfs/dmu_objset.c | 1 + module/zfs/dmu_tx.c | 1 + module/zfs/zap_micro.c | 12 +++++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/module/zfs/dmu_objset.c b/module/zfs/dmu_objset.c index 8e26eaa348..a3909f553e 100644 --- a/module/zfs/dmu_objset.c +++ b/module/zfs/dmu_objset.c @@ -1295,4 +1295,5 @@ EXPORT_SYMBOL(dmu_objset_byteswap); /* Get stats on a dataset. */ EXPORT_SYMBOL(dmu_objset_fast_stat); EXPORT_SYMBOL(dmu_objset_stats); +EXPORT_SYMBOL(dmu_objset_space); #endif diff --git a/module/zfs/dmu_tx.c b/module/zfs/dmu_tx.c index bf8fdd4dbd..1cb3e8c7b5 100644 --- a/module/zfs/dmu_tx.c +++ b/module/zfs/dmu_tx.c @@ -1077,4 +1077,5 @@ EXPORT_SYMBOL(dmu_tx_abort); EXPORT_SYMBOL(dmu_tx_assign); EXPORT_SYMBOL(dmu_tx_wait); EXPORT_SYMBOL(dmu_tx_commit); +EXPORT_SYMBOL(dmu_tx_get_txg); #endif diff --git a/module/zfs/zap_micro.c b/module/zfs/zap_micro.c index 9c77d0d7f5..66dcf4710e 100644 --- a/module/zfs/zap_micro.c +++ b/module/zfs/zap_micro.c @@ -1108,7 +1108,17 @@ zap_get_stats(objset_t *os, uint64_t zapobj, zap_stats_t *zs) } #if defined(_KERNEL) && defined(HAVE_SPL) -EXPORT_SYMBOL(zap_update); +EXPORT_SYMBOL(zap_add); +EXPORT_SYMBOL(zap_create); +EXPORT_SYMBOL(zap_cursor_advance); +EXPORT_SYMBOL(zap_cursor_fini); +EXPORT_SYMBOL(zap_cursor_init); +EXPORT_SYMBOL(zap_cursor_init_serialized); +EXPORT_SYMBOL(zap_cursor_move_to_key); +EXPORT_SYMBOL(zap_cursor_retrieve); +EXPORT_SYMBOL(zap_cursor_serialize); EXPORT_SYMBOL(zap_lookup); EXPORT_SYMBOL(zap_lookup_norm); +EXPORT_SYMBOL(zap_remove); +EXPORT_SYMBOL(zap_update); #endif From a9b0088f48ddeded6c08c1eb30eac296d8a2194c Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 17 Mar 2009 16:02:09 -0700 Subject: [PATCH 32/35] Use include missing zfs_config.h and use ZFS_META_VERSION (not VERSION) --- module/zfs/zfs_ioctl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index 832e0652cd..50563b5bf8 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -67,6 +67,7 @@ #include "zfs_namecheck.h" #include "zfs_prop.h" #include "zfs_deleg.h" +#include "zfs_config.h" extern struct modlfs zfs_modlfs; @@ -3233,7 +3234,8 @@ init(void) rc = _init(); if (!rc) - printk(KERN_INFO "ZFS: Loaded ZFS Filesystem v%s\n", VERSION); + printk(KERN_INFO "ZFS: Loaded ZFS Filesystem v%s\n", + ZFS_META_VERSION); return rc; } @@ -3242,7 +3244,8 @@ void fini(void) { (void)_fini(); - printk(KERN_INFO "ZFS: Unloaded ZFS Filesystem v%s\n", VERSION); + printk(KERN_INFO "ZFS: Unloaded ZFS Filesystem v%s\n", + ZFS_META_VERSION); } module_init(init); From cc4fbf2c35068c395a0ae896be25eff253b94bc5 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 18 Mar 2009 12:48:54 -0700 Subject: [PATCH 33/35] Revert to previous behavior zdb fails when unable to open /dev/zfs. For the moment I have added an error message to the failure path to make it clear what happened. I have also changed the zdb ASSERT to a VERIFY so we always catch the failure. For now we will just always ensure the module stack is loaded, longer term we need something a little more flexible. --- cmd/zdb/zdb.c | 2 +- lib/libzfs/libzfs_util.c | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index fb9c4be6f0..5aa9426e19 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -2330,7 +2330,7 @@ main(int argc, char **argv) kernel_init(FREAD); g_zfs = libzfs_init(); - ASSERT(g_zfs != NULL); + VERIFY(g_zfs != NULL); for (c = 0; c < 256; c++) { if (dump_all && c != 'l' && c != 'R') diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index e81a9535b2..1a2ee256f7 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -560,16 +560,10 @@ libzfs_init(void) } if ((hdl->libzfs_fd = open(ZFS_DEV, O_RDWR)) < 0) { - /* XXX: Allow this failure on linux systems for now. It - * occurs when we attempt to open the /dev/zfs without the - * ZFS module stack loaded. This is normally a problem but - * tools such as zdb call this function and never use the - * ioctl() interface. Long term this should be cleaned up. - */ - if (errno != ENXIO) { - free(hdl); - return (NULL); - } + (void) fprintf(stderr, "Unable to open %s: (%d) %s\n", + ZFS_DEV, errno, strerror(errno)); + free(hdl); + return (NULL); } if ((hdl->libzfs_mnttab = fopen(MNTTAB, "r")) == NULL) { @@ -589,8 +583,7 @@ libzfs_init(void) void libzfs_fini(libzfs_handle_t *hdl) { - if (hdl->libzfs_fd != -1) - (void) close(hdl->libzfs_fd); + (void) close(hdl->libzfs_fd); if (hdl->libzfs_mnttab) (void) fclose(hdl->libzfs_mnttab); if (hdl->libzfs_sharetab) From 9bee47e64898324fd92c21286d3f37ca800a4fc0 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 20 Mar 2009 13:17:23 -0700 Subject: [PATCH 34/35] Export additional txg_* symbols. --- module/zfs/txg.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/module/zfs/txg.c b/module/zfs/txg.c index 629f55ab0e..a34a5cfedd 100644 --- a/module/zfs/txg.c +++ b/module/zfs/txg.c @@ -733,5 +733,19 @@ txg_list_next(txg_list_t *tl, void *p, uint64_t txg) } #if defined(_KERNEL) && defined(HAVE_SPL) +EXPORT_SYMBOL(txg_init); +EXPORT_SYMBOL(txg_fini); +EXPORT_SYMBOL(txg_sync_start); +EXPORT_SYMBOL(txg_sync_stop); +EXPORT_SYMBOL(txg_hold_open); +EXPORT_SYMBOL(txg_rele_to_quiesce); +EXPORT_SYMBOL(txg_rele_to_sync); +EXPORT_SYMBOL(txg_register_callbacks); +EXPORT_SYMBOL(txg_suspend); +EXPORT_SYMBOL(txg_resume); +EXPORT_SYMBOL(txg_delay); EXPORT_SYMBOL(txg_wait_synced); +EXPORT_SYMBOL(txg_wait_open); +EXPORT_SYMBOL(txg_stalled); +EXPORT_SYMBOL(txg_sync_waiting); #endif From 96da8b0db73c0ef248e49218601b1543f2a2ee3b Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 8 Jun 2009 13:08:14 -0700 Subject: [PATCH 35/35] Add missing EXPORT_SYMBOL() to dmu_tx_callback_register(). --- module/zfs/dmu_tx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/module/zfs/dmu_tx.c b/module/zfs/dmu_tx.c index fb34930ea9..7c26d1ddf9 100644 --- a/module/zfs/dmu_tx.c +++ b/module/zfs/dmu_tx.c @@ -1121,4 +1121,5 @@ EXPORT_SYMBOL(dmu_tx_assign); EXPORT_SYMBOL(dmu_tx_wait); EXPORT_SYMBOL(dmu_tx_commit); EXPORT_SYMBOL(dmu_tx_get_txg); +EXPORT_SYMBOL(dmu_tx_callback_register); #endif