aboutsummaryrefslogtreecommitdiff
path: root/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2019-10-15 15:09:36 +0000
committerAndriy Gapon <avg@FreeBSD.org>2019-10-15 15:09:36 +0000
commit6f2721b9071bc6c461b7b158aba44b6dd60b079f (patch)
tree32af1c34ef474077f822f4fa08b1fd5d78c53068 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
parent563db1a9475896a9f6f14ca0eb4d4c47bfedd487 (diff)
parent1dd2b15521ce6fc3a2c3e0e2198fd81404d8c786 (diff)
downloadsrc-6f2721b9071bc6c461b7b158aba44b6dd60b079f.tar.gz
src-6f2721b9071bc6c461b7b158aba44b6dd60b079f.zip
MFV r353561: 10343 ZoL: Prefix all refcount functions with zfs_
illumos/illumos-gate@e914ace2e9d9bf2dbf9a1f1ce81cb776022096f5 https://github.com/illumos/illumos-gate/commit/e914ace2e9d9bf2dbf9a1f1ce81cb776022096f5 https://www.illumos.org/issues/10343 On the openzfs feature/porting matrix, this is listed as: prefix to refcount funcs/types Having these changes will make it easier to share other work across the different ZFS operating systems. PR 7963 424fd7c3e Prefix all refcount functions with zfs_ PR 7885 & 7932 c13060e47 Linux 4.19-rc3+ compat: Remove refcount_t compat PR 5823 & 5842 4859fe796 Linux 4.11 compat: avoid refcount_t name conflict Author: Tim Schumacher <timschumi@gmx.de> Obtained from: illumos, ZoL MFC after: 3 weeks
Notes
Notes: svn path=/head/; revision=353565
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
index 6ba5bed27b2b..55d85d055b84 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
@@ -85,7 +85,7 @@
* definition they must have an existing reference, and will never need
* to lookup a spa_t by name.
*
- * spa_refcount (per-spa refcount_t protected by mutex)
+ * spa_refcount (per-spa zfs_refcount_t protected by mutex)
*
* This reference count keep track of any active users of the spa_t. The
* spa_t cannot be destroyed or freed while this is non-zero. Internally,
@@ -480,7 +480,7 @@ spa_config_lock_init(spa_t *spa)
spa_config_lock_t *scl = &spa->spa_config_lock[i];
mutex_init(&scl->scl_lock, NULL, MUTEX_DEFAULT, NULL);
cv_init(&scl->scl_cv, NULL, CV_DEFAULT, NULL);
- refcount_create_untracked(&scl->scl_count);
+ zfs_refcount_create_untracked(&scl->scl_count);
scl->scl_writer = NULL;
scl->scl_write_wanted = 0;
}
@@ -493,7 +493,7 @@ spa_config_lock_destroy(spa_t *spa)
spa_config_lock_t *scl = &spa->spa_config_lock[i];
mutex_destroy(&scl->scl_lock);
cv_destroy(&scl->scl_cv);
- refcount_destroy(&scl->scl_count);
+ zfs_refcount_destroy(&scl->scl_count);
ASSERT(scl->scl_writer == NULL);
ASSERT(scl->scl_write_wanted == 0);
}
@@ -516,7 +516,7 @@ spa_config_tryenter(spa_t *spa, int locks, void *tag, krw_t rw)
}
} else {
ASSERT(scl->scl_writer != curthread);
- if (!refcount_is_zero(&scl->scl_count)) {
+ if (!zfs_refcount_is_zero(&scl->scl_count)) {
mutex_exit(&scl->scl_lock);
spa_config_exit(spa, locks & ((1 << i) - 1),
tag);
@@ -524,7 +524,7 @@ spa_config_tryenter(spa_t *spa, int locks, void *tag, krw_t rw)
}
scl->scl_writer = curthread;
}
- (void) refcount_add(&scl->scl_count, tag);
+ (void) zfs_refcount_add(&scl->scl_count, tag);
mutex_exit(&scl->scl_lock);
}
return (1);
@@ -550,14 +550,14 @@ spa_config_enter(spa_t *spa, int locks, void *tag, krw_t rw)
}
} else {
ASSERT(scl->scl_writer != curthread);
- while (!refcount_is_zero(&scl->scl_count)) {
+ while (!zfs_refcount_is_zero(&scl->scl_count)) {
scl->scl_write_wanted++;
cv_wait(&scl->scl_cv, &scl->scl_lock);
scl->scl_write_wanted--;
}
scl->scl_writer = curthread;
}
- (void) refcount_add(&scl->scl_count, tag);
+ (void) zfs_refcount_add(&scl->scl_count, tag);
mutex_exit(&scl->scl_lock);
}
ASSERT3U(wlocks_held, <=, locks);
@@ -571,8 +571,8 @@ spa_config_exit(spa_t *spa, int locks, void *tag)
if (!(locks & (1 << i)))
continue;
mutex_enter(&scl->scl_lock);
- ASSERT(!refcount_is_zero(&scl->scl_count));
- if (refcount_remove(&scl->scl_count, tag) == 0) {
+ ASSERT(!zfs_refcount_is_zero(&scl->scl_count));
+ if (zfs_refcount_remove(&scl->scl_count, tag) == 0) {
ASSERT(scl->scl_writer == NULL ||
scl->scl_writer == curthread);
scl->scl_writer = NULL; /* OK in either case */
@@ -591,7 +591,8 @@ spa_config_held(spa_t *spa, int locks, krw_t rw)
spa_config_lock_t *scl = &spa->spa_config_lock[i];
if (!(locks & (1 << i)))
continue;
- if ((rw == RW_READER && !refcount_is_zero(&scl->scl_count)) ||
+ if ((rw == RW_READER &&
+ !zfs_refcount_is_zero(&scl->scl_count)) ||
(rw == RW_WRITER && scl->scl_writer == curthread))
locks_held |= 1 << i;
}
@@ -770,7 +771,7 @@ spa_add(const char *name, nvlist_t *config, const char *altroot)
spa_deadman_timeout, spa, 0);
#endif
#endif
- refcount_create(&spa->spa_refcount);
+ zfs_refcount_create(&spa->spa_refcount);
spa_config_lock_init(spa);
avl_add(&spa_namespace_avl, spa);
@@ -851,7 +852,7 @@ spa_remove(spa_t *spa)
ASSERT(MUTEX_HELD(&spa_namespace_lock));
ASSERT(spa->spa_state == POOL_STATE_UNINITIALIZED);
- ASSERT3U(refcount_count(&spa->spa_refcount), ==, 0);
+ ASSERT3U(zfs_refcount_count(&spa->spa_refcount), ==, 0);
nvlist_free(spa->spa_config_splitting);
@@ -899,7 +900,7 @@ spa_remove(spa_t *spa)
#endif
#endif
- refcount_destroy(&spa->spa_refcount);
+ zfs_refcount_destroy(&spa->spa_refcount);
spa_config_lock_destroy(spa);
@@ -958,9 +959,9 @@ spa_next(spa_t *prev)
void
spa_open_ref(spa_t *spa, void *tag)
{
- ASSERT(refcount_count(&spa->spa_refcount) >= spa->spa_minref ||
+ ASSERT(zfs_refcount_count(&spa->spa_refcount) >= spa->spa_minref ||
MUTEX_HELD(&spa_namespace_lock));
- (void) refcount_add(&spa->spa_refcount, tag);
+ (void) zfs_refcount_add(&spa->spa_refcount, tag);
}
/*
@@ -970,9 +971,9 @@ spa_open_ref(spa_t *spa, void *tag)
void
spa_close(spa_t *spa, void *tag)
{
- ASSERT(refcount_count(&spa->spa_refcount) > spa->spa_minref ||
+ ASSERT(zfs_refcount_count(&spa->spa_refcount) > spa->spa_minref ||
MUTEX_HELD(&spa_namespace_lock));
- (void) refcount_remove(&spa->spa_refcount, tag);
+ (void) zfs_refcount_remove(&spa->spa_refcount, tag);
}
/*
@@ -986,7 +987,7 @@ spa_close(spa_t *spa, void *tag)
void
spa_async_close(spa_t *spa, void *tag)
{
- (void) refcount_remove(&spa->spa_refcount, tag);
+ (void) zfs_refcount_remove(&spa->spa_refcount, tag);
}
/*
@@ -999,7 +1000,7 @@ spa_refcount_zero(spa_t *spa)
{
ASSERT(MUTEX_HELD(&spa_namespace_lock));
- return (refcount_count(&spa->spa_refcount) == spa->spa_minref);
+ return (zfs_refcount_count(&spa->spa_refcount) == spa->spa_minref);
}
/*
@@ -2056,7 +2057,8 @@ spa_init(int mode)
}
#endif
#endif /* illumos */
- refcount_sysinit();
+
+ zfs_refcount_init();
unique_init();
range_tree_init();
metaslab_alloc_trace_init();
@@ -2096,7 +2098,7 @@ spa_fini(void)
metaslab_alloc_trace_fini();
range_tree_fini();
unique_fini();
- refcount_fini();
+ zfs_refcount_fini();
scan_fini();
avl_destroy(&spa_namespace_avl);