diff options
author | mm <mm@FreeBSD.org> | 2013-03-19 12:51:18 +0000 |
---|---|---|
committer | mm <mm@FreeBSD.org> | 2013-03-19 12:51:18 +0000 |
commit | 7c87858955593be19a80e57b7353b09f5587ae9b (patch) | |
tree | 68fb8eac18f4259926de9bd4d4ecba5b46b638c3 /cddl/contrib/opensolaris/lib/libzpool | |
parent | c94cc27299ba2ab2acf00ca31ec90c92a37b16f7 (diff) | |
parent | 09a831de87c71a9f94f38dbd36b73746467e3182 (diff) | |
download | FreeBSD-src-7c87858955593be19a80e57b7353b09f5587ae9b.zip FreeBSD-src-7c87858955593be19a80e57b7353b09f5587ae9b.tar.gz |
MFV r247580:
Merge synctask code restructuring from vendor.
Modify forward and backward compatibility to support new change.
Illumos ZFS issues:
3464 zfs synctask code needs restructuring
Sponsored by: Hybrid Logic Ltd.
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libzpool')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzpool/common/kernel.c | 5 | ||||
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h | 15 |
2 files changed, 19 insertions, 1 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c b/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c index 4f31b46..c5c7b66 100644 --- a/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c +++ b/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c @@ -33,6 +33,7 @@ #include <sys/stat.h> #include <sys/processor.h> #include <sys/zfs_context.h> +#include <sys/rrwlock.h> #include <sys/zmod.h> #include <sys/utsname.h> #include <sys/systeminfo.h> @@ -885,6 +886,8 @@ umem_out_of_memory(void) void kernel_init(int mode) { + extern uint_t rrw_tsd_key; + umem_nofail_callback(umem_out_of_memory); physmem = sysconf(_SC_PHYS_PAGES); @@ -905,6 +908,8 @@ kernel_init(int mode) #endif spa_init(mode); + + tsd_create(&rrw_tsd_key, rrw_tsd_destroy); } void diff --git a/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h b/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h index f828ae0..f026fb3 100644 --- a/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h +++ b/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h @@ -60,6 +60,8 @@ extern "C" { #include <umem.h> #include <inttypes.h> #include <fsshare.h> +#include <pthread.h> +#include <sys/debug.h> #include <sys/note.h> #include <sys/types.h> #include <sys/cred.h> @@ -242,6 +244,9 @@ typedef int krw_t; #define RW_WRITE_HELD(x) ((x)->rw_owner == curthread) #define RW_LOCK_HELD(x) rw_lock_held(x) +#undef RW_LOCK_HELD +#define RW_LOCK_HELD(x) (RW_READ_HELD(x) || RW_WRITE_HELD(x)) + extern void rw_init(krwlock_t *rwlp, char *name, int type, void *arg); extern void rw_destroy(krwlock_t *rwlp); extern void rw_enter(krwlock_t *rwlp, krw_t rw); @@ -272,6 +277,14 @@ extern void cv_signal(kcondvar_t *cv); extern void cv_broadcast(kcondvar_t *cv); /* + * Thread-specific data + */ +#define tsd_get(k) pthread_getspecific(k) +#define tsd_set(k, v) pthread_setspecific(k, v) +#define tsd_create(kp, d) pthread_key_create(kp, d) +#define tsd_destroy(kp) /* nothing */ + +/* * Kernel memory */ #define KM_SLEEP UMEM_NOFAIL @@ -520,7 +533,7 @@ typedef struct callb_cpr { #define INGLOBALZONE(z) (1) extern char *kmem_asprintf(const char *fmt, ...); -#define strfree(str) kmem_free((str), strlen(str)+1) +#define strfree(str) kmem_free((str), strlen(str) + 1) /* * Hostname information |