summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/fs/zfs/zap_micro.c
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2016-06-10 12:03:01 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2016-06-10 12:03:01 +0000
commit301612afc3ef38a67f1adb329b36dae1bddf9034 (patch)
tree67480c0403a52379edfa7ff86522e0ea84bf3934 /usr/src/uts/common/fs/zfs/zap_micro.c
parent3a73555a6bf9a4594d44713855d2396974e5f9ad (diff)
parentbc07d1fd58f705e3a6d5b418433e42cd8e42b7f1 (diff)
downloadillumos-joyent-301612afc3ef38a67f1adb329b36dae1bddf9034.tar.gz
[illumos-gate merge]
commit a76660dbabd3d3b161bdead081ce275af6966d2e 7083 create_ramdisk.sh need not check for inuse devices commit 3f85b2aed8a5768f4c20db925cdf8fc072472037 7036 zvol_swap_004_pos test failed commit 10e67aa0db0823d5464aafdd681f3c966155c68e 7082 bptree_iterate() passes wrong args to zfs_dbgmsg() commit 2404c9e6b54f427b32dd0a2d46940d6a4c5299bc 7062 Connections remain in TIME_WAIT too long 7061 local TCP connections should be expediently purged from TIME_WAIT commit 9adfa60d484ce2435f5af77cc99dcd4e692b6660 6314 buffer overflow in dsl_dataset_name commit 0c779ad424a92a84d1e07d47cab7f8009189202b 7054 dmu_tx_hold_t should use refcount_t to track space
Diffstat (limited to 'usr/src/uts/common/fs/zfs/zap_micro.c')
-rw-r--r--usr/src/uts/common/fs/zfs/zap_micro.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/usr/src/uts/common/fs/zfs/zap_micro.c b/usr/src/uts/common/fs/zfs/zap_micro.c
index 58acea3663..f94fbf3dd2 100644
--- a/usr/src/uts/common/fs/zfs/zap_micro.c
+++ b/usr/src/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]
*/
@@ -1363,7 +1363,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;
@@ -1373,14 +1373,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);
}
@@ -1404,7 +1405,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 {
/*
@@ -1422,13 +1424,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);
}
}