aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/zap.c
diff options
context:
space:
mode:
authorGeorge Melikov <[email protected]>2017-01-23 20:36:24 +0300
committerBrian Behlendorf <[email protected]>2017-01-23 09:36:24 -0800
commitf85c06bedfd2a60f5b5d6a7492ed847c2bffd9fe (patch)
treef9088bd3cfb4c9cacdbeae63012ad7d346f4bce8 /module/zfs/zap.c
parent4ea3f86426f76e59244ec6f66504da688d90193c (diff)
OpenZFS 7054 - dmu_tx_hold_t should use refcount_t to track space
Authored by: Igor Kozhukhov [email protected] Reviewed by: George Wilson <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Reviewed by: Igor Kozhukhov <[email protected]> Approved by: Dan McDonald <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov [email protected] OpenZFS-issue: https://www.illumos.org/issues/7054 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/0c779ad Closes #5600
Diffstat (limited to 'module/zfs/zap.c')
-rw-r--r--module/zfs/zap.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/module/zfs/zap.c b/module/zfs/zap.c
index a8ccd2895..17107eb28 100644
--- a/module/zfs/zap.c
+++ b/module/zfs/zap.c
@@ -1358,8 +1358,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;
@@ -1369,9 +1369,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);
}
/*
@@ -1383,10 +1385,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);
+ }
}
/*
@@ -1399,13 +1404,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);