aboutsummaryrefslogtreecommitdiff
path: root/module/zfs/refcount.c
diff options
context:
space:
mode:
authorBrian Behlendorf <behlendorf1@llnl.gov>2018-10-08 21:58:21 +0000
committerBrian Behlendorf <behlendorf1@llnl.gov>2018-10-09 17:05:48 +0000
commitd7e4b30a672c1d7eb77dbbe2cdcf14cac102839a (patch)
treee9d61baf611a5479fd047b7170b67ea57dd2abf7 /module/zfs/refcount.c
parent4cbde2ecbf7c6478bac106fadd6a23f53d538262 (diff)
downloadsrc-d7e4b30a672c1d7eb77dbbe2cdcf14cac102839a.tar.gz
src-d7e4b30a672c1d7eb77dbbe2cdcf14cac102839a.zip
Diffstat (limited to 'module/zfs/refcount.c')
-rw-r--r--module/zfs/refcount.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/module/zfs/refcount.c b/module/zfs/refcount.c
index 0a93aafb1358..bcaa6d387539 100644
--- a/module/zfs/refcount.c
+++ b/module/zfs/refcount.c
@@ -234,8 +234,8 @@ zfs_refcount_transfer(zfs_refcount_t *dst, zfs_refcount_t *src)
}
void
-zfs_refcount_transfer_ownership(zfs_refcount_t *rc, void *current_holder,
- void *new_holder)
+zfs_refcount_transfer_ownership_many(zfs_refcount_t *rc, uint64_t number,
+ void *current_holder, void *new_holder)
{
reference_t *ref;
boolean_t found = B_FALSE;
@@ -248,7 +248,8 @@ zfs_refcount_transfer_ownership(zfs_refcount_t *rc, void *current_holder,
for (ref = list_head(&rc->rc_list); ref;
ref = list_next(&rc->rc_list, ref)) {
- if (ref->ref_holder == current_holder) {
+ if (ref->ref_holder == current_holder &&
+ ref->ref_number == number) {
ref->ref_holder = new_holder;
found = B_TRUE;
break;
@@ -258,6 +259,14 @@ zfs_refcount_transfer_ownership(zfs_refcount_t *rc, void *current_holder,
mutex_exit(&rc->rc_mtx);
}
+void
+zfs_refcount_transfer_ownership(zfs_refcount_t *rc, void *current_holder,
+ void *new_holder)
+{
+ return (zfs_refcount_transfer_ownership_many(rc, 1, current_holder,
+ new_holder));
+}
+
/*
* If tracking is enabled, return true if a reference exists that matches
* the "holder" tag. If tracking is disabled, then return true if a reference