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/spa.h b/zfs/lib/libzpool/include/sys/spa.h index 1029b38294..af6ed0de35 100644 --- a/zfs/lib/libzpool/include/sys/spa.h +++ b/zfs/lib/libzpool/include/sys/spa.h @@ -530,7 +530,11 @@ extern int spa_prop_get(spa_t *spa, nvlist_t **nvp); extern void spa_prop_clear_bootfs(spa_t *spa, uint64_t obj, dmu_tx_t *tx); /* asynchronous event notification */ +#ifdef HAVE_SYSEVENT extern void spa_event_notify(spa_t *spa, vdev_t *vdev, const char *name); +#else +#define spa_event_notify(s,v,n) ((void)0) +#endif #ifdef ZFS_DEBUG #define dprintf_bp(bp, fmt, ...) do { \ 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..8af62acf73 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) @@ -4251,10 +4252,10 @@ spa_has_active_shared_spare(spa_t *spa) * in the userland libzpool, as we don't want consumers to misinterpret ztest * or zdb as real changes. */ +#ifdef HAVE_SYSEVENT void spa_event_notify(spa_t *spa, vdev_t *vd, const char *name) { -#ifdef _KERNEL sysevent_t *ev; sysevent_attr_list_t *attr = NULL; sysevent_value_t value; @@ -4299,5 +4300,66 @@ done: if (attr) sysevent_free_attr(attr); sysevent_free(ev); -#endif } +#endif /* HAVE_SYSEVENT */ + +#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 2e5d3e2ee7..85087c586a 100644 --- a/zfs/lib/libzpool/spa_misc.c +++ b/zfs/lib/libzpool/spa_misc.c @@ -1413,3 +1413,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; +}