Deleted Added
full compact
23c23
< * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
---
> * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
65a66
> boolean_t td_realloc_possible;
235,244c236,255
< * Since this block has a birth time of 0 it must be a
< * hole created before the SPA_FEATURE_HOLE_BIRTH
< * feature was enabled. If SPA_FEATURE_HOLE_BIRTH
< * was enabled before the min_txg for this traveral we
< * know the hole must have been created before the
< * min_txg for this traveral, so we can skip it. If
< * SPA_FEATURE_HOLE_BIRTH was enabled after the min_txg
< * for this traveral we cannot tell if the hole was
< * created before or after the min_txg for this
< * traversal, so we cannot skip it.
---
> * Since this block has a birth time of 0 it must be one of
> * two things: a hole created before the
> * SPA_FEATURE_HOLE_BIRTH feature was enabled, or a hole
> * which has always been a hole in an object.
> *
> * If a file is written sparsely, then the unwritten parts of
> * the file were "always holes" -- that is, they have been
> * holes since this object was allocated. However, we (and
> * our callers) can not necessarily tell when an object was
> * allocated. Therefore, if it's possible that this object
> * was freed and then its object number reused, we need to
> * visit all the holes with birth==0.
> *
> * If it isn't possible that the object number was reused,
> * then if SPA_FEATURE_HOLE_BIRTH was enabled before we wrote
> * all the blocks we will visit as part of this traversal,
> * then this hole must have always existed, so we can skip
> * it. We visit blocks born after (exclusive) td_min_txg.
> *
> * Note that the meta-dnode cannot be reallocated.
246c257,259
< if (td->td_hole_birth_enabled_txg < td->td_min_txg)
---
> if ((!td->td_realloc_possible ||
> zb->zb_object == DMU_META_DNODE_OBJECT) &&
> td->td_hole_birth_enabled_txg <= td->td_min_txg)
340a354,362
> /*
> * See the block comment above for the goal of this variable.
> * If the maxblkid of the meta-dnode is 0, then we know that
> * we've never had more than DNODES_PER_BLOCK objects in the
> * dataset, which means we can't have reused any object ids.
> */
> if (osp->os_meta_dnode.dn_maxblkid == 0)
> td->td_realloc_possible = B_FALSE;
>
546a569
> td.td_realloc_possible = (txg_start == 0 ? B_FALSE : B_TRUE);
552c575
< td.td_hole_birth_enabled_txg = 0;
---
> td.td_hole_birth_enabled_txg = UINT64_MAX;