diff options
Diffstat (limited to 'module/zfs/bpobj.c')
-rw-r--r-- | module/zfs/bpobj.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/module/zfs/bpobj.c b/module/zfs/bpobj.c index 561d0cf8a..00c3d7dfa 100644 --- a/module/zfs/bpobj.c +++ b/module/zfs/bpobj.c @@ -203,13 +203,23 @@ bpobj_close(bpobj_t *bpo) mutex_destroy(&bpo->bpo_lock); } -boolean_t -bpobj_is_empty(bpobj_t *bpo) +static boolean_t +bpobj_is_empty_impl(bpobj_t *bpo) { + ASSERT(MUTEX_HELD(&bpo->bpo_lock)); return (bpo->bpo_phys->bpo_num_blkptrs == 0 && (!bpo->bpo_havesubobj || bpo->bpo_phys->bpo_num_subobjs == 0)); } +boolean_t +bpobj_is_empty(bpobj_t *bpo) +{ + mutex_enter(&bpo->bpo_lock); + boolean_t is_empty = bpobj_is_empty_impl(bpo); + mutex_exit(&bpo->bpo_lock); + return (is_empty); +} + /* * A recursive iteration of the bpobjs would be nice here but we run the risk * of overflowing function stack space. Instead, find each subobj and add it @@ -387,7 +397,7 @@ bpobj_iterate_impl(bpobj_t *initial_bpo, bpobj_itor_t func, void *arg, * If there are no entries, there should * be no bytes. */ - if (bpobj_is_empty(bpo)) { + if (bpobj_is_empty_impl(bpo)) { ASSERT0(bpo->bpo_phys->bpo_bytes); ASSERT0(bpo->bpo_phys->bpo_comp); ASSERT0(bpo->bpo_phys->bpo_uncomp); |