mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
zdb: rework DDT block count and leak check to just count the blocks
The upcoming dedup features break the long held assumption that all blocks on disk with a 'D' dedup bit will always be present in the DDT, or will have the same set of DVA allocations on disk as in the DDT. If the DDT is no longer a complete picture of all the dedup blocks that will be and should be on disk, then it does us no good to walk and prime it up front, since it won't necessarily match up with every block we'll see anyway. Instead, we rework things here to be more like the BRT checks. When we see a dedup'd block, we look it up in the DDT, consume a refcount, and for the second-or-later instances, count them as duplicates. The DDT and BRT are moved ahead of the space accounting. This will become important for the "flat" feature, which may need to count a modified version of the block. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Co-authored-by: Allan Jude <allan@klarasystems.com> Co-authored-by: Don Brady <don.brady@klarasystems.com> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Sponsored-by: Klara, Inc. Sponsored-by: iXsystems, Inc. Closes #15892
This commit is contained in:
committed by
Brian Behlendorf
parent
2b131d7345
commit
d63f5d7e50
+2
-6
@@ -715,7 +715,7 @@ ddt_prefetch_all(spa_t *spa)
|
||||
static int ddt_configure(ddt_t *ddt, boolean_t new);
|
||||
|
||||
ddt_entry_t *
|
||||
ddt_lookup(ddt_t *ddt, const blkptr_t *bp, boolean_t add)
|
||||
ddt_lookup(ddt_t *ddt, const blkptr_t *bp)
|
||||
{
|
||||
spa_t *spa = ddt->ddt_spa;
|
||||
ddt_key_t search;
|
||||
@@ -767,10 +767,6 @@ ddt_lookup(ddt_t *ddt, const blkptr_t *bp, boolean_t add)
|
||||
return (dde);
|
||||
}
|
||||
|
||||
/* Not found. */
|
||||
if (!add)
|
||||
return (NULL);
|
||||
|
||||
/* Time to make a new entry. */
|
||||
dde = ddt_alloc(&search);
|
||||
avl_insert(&ddt->ddt_tree, dde, where);
|
||||
@@ -1502,7 +1498,7 @@ ddt_addref(spa_t *spa, const blkptr_t *bp)
|
||||
ddt = ddt_select(spa, bp);
|
||||
ddt_enter(ddt);
|
||||
|
||||
dde = ddt_lookup(ddt, bp, B_TRUE);
|
||||
dde = ddt_lookup(ddt, bp);
|
||||
|
||||
/* Can be NULL if the entry for this block was pruned. */
|
||||
if (dde == NULL) {
|
||||
|
||||
+2
-2
@@ -3518,7 +3518,7 @@ zio_ddt_write(zio_t *zio)
|
||||
ASSERT(!(zio->io_bp_override && (zio->io_flags & ZIO_FLAG_RAW)));
|
||||
|
||||
ddt_enter(ddt);
|
||||
dde = ddt_lookup(ddt, bp, B_TRUE);
|
||||
dde = ddt_lookup(ddt, bp);
|
||||
if (dde == NULL) {
|
||||
/* DDT size is over its quota so no new entries */
|
||||
zp->zp_dedup = B_FALSE;
|
||||
@@ -3598,7 +3598,7 @@ zio_ddt_free(zio_t *zio)
|
||||
ASSERT(zio->io_child_type == ZIO_CHILD_LOGICAL);
|
||||
|
||||
ddt_enter(ddt);
|
||||
freedde = dde = ddt_lookup(ddt, bp, B_TRUE);
|
||||
freedde = dde = ddt_lookup(ddt, bp);
|
||||
if (dde) {
|
||||
ddp = ddt_phys_select(dde, bp);
|
||||
if (ddp)
|
||||
|
||||
Reference in New Issue
Block a user