summaryrefslogtreecommitdiffstats
path: root/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2016-10-11 16:52:57 +0000
committermav <mav@FreeBSD.org>2016-10-11 16:52:57 +0000
commit8c2693682ba7f27f171d99852c1bf8f562cf76cc (patch)
tree9035e1743371d7f0c8be3e6cce092605bf7285a3 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
parent6ffd7aae1ea03e042808a353ebc60bc09741acdd (diff)
downloadFreeBSD-src-8c2693682ba7f27f171d99852c1bf8f562cf76cc.zip
FreeBSD-src-8c2693682ba7f27f171d99852c1bf8f562cf76cc.tar.gz
MFC r305200: MFV r302651:
7054 dmu_tx_hold_t should use refcount_t to track space illumos/illumos-gate@0c779ad424a92a84d1e07d47cab7f8009189202b https://github.com/illumos/illumos-gate/commit/0c779ad424a92a84d1e07d47cab7f8009 189202b https://www.illumos.org/issues/7054 upstream: ee0003de7d3e598499be7ac3fe6b61efcc47cb7f DLPX-40399 dmu_tx_hold_t should use refcount_t to track space Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Paul Dagnelie <pcd@delphix.com> Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com> Approved by: Dan McDonald <danmcd@omniti.com> Author: Matthew Ahrens <mahrens@delphix.com>
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
index ea3d869..fbd7e02 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
@@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
* Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
* Copyright (c) 2014 Integros [integros.com]
*/
@@ -1396,7 +1396,7 @@ zap_get_stats(objset_t *os, uint64_t zapobj, zap_stats_t *zs)
int
zap_count_write(objset_t *os, uint64_t zapobj, const char *name, int add,
- uint64_t *towrite, uint64_t *tooverwrite)
+ refcount_t *towrite, refcount_t *tooverwrite)
{
zap_t *zap;
int err = 0;
@@ -1406,14 +1406,15 @@ zap_count_write(objset_t *os, uint64_t zapobj, const char *name, int add,
* be affected in this operation. So, account for the worst case :
* - 3 blocks overwritten: target leaf, ptrtbl block, header block
* - 4 new blocks written if adding:
- * - 2 blocks for possibly split leaves,
- * - 2 grown ptrtbl blocks
+ * - 2 blocks for possibly split leaves,
+ * - 2 grown ptrtbl blocks
*
* This also accomodates the case where an add operation to a fairly
* large microzap results in a promotion to fatzap.
*/
if (name == NULL) {
- *towrite += (3 + (add ? 4 : 0)) * SPA_OLD_MAXBLOCKSIZE;
+ (void) refcount_add_many(towrite,
+ (3 + (add ? 4 : 0)) * SPA_OLD_MAXBLOCKSIZE, FTAG);
return (err);
}
@@ -1437,7 +1438,8 @@ zap_count_write(objset_t *os, uint64_t zapobj, const char *name, int add,
/*
* We treat this case as similar to (name == NULL)
*/
- *towrite += (3 + (add ? 4 : 0)) * SPA_OLD_MAXBLOCKSIZE;
+ (void) refcount_add_many(towrite,
+ (3 + (add ? 4 : 0)) * SPA_OLD_MAXBLOCKSIZE, FTAG);
}
} else {
/*
@@ -1455,13 +1457,17 @@ zap_count_write(objset_t *os, uint64_t zapobj, const char *name, int add,
* 4 new blocks written : 2 new split leaf, 2 grown
* ptrtbl blocks
*/
- if (dmu_buf_freeable(zap->zap_dbuf))
- *tooverwrite += MZAP_MAX_BLKSZ;
- else
- *towrite += MZAP_MAX_BLKSZ;
+ if (dmu_buf_freeable(zap->zap_dbuf)) {
+ (void) refcount_add_many(tooverwrite,
+ MZAP_MAX_BLKSZ, FTAG);
+ } else {
+ (void) refcount_add_many(towrite,
+ MZAP_MAX_BLKSZ, FTAG);
+ }
if (add) {
- *towrite += 4 * MZAP_MAX_BLKSZ;
+ (void) refcount_add_many(towrite,
+ 4 * MZAP_MAX_BLKSZ, FTAG);
}
}
OpenPOWER on IntegriCloud