usr/src/uts/common/fs/zfs/dsl_dataset.c
changeset 12450 c77e20e4e046
parent 12296 7cf402a7f374
child 12470 54258108784b
equal deleted inserted replaced
12449:a87750d92895 12450:c77e20e4e046
    37 #include <sys/zfs_ioctl.h>
    37 #include <sys/zfs_ioctl.h>
    38 #include <sys/spa.h>
    38 #include <sys/spa.h>
    39 #include <sys/zfs_znode.h>
    39 #include <sys/zfs_znode.h>
    40 #include <sys/zvol.h>
    40 #include <sys/zvol.h>
    41 #include <sys/dsl_scan.h>
    41 #include <sys/dsl_scan.h>
       
    42 
       
    43 /*
       
    44  * Enable/disable prefetching of dedup-ed blocks which are going to be freed.
       
    45  */
       
    46 int zfs_dedup_prefetch = 1;
    42 
    47 
    43 static char *dsl_reaper = "the grim reaper";
    48 static char *dsl_reaper = "the grim reaper";
    44 
    49 
    45 static dsl_checkfunc_t dsl_dataset_destroy_begin_check;
    50 static dsl_checkfunc_t dsl_dataset_destroy_begin_check;
    46 static dsl_syncfunc_t dsl_dataset_destroy_begin_sync;
    51 static dsl_syncfunc_t dsl_dataset_destroy_begin_sync;
   232 		trysnap = ds->ds_trysnap_txg;
   237 		trysnap = ds->ds_trysnap_txg;
   233 	return (MAX(ds->ds_phys->ds_prev_snap_txg, trysnap));
   238 	return (MAX(ds->ds_phys->ds_prev_snap_txg, trysnap));
   234 }
   239 }
   235 
   240 
   236 boolean_t
   241 boolean_t
   237 dsl_dataset_block_freeable(dsl_dataset_t *ds, uint64_t blk_birth)
   242 dsl_dataset_block_freeable(dsl_dataset_t *ds, const blkptr_t *bp,
   238 {
   243     uint64_t blk_birth)
   239 	return (blk_birth > dsl_dataset_prev_snap_txg(ds));
   244 {
       
   245 	if (blk_birth <= dsl_dataset_prev_snap_txg(ds))
       
   246 		return (B_FALSE);
       
   247 
       
   248 	if (zfs_dedup_prefetch && bp && BP_GET_DEDUP(bp))
       
   249 		ddt_prefetch(dsl_dataset_get_spa(ds), bp);
       
   250 
       
   251 	return (B_TRUE);
   240 }
   252 }
   241 
   253 
   242 /* ARGSUSED */
   254 /* ARGSUSED */
   243 static void
   255 static void
   244 dsl_dataset_evict(dmu_buf_t *db, void *dsv)
   256 dsl_dataset_evict(dmu_buf_t *db, void *dsv)