aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorAlek P <[email protected]>2017-05-26 08:42:10 -1000
committerBrian Behlendorf <[email protected]>2017-05-26 11:42:10 -0700
commit9210e43a1660bd1b742e80bfc121b86e2cfad57a (patch)
tree039fdf97c5afca8ab66f40bbe34ca882f9653d0f /module/zfs
parent261c013fbf79431ac79def2cdf56d9d82009cd4d (diff)
Don't dirty bpobj if it has no entries
In certain cases (dsl_scan_sync() is one), we may end up calling bpobj_iterate() on an empty bpobj. Even though we don't end up modifying the bpobj it still gets dirtied, causing unneeded writes to the pool. This patch adds an early bail from bpobj_iterate_impl() if bpobj is empty to prevent unneeded writes. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Signed-off-by: Alek Pinchuk <[email protected]> Closes #6164
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/bpobj.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/module/zfs/bpobj.c b/module/zfs/bpobj.c
index 5f2aff453..82ca94e1d 100644
--- a/module/zfs/bpobj.c
+++ b/module/zfs/bpobj.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2017 Datto Inc.
*/
#include <sys/bpobj.h>
@@ -211,6 +212,9 @@ bpobj_iterate_impl(bpobj_t *bpo, bpobj_itor_t func, void *arg, dmu_tx_t *tx,
mutex_enter(&bpo->bpo_lock);
+ if (!bpobj_hasentries(bpo))
+ goto out;
+
if (free)
dmu_buf_will_dirty(bpo->bpo_dbuf, tx);