summaryrefslogtreecommitdiffstats
path: root/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.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.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.c')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c
index 44919d2..4dc931b 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c
@@ -1335,8 +1335,8 @@ fzap_get_stats(zap_t *zap, zap_stats_t *zs)
}
int
-fzap_count_write(zap_name_t *zn, int add, uint64_t *towrite,
- uint64_t *tooverwrite)
+fzap_count_write(zap_name_t *zn, int add, refcount_t *towrite,
+ refcount_t *tooverwrite)
{
zap_t *zap = zn->zn_zap;
zap_leaf_t *l;
@@ -1346,9 +1346,11 @@ fzap_count_write(zap_name_t *zn, int add, uint64_t *towrite,
* Account for the header block of the fatzap.
*/
if (!add && dmu_buf_freeable(zap->zap_dbuf)) {
- *tooverwrite += zap->zap_dbuf->db_size;
+ (void) refcount_add_many(tooverwrite,
+ zap->zap_dbuf->db_size, FTAG);
} else {
- *towrite += zap->zap_dbuf->db_size;
+ (void) refcount_add_many(towrite,
+ zap->zap_dbuf->db_size, FTAG);
}
/*
@@ -1360,10 +1362,13 @@ fzap_count_write(zap_name_t *zn, int add, uint64_t *towrite,
* could extend the table.
*/
if (add) {
- if (zap_f_phys(zap)->zap_ptrtbl.zt_blk == 0)
- *towrite += zap->zap_dbuf->db_size;
- else
- *towrite += (zap->zap_dbuf->db_size * 3);
+ if (zap_f_phys(zap)->zap_ptrtbl.zt_blk == 0) {
+ (void) refcount_add_many(towrite,
+ zap->zap_dbuf->db_size, FTAG);
+ } else {
+ (void) refcount_add_many(towrite,
+ zap->zap_dbuf->db_size * 3, FTAG);
+ }
}
/*
@@ -1376,13 +1381,14 @@ fzap_count_write(zap_name_t *zn, int add, uint64_t *towrite,
}
if (!add && dmu_buf_freeable(l->l_dbuf)) {
- *tooverwrite += l->l_dbuf->db_size;
+ (void) refcount_add_many(tooverwrite, l->l_dbuf->db_size, FTAG);
} else {
/*
* If this an add operation, the leaf block could split.
* Hence, we need to account for an additional leaf block.
*/
- *towrite += (add ? 2 : 1) * l->l_dbuf->db_size;
+ (void) refcount_add_many(towrite,
+ (add ? 2 : 1) * l->l_dbuf->db_size, FTAG);
}
zap_put_leaf(l);
OpenPOWER on IntegriCloud