Print this page
*** NO COMMENTS ***

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/ddt.c
          +++ new/usr/src/uts/common/fs/zfs/ddt.c
↓ open down ↓ 279 lines elided ↑ open up ↑
 280  280          ddk->ddk_prop = 0;
 281  281  
 282  282          DDK_SET_LSIZE(ddk, BP_GET_LSIZE(bp));
 283  283          DDK_SET_PSIZE(ddk, BP_GET_PSIZE(bp));
 284  284          DDK_SET_COMPRESS(ddk, BP_GET_COMPRESS(bp));
 285  285  }
 286  286  
 287  287  void
 288  288  ddt_phys_fill(ddt_phys_t *ddp, const blkptr_t *bp)
 289  289  {
      290 +        ASSERT(ddp != NULL);
 290  291          ASSERT(ddp->ddp_phys_birth == 0);
 291  292  
 292  293          for (int d = 0; d < SPA_DVAS_PER_BP; d++)
 293  294                  ddp->ddp_dva[d] = bp->blk_dva[d];
 294  295          ddp->ddp_phys_birth = BP_PHYSICAL_BIRTH(bp);
 295  296  }
 296  297  
 297  298  void
 298  299  ddt_phys_clear(ddt_phys_t *ddp)
 299  300  {
 300      -        bzero(ddp, sizeof (*ddp));
      301 +        ASSERT(ddp != NULL);
      302 +        if (ddp) {
      303 +                bzero(ddp, sizeof (*ddp));
      304 +        }
 301  305  }
 302  306  
 303  307  void
 304  308  ddt_phys_addref(ddt_phys_t *ddp)
 305  309  {
 306      -        ddp->ddp_refcnt++;
      310 +        ASSERT(ddp != NULL);
      311 +        if (ddp) {
      312 +                ddp->ddp_refcnt++;
      313 +        }
 307  314  }
 308  315  
 309  316  void
 310  317  ddt_phys_decref(ddt_phys_t *ddp)
 311  318  {
 312      -        ASSERT((int64_t)ddp->ddp_refcnt > 0);
 313      -        ddp->ddp_refcnt--;
      319 +//      ASSERT(ddp != NULL);
      320 +        if (ddp) {
      321 +                ASSERT((int64_t)ddp->ddp_refcnt > 0);
      322 +                ddp->ddp_refcnt--;
      323 +        }
 314  324  }
 315  325  
 316  326  void
 317  327  ddt_phys_free(ddt_t *ddt, ddt_key_t *ddk, ddt_phys_t *ddp, uint64_t txg)
 318  328  {
 319  329          blkptr_t blk;
 320  330  
 321  331          ddt_bp_create(ddt->ddt_checksum, ddk, ddp, &blk);
 322  332          ddt_phys_clear(ddp);
 323  333          zio_free(ddt->ddt_spa, txg, &blk);
↓ open down ↓ 2 lines elided ↑ open up ↑
 326  336  ddt_phys_t *
 327  337  ddt_phys_select(const ddt_entry_t *dde, const blkptr_t *bp)
 328  338  {
 329  339          ddt_phys_t *ddp = (ddt_phys_t *)dde->dde_phys;
 330  340  
 331  341          for (int p = 0; p < DDT_PHYS_TYPES; p++, ddp++) {
 332  342                  if (DVA_EQUAL(BP_IDENTITY(bp), &ddp->ddp_dva[0]) &&
 333  343                      BP_PHYSICAL_BIRTH(bp) == ddp->ddp_phys_birth)
 334  344                          return (ddp);
 335  345          }
      346 +        (void) printf("ddt_phys_select() found nothing for "
      347 +            "DVA[BP]=<%llu:%llx:%llx> and phys_birth[BP]=%llu\n",
      348 +            (u_longlong_t)DVA_GET_VDEV(BP_IDENTITY(bp)),
      349 +            (u_longlong_t)DVA_GET_OFFSET(BP_IDENTITY(bp)),
      350 +            (u_longlong_t)DVA_GET_ASIZE(BP_IDENTITY(bp)),
      351 +            (u_longlong_t)BP_PHYSICAL_BIRTH(bp)
      352 +        );
 336  353          return (NULL);
 337  354  }
 338  355  
 339  356  uint64_t
 340  357  ddt_phys_total_refcnt(const ddt_entry_t *dde)
 341  358  {
 342  359          uint64_t refcnt = 0;
 343  360  
 344  361          for (int p = DDT_PHYS_SINGLE; p <= DDT_PHYS_TRIPLE; p++)
 345  362                  refcnt += dde->dde_phys[p].ddp_refcnt;
↓ open down ↓ 801 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX