2008-11-20 23:01:55 +03:00
|
|
|
/*
|
|
|
|
* CDDL HEADER START
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the terms of the
|
|
|
|
* Common Development and Distribution License (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
|
2022-07-12 00:16:13 +03:00
|
|
|
* or https://opensource.org/licenses/CDDL-1.0.
|
2008-11-20 23:01:55 +03:00
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
/*
|
2010-05-29 00:45:14 +04:00
|
|
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
2021-03-17 00:56:17 +03:00
|
|
|
* Copyright (c) 2012, 2021 by Delphix. All rights reserved.
|
2008-11-20 23:01:55 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/zfs_context.h>
|
2020-07-30 02:35:33 +03:00
|
|
|
#include <sys/zfs_refcount.h>
|
2008-11-20 23:01:55 +03:00
|
|
|
|
2022-01-15 02:37:55 +03:00
|
|
|
#ifdef ZFS_DEBUG
|
2020-04-13 20:51:44 +03:00
|
|
|
/*
|
|
|
|
* Reference count tracking is disabled by default. It's memory requirements
|
|
|
|
* are reasonable, however as implemented it consumes a significant amount of
|
|
|
|
* cpu time. Until its performance is improved it should be manually enabled.
|
|
|
|
*/
|
2022-01-15 02:37:55 +03:00
|
|
|
int reference_tracking_enable = B_FALSE;
|
|
|
|
static int reference_history = 3; /* tunable */
|
2008-11-20 23:01:55 +03:00
|
|
|
|
|
|
|
static kmem_cache_t *reference_cache;
|
|
|
|
static kmem_cache_t *reference_history_cache;
|
|
|
|
|
|
|
|
void
|
2018-10-01 20:42:05 +03:00
|
|
|
zfs_refcount_init(void)
|
2008-11-20 23:01:55 +03:00
|
|
|
{
|
|
|
|
reference_cache = kmem_cache_create("reference_cache",
|
|
|
|
sizeof (reference_t), 0, NULL, NULL, NULL, NULL, NULL, 0);
|
|
|
|
|
|
|
|
reference_history_cache = kmem_cache_create("reference_history_cache",
|
|
|
|
sizeof (uint64_t), 0, NULL, NULL, NULL, NULL, NULL, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-10-01 20:42:05 +03:00
|
|
|
zfs_refcount_fini(void)
|
2008-11-20 23:01:55 +03:00
|
|
|
{
|
|
|
|
kmem_cache_destroy(reference_cache);
|
|
|
|
kmem_cache_destroy(reference_history_cache);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-10-01 20:42:05 +03:00
|
|
|
zfs_refcount_create(zfs_refcount_t *rc)
|
2008-11-20 23:01:55 +03:00
|
|
|
{
|
|
|
|
mutex_init(&rc->rc_mtx, NULL, MUTEX_DEFAULT, NULL);
|
|
|
|
list_create(&rc->rc_list, sizeof (reference_t),
|
|
|
|
offsetof(reference_t, ref_link));
|
|
|
|
list_create(&rc->rc_removed, sizeof (reference_t),
|
|
|
|
offsetof(reference_t, ref_link));
|
|
|
|
rc->rc_count = 0;
|
|
|
|
rc->rc_removed_count = 0;
|
2013-09-04 16:00:57 +04:00
|
|
|
rc->rc_tracked = reference_tracking_enable;
|
|
|
|
}
|
|
|
|
|
2016-10-14 03:59:18 +03:00
|
|
|
void
|
2018-10-01 20:42:05 +03:00
|
|
|
zfs_refcount_create_tracked(zfs_refcount_t *rc)
|
2016-10-14 03:59:18 +03:00
|
|
|
{
|
2018-10-01 20:42:05 +03:00
|
|
|
zfs_refcount_create(rc);
|
2016-10-14 03:59:18 +03:00
|
|
|
rc->rc_tracked = B_TRUE;
|
|
|
|
}
|
|
|
|
|
2013-09-04 16:00:57 +04:00
|
|
|
void
|
2018-10-01 20:42:05 +03:00
|
|
|
zfs_refcount_create_untracked(zfs_refcount_t *rc)
|
2013-09-04 16:00:57 +04:00
|
|
|
{
|
2018-10-01 20:42:05 +03:00
|
|
|
zfs_refcount_create(rc);
|
2013-09-04 16:00:57 +04:00
|
|
|
rc->rc_tracked = B_FALSE;
|
2008-11-20 23:01:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-10-01 20:42:05 +03:00
|
|
|
zfs_refcount_destroy_many(zfs_refcount_t *rc, uint64_t number)
|
2008-11-20 23:01:55 +03:00
|
|
|
{
|
|
|
|
reference_t *ref;
|
|
|
|
|
Implement Redacted Send/Receive
Redacted send/receive allows users to send subsets of their data to
a target system. One possible use case for this feature is to not
transmit sensitive information to a data warehousing, test/dev, or
analytics environment. Another is to save space by not replicating
unimportant data within a given dataset, for example in backup tools
like zrepl.
Redacted send/receive is a three-stage process. First, a clone (or
clones) is made of the snapshot to be sent to the target. In this
clone (or clones), all unnecessary or unwanted data is removed or
modified. This clone is then snapshotted to create the "redaction
snapshot" (or snapshots). Second, the new zfs redact command is used
to create a redaction bookmark. The redaction bookmark stores the
list of blocks in a snapshot that were modified by the redaction
snapshot(s). Finally, the redaction bookmark is passed as a parameter
to zfs send. When sending to the snapshot that was redacted, the
redaction bookmark is used to filter out blocks that contain sensitive
or unwanted information, and those blocks are not included in the send
stream. When sending from the redaction bookmark, the blocks it
contains are considered as candidate blocks in addition to those
blocks in the destination snapshot that were modified since the
creation_txg of the redaction bookmark. This step is necessary to
allow the target to rehydrate data in the case where some blocks are
accidentally or unnecessarily modified in the redaction snapshot.
The changes to bookmarks to enable fast space estimation involve
adding deadlists to bookmarks. There is also logic to manage the
life cycles of these deadlists.
The new size estimation process operates in cases where previously
an accurate estimate could not be provided. In those cases, a send
is performed where no data blocks are read, reducing the runtime
significantly and providing a byte-accurate size estimate.
Reviewed-by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed-by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: Prashanth Sreenivasa <pks@delphix.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: George Wilson <george.wilson@delphix.com>
Reviewed-by: Chris Williamson <chris.williamson@delphix.com>
Reviewed-by: Pavel Zhakarov <pavel.zakharov@delphix.com>
Reviewed-by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed-by: Prakash Surya <prakash.surya@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #7958
2019-06-19 19:48:13 +03:00
|
|
|
ASSERT3U(rc->rc_count, ==, number);
|
2010-08-26 20:52:42 +04:00
|
|
|
while ((ref = list_head(&rc->rc_list))) {
|
2008-11-20 23:01:55 +03:00
|
|
|
list_remove(&rc->rc_list, ref);
|
|
|
|
kmem_cache_free(reference_cache, ref);
|
|
|
|
}
|
|
|
|
list_destroy(&rc->rc_list);
|
|
|
|
|
2010-08-26 20:52:42 +04:00
|
|
|
while ((ref = list_head(&rc->rc_removed))) {
|
2008-11-20 23:01:55 +03:00
|
|
|
list_remove(&rc->rc_removed, ref);
|
|
|
|
kmem_cache_free(reference_history_cache, ref->ref_removed);
|
|
|
|
kmem_cache_free(reference_cache, ref);
|
|
|
|
}
|
|
|
|
list_destroy(&rc->rc_removed);
|
|
|
|
mutex_destroy(&rc->rc_mtx);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-10-01 20:42:05 +03:00
|
|
|
zfs_refcount_destroy(zfs_refcount_t *rc)
|
2008-11-20 23:01:55 +03:00
|
|
|
{
|
2018-10-01 20:42:05 +03:00
|
|
|
zfs_refcount_destroy_many(rc, 0);
|
2008-11-20 23:01:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2018-10-01 20:42:05 +03:00
|
|
|
zfs_refcount_is_zero(zfs_refcount_t *rc)
|
2008-11-20 23:01:55 +03:00
|
|
|
{
|
2021-08-17 18:44:34 +03:00
|
|
|
return (zfs_refcount_count(rc) == 0);
|
2008-11-20 23:01:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int64_t
|
2018-10-01 20:42:05 +03:00
|
|
|
zfs_refcount_count(zfs_refcount_t *rc)
|
2008-11-20 23:01:55 +03:00
|
|
|
{
|
2021-08-17 18:44:34 +03:00
|
|
|
return (atomic_load_64(&rc->rc_count));
|
2008-11-20 23:01:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int64_t
|
2019-08-14 06:24:43 +03:00
|
|
|
zfs_refcount_add_many(zfs_refcount_t *rc, uint64_t number, const void *holder)
|
2008-11-20 23:01:55 +03:00
|
|
|
{
|
2010-08-26 20:58:04 +04:00
|
|
|
reference_t *ref = NULL;
|
2008-11-20 23:01:55 +03:00
|
|
|
int64_t count;
|
|
|
|
|
2021-08-17 18:44:34 +03:00
|
|
|
if (!rc->rc_tracked) {
|
|
|
|
count = atomic_add_64_nv(&(rc)->rc_count, number);
|
|
|
|
ASSERT3U(count, >=, number);
|
|
|
|
return (count);
|
2008-11-20 23:01:55 +03:00
|
|
|
}
|
2021-08-17 18:44:34 +03:00
|
|
|
|
|
|
|
ref = kmem_cache_alloc(reference_cache, KM_SLEEP);
|
|
|
|
ref->ref_holder = holder;
|
|
|
|
ref->ref_number = number;
|
2008-11-20 23:01:55 +03:00
|
|
|
mutex_enter(&rc->rc_mtx);
|
Implement Redacted Send/Receive
Redacted send/receive allows users to send subsets of their data to
a target system. One possible use case for this feature is to not
transmit sensitive information to a data warehousing, test/dev, or
analytics environment. Another is to save space by not replicating
unimportant data within a given dataset, for example in backup tools
like zrepl.
Redacted send/receive is a three-stage process. First, a clone (or
clones) is made of the snapshot to be sent to the target. In this
clone (or clones), all unnecessary or unwanted data is removed or
modified. This clone is then snapshotted to create the "redaction
snapshot" (or snapshots). Second, the new zfs redact command is used
to create a redaction bookmark. The redaction bookmark stores the
list of blocks in a snapshot that were modified by the redaction
snapshot(s). Finally, the redaction bookmark is passed as a parameter
to zfs send. When sending to the snapshot that was redacted, the
redaction bookmark is used to filter out blocks that contain sensitive
or unwanted information, and those blocks are not included in the send
stream. When sending from the redaction bookmark, the blocks it
contains are considered as candidate blocks in addition to those
blocks in the destination snapshot that were modified since the
creation_txg of the redaction bookmark. This step is necessary to
allow the target to rehydrate data in the case where some blocks are
accidentally or unnecessarily modified in the redaction snapshot.
The changes to bookmarks to enable fast space estimation involve
adding deadlists to bookmarks. There is also logic to manage the
life cycles of these deadlists.
The new size estimation process operates in cases where previously
an accurate estimate could not be provided. In those cases, a send
is performed where no data blocks are read, reducing the runtime
significantly and providing a byte-accurate size estimate.
Reviewed-by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed-by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: Prashanth Sreenivasa <pks@delphix.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: George Wilson <george.wilson@delphix.com>
Reviewed-by: Chris Williamson <chris.williamson@delphix.com>
Reviewed-by: Pavel Zhakarov <pavel.zakharov@delphix.com>
Reviewed-by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed-by: Prakash Surya <prakash.surya@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #7958
2019-06-19 19:48:13 +03:00
|
|
|
ASSERT3U(rc->rc_count, >=, 0);
|
2021-08-17 18:44:34 +03:00
|
|
|
list_insert_head(&rc->rc_list, ref);
|
2008-11-20 23:01:55 +03:00
|
|
|
rc->rc_count += number;
|
|
|
|
count = rc->rc_count;
|
|
|
|
mutex_exit(&rc->rc_mtx);
|
|
|
|
|
|
|
|
return (count);
|
|
|
|
}
|
|
|
|
|
|
|
|
int64_t
|
2019-08-14 06:24:43 +03:00
|
|
|
zfs_refcount_add(zfs_refcount_t *rc, const void *holder)
|
2008-11-20 23:01:55 +03:00
|
|
|
{
|
2018-10-01 20:42:05 +03:00
|
|
|
return (zfs_refcount_add_many(rc, 1, holder));
|
2008-11-20 23:01:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int64_t
|
2019-08-14 06:24:43 +03:00
|
|
|
zfs_refcount_remove_many(zfs_refcount_t *rc, uint64_t number,
|
|
|
|
const void *holder)
|
2008-11-20 23:01:55 +03:00
|
|
|
{
|
|
|
|
reference_t *ref;
|
|
|
|
int64_t count;
|
|
|
|
|
2013-09-04 16:00:57 +04:00
|
|
|
if (!rc->rc_tracked) {
|
2021-08-17 18:44:34 +03:00
|
|
|
count = atomic_add_64_nv(&(rc)->rc_count, -number);
|
|
|
|
ASSERT3S(count, >=, 0);
|
2008-11-20 23:01:55 +03:00
|
|
|
return (count);
|
|
|
|
}
|
|
|
|
|
2021-08-17 18:44:34 +03:00
|
|
|
mutex_enter(&rc->rc_mtx);
|
|
|
|
ASSERT3U(rc->rc_count, >=, number);
|
2008-11-20 23:01:55 +03:00
|
|
|
for (ref = list_head(&rc->rc_list); ref;
|
|
|
|
ref = list_next(&rc->rc_list, ref)) {
|
|
|
|
if (ref->ref_holder == holder && ref->ref_number == number) {
|
|
|
|
list_remove(&rc->rc_list, ref);
|
|
|
|
if (reference_history > 0) {
|
|
|
|
ref->ref_removed =
|
|
|
|
kmem_cache_alloc(reference_history_cache,
|
2014-11-21 03:09:39 +03:00
|
|
|
KM_SLEEP);
|
2008-11-20 23:01:55 +03:00
|
|
|
list_insert_head(&rc->rc_removed, ref);
|
|
|
|
rc->rc_removed_count++;
|
2013-09-04 16:00:57 +04:00
|
|
|
if (rc->rc_removed_count > reference_history) {
|
2008-11-20 23:01:55 +03:00
|
|
|
ref = list_tail(&rc->rc_removed);
|
|
|
|
list_remove(&rc->rc_removed, ref);
|
|
|
|
kmem_cache_free(reference_history_cache,
|
|
|
|
ref->ref_removed);
|
|
|
|
kmem_cache_free(reference_cache, ref);
|
|
|
|
rc->rc_removed_count--;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
kmem_cache_free(reference_cache, ref);
|
|
|
|
}
|
|
|
|
rc->rc_count -= number;
|
|
|
|
count = rc->rc_count;
|
|
|
|
mutex_exit(&rc->rc_mtx);
|
|
|
|
return (count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
panic("No such hold %p on refcount %llx", holder,
|
|
|
|
(u_longlong_t)(uintptr_t)rc);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
int64_t
|
2019-08-14 06:24:43 +03:00
|
|
|
zfs_refcount_remove(zfs_refcount_t *rc, const void *holder)
|
2008-11-20 23:01:55 +03:00
|
|
|
{
|
2018-10-01 20:42:05 +03:00
|
|
|
return (zfs_refcount_remove_many(rc, 1, holder));
|
2008-11-20 23:01:55 +03:00
|
|
|
}
|
|
|
|
|
2010-08-27 01:24:34 +04:00
|
|
|
void
|
2018-10-01 20:42:05 +03:00
|
|
|
zfs_refcount_transfer(zfs_refcount_t *dst, zfs_refcount_t *src)
|
2010-08-27 01:24:34 +04:00
|
|
|
{
|
|
|
|
int64_t count, removed_count;
|
|
|
|
list_t list, removed;
|
|
|
|
|
|
|
|
list_create(&list, sizeof (reference_t),
|
|
|
|
offsetof(reference_t, ref_link));
|
|
|
|
list_create(&removed, sizeof (reference_t),
|
|
|
|
offsetof(reference_t, ref_link));
|
|
|
|
|
|
|
|
mutex_enter(&src->rc_mtx);
|
|
|
|
count = src->rc_count;
|
|
|
|
removed_count = src->rc_removed_count;
|
|
|
|
src->rc_count = 0;
|
|
|
|
src->rc_removed_count = 0;
|
|
|
|
list_move_tail(&list, &src->rc_list);
|
|
|
|
list_move_tail(&removed, &src->rc_removed);
|
|
|
|
mutex_exit(&src->rc_mtx);
|
|
|
|
|
|
|
|
mutex_enter(&dst->rc_mtx);
|
|
|
|
dst->rc_count += count;
|
|
|
|
dst->rc_removed_count += removed_count;
|
|
|
|
list_move_tail(&dst->rc_list, &list);
|
|
|
|
list_move_tail(&dst->rc_removed, &removed);
|
|
|
|
mutex_exit(&dst->rc_mtx);
|
|
|
|
|
|
|
|
list_destroy(&list);
|
|
|
|
list_destroy(&removed);
|
|
|
|
}
|
|
|
|
|
2016-06-02 07:04:53 +03:00
|
|
|
void
|
2018-10-09 00:58:21 +03:00
|
|
|
zfs_refcount_transfer_ownership_many(zfs_refcount_t *rc, uint64_t number,
|
2019-08-14 06:24:43 +03:00
|
|
|
const void *current_holder, const void *new_holder)
|
2016-06-02 07:04:53 +03:00
|
|
|
{
|
|
|
|
reference_t *ref;
|
|
|
|
boolean_t found = B_FALSE;
|
|
|
|
|
2021-08-17 18:44:34 +03:00
|
|
|
if (!rc->rc_tracked)
|
2016-06-02 07:04:53 +03:00
|
|
|
return;
|
|
|
|
|
2021-08-17 18:44:34 +03:00
|
|
|
mutex_enter(&rc->rc_mtx);
|
2016-06-02 07:04:53 +03:00
|
|
|
for (ref = list_head(&rc->rc_list); ref;
|
|
|
|
ref = list_next(&rc->rc_list, ref)) {
|
2018-10-09 00:58:21 +03:00
|
|
|
if (ref->ref_holder == current_holder &&
|
|
|
|
ref->ref_number == number) {
|
2016-06-02 07:04:53 +03:00
|
|
|
ref->ref_holder = new_holder;
|
|
|
|
found = B_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ASSERT(found);
|
|
|
|
mutex_exit(&rc->rc_mtx);
|
|
|
|
}
|
2016-10-14 03:59:18 +03:00
|
|
|
|
2018-10-09 00:58:21 +03:00
|
|
|
void
|
2019-08-14 06:24:43 +03:00
|
|
|
zfs_refcount_transfer_ownership(zfs_refcount_t *rc, const void *current_holder,
|
|
|
|
const void *new_holder)
|
2018-10-09 00:58:21 +03:00
|
|
|
{
|
|
|
|
return (zfs_refcount_transfer_ownership_many(rc, 1, current_holder,
|
|
|
|
new_holder));
|
|
|
|
}
|
|
|
|
|
2016-10-14 03:59:18 +03:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
* might be held.
|
|
|
|
*/
|
|
|
|
boolean_t
|
2019-08-14 06:24:43 +03:00
|
|
|
zfs_refcount_held(zfs_refcount_t *rc, const void *holder)
|
2016-10-14 03:59:18 +03:00
|
|
|
{
|
|
|
|
reference_t *ref;
|
|
|
|
|
2021-08-17 18:44:34 +03:00
|
|
|
if (!rc->rc_tracked)
|
|
|
|
return (zfs_refcount_count(rc) > 0);
|
2016-10-14 03:59:18 +03:00
|
|
|
|
2021-08-17 18:44:34 +03:00
|
|
|
mutex_enter(&rc->rc_mtx);
|
2016-10-14 03:59:18 +03:00
|
|
|
for (ref = list_head(&rc->rc_list); ref;
|
|
|
|
ref = list_next(&rc->rc_list, ref)) {
|
|
|
|
if (ref->ref_holder == holder) {
|
|
|
|
mutex_exit(&rc->rc_mtx);
|
|
|
|
return (B_TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mutex_exit(&rc->rc_mtx);
|
|
|
|
return (B_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If tracking is enabled, return true if a reference does not exist that
|
|
|
|
* matches the "holder" tag. If tracking is disabled, always return true
|
|
|
|
* since the reference might not be held.
|
|
|
|
*/
|
|
|
|
boolean_t
|
2019-08-14 06:24:43 +03:00
|
|
|
zfs_refcount_not_held(zfs_refcount_t *rc, const void *holder)
|
2016-10-14 03:59:18 +03:00
|
|
|
{
|
|
|
|
reference_t *ref;
|
|
|
|
|
2021-08-17 18:44:34 +03:00
|
|
|
if (!rc->rc_tracked)
|
2016-10-14 03:59:18 +03:00
|
|
|
return (B_TRUE);
|
|
|
|
|
2021-08-17 18:44:34 +03:00
|
|
|
mutex_enter(&rc->rc_mtx);
|
2016-10-14 03:59:18 +03:00
|
|
|
for (ref = list_head(&rc->rc_list); ref;
|
|
|
|
ref = list_next(&rc->rc_list, ref)) {
|
|
|
|
if (ref->ref_holder == holder) {
|
|
|
|
mutex_exit(&rc->rc_mtx);
|
|
|
|
return (B_FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mutex_exit(&rc->rc_mtx);
|
|
|
|
return (B_TRUE);
|
|
|
|
}
|
2021-03-17 00:56:17 +03:00
|
|
|
|
2021-10-11 20:54:39 +03:00
|
|
|
EXPORT_SYMBOL(zfs_refcount_create);
|
|
|
|
EXPORT_SYMBOL(zfs_refcount_destroy);
|
|
|
|
EXPORT_SYMBOL(zfs_refcount_is_zero);
|
|
|
|
EXPORT_SYMBOL(zfs_refcount_count);
|
|
|
|
EXPORT_SYMBOL(zfs_refcount_add);
|
|
|
|
EXPORT_SYMBOL(zfs_refcount_remove);
|
|
|
|
EXPORT_SYMBOL(zfs_refcount_held);
|
|
|
|
|
2021-03-17 00:56:17 +03:00
|
|
|
/* BEGIN CSTYLED */
|
2022-01-15 02:37:55 +03:00
|
|
|
ZFS_MODULE_PARAM(zfs, , reference_tracking_enable, INT, ZMOD_RW,
|
2021-03-17 00:56:17 +03:00
|
|
|
"Track reference holders to refcount_t objects");
|
|
|
|
|
2022-01-15 02:37:55 +03:00
|
|
|
ZFS_MODULE_PARAM(zfs, , reference_history, INT, ZMOD_RW,
|
2021-03-17 00:56:17 +03:00
|
|
|
"Maximum reference holders being tracked");
|
|
|
|
/* END CSTYLED */
|
2010-08-27 01:24:34 +04:00
|
|
|
#endif /* ZFS_DEBUG */
|