FreeBSD ZFS
The Zettabyte File System
Functions | Variables

ddt.c File Reference

#include <sys/zfs_context.h>
#include <sys/spa.h>
#include <sys/spa_impl.h>
#include <sys/zio.h>
#include <sys/ddt.h>
#include <sys/zap.h>
#include <sys/dmu_tx.h>
#include <sys/arc.h>
#include <sys/dsl_pool.h>
#include <sys/zio_checksum.h>
#include <sys/zio_compress.h>
#include <sys/dsl_scan.h>
Include dependency graph for ddt.c:

Go to the source code of this file.

Functions

 SYSCTL_DECL (_vfs_zfs)
 SYSCTL_NODE (_vfs_zfs, OID_AUTO, dedup, CTLFLAG_RW, 0,"ZFS DEDUP")
 TUNABLE_INT ("vfs.zfs.dedup.prefetch",&zfs_dedup_prefetch)
 SYSCTL_INT (_vfs_zfs_dedup, OID_AUTO, prefetch, CTLFLAG_RW,&zfs_dedup_prefetch, 0,"Enable/disable prefetching of dedup-ed blocks which are going to be freed")
static void ddt_object_create (ddt_t *ddt, enum ddt_type type, enum ddt_class class, dmu_tx_t *tx)
static void ddt_object_destroy (ddt_t *ddt, enum ddt_type type, enum ddt_class class, dmu_tx_t *tx)
static int ddt_object_load (ddt_t *ddt, enum ddt_type type, enum ddt_class class)
static void ddt_object_sync (ddt_t *ddt, enum ddt_type type, enum ddt_class class, dmu_tx_t *tx)
static int ddt_object_lookup (ddt_t *ddt, enum ddt_type type, enum ddt_class class, ddt_entry_t *dde)
static void ddt_object_prefetch (ddt_t *ddt, enum ddt_type type, enum ddt_class class, ddt_entry_t *dde)
int ddt_object_update (ddt_t *ddt, enum ddt_type type, enum ddt_class class, ddt_entry_t *dde, dmu_tx_t *tx)
static int ddt_object_remove (ddt_t *ddt, enum ddt_type type, enum ddt_class class, ddt_entry_t *dde, dmu_tx_t *tx)
int ddt_object_walk (ddt_t *ddt, enum ddt_type type, enum ddt_class class, uint64_t *walk, ddt_entry_t *dde)
uint64_t ddt_object_count (ddt_t *ddt, enum ddt_type type, enum ddt_class class)
int ddt_object_info (ddt_t *ddt, enum ddt_type type, enum ddt_class class, dmu_object_info_t *doi)
boolean_t ddt_object_exists (ddt_t *ddt, enum ddt_type type, enum ddt_class class)
void ddt_object_name (ddt_t *ddt, enum ddt_type type, enum ddt_class class, char *name)
void ddt_bp_fill (const ddt_phys_t *ddp, blkptr_t *bp, uint64_t txg)
void ddt_bp_create (enum zio_checksum checksum, const ddt_key_t *ddk, const ddt_phys_t *ddp, blkptr_t *bp)
void ddt_key_fill (ddt_key_t *ddk, const blkptr_t *bp)
void ddt_phys_fill (ddt_phys_t *ddp, const blkptr_t *bp)
void ddt_phys_clear (ddt_phys_t *ddp)
void ddt_phys_addref (ddt_phys_t *ddp)
void ddt_phys_decref (ddt_phys_t *ddp)
void ddt_phys_free (ddt_t *ddt, ddt_key_t *ddk, ddt_phys_t *ddp, uint64_t txg)
ddt_phys_tddt_phys_select (const ddt_entry_t *dde, const blkptr_t *bp)
uint64_t ddt_phys_total_refcnt (const ddt_entry_t *dde)
static void ddt_stat_generate (ddt_t *ddt, ddt_entry_t *dde, ddt_stat_t *dds)
void ddt_stat_add (ddt_stat_t *dst, const ddt_stat_t *src, uint64_t neg)
static void ddt_stat_update (ddt_t *ddt, ddt_entry_t *dde, uint64_t neg)
void ddt_histogram_add (ddt_histogram_t *dst, const ddt_histogram_t *src)
void ddt_histogram_stat (ddt_stat_t *dds, const ddt_histogram_t *ddh)
boolean_t ddt_histogram_empty (const ddt_histogram_t *ddh)
void ddt_get_dedup_object_stats (spa_t *spa, ddt_object_t *ddo_total)
void ddt_get_dedup_histogram (spa_t *spa, ddt_histogram_t *ddh)
void ddt_get_dedup_stats (spa_t *spa, ddt_stat_t *dds_total)
uint64_t ddt_get_dedup_dspace (spa_t *spa)
uint64_t ddt_get_pool_dedup_ratio (spa_t *spa)
int ddt_ditto_copies_needed (ddt_t *ddt, ddt_entry_t *dde, ddt_phys_t *ddp_willref)
int ddt_ditto_copies_present (ddt_entry_t *dde)
size_t ddt_compress (void *src, uchar_t *dst, size_t s_len, size_t d_len)
void ddt_decompress (uchar_t *src, void *dst, size_t s_len, size_t d_len)
ddt_tddt_select_by_checksum (spa_t *spa, enum zio_checksum c)
ddt_tddt_select (spa_t *spa, const blkptr_t *bp)
void ddt_enter (ddt_t *ddt)
void ddt_exit (ddt_t *ddt)
static ddt_entry_tddt_alloc (const ddt_key_t *ddk)
static void ddt_free (ddt_entry_t *dde)
void ddt_remove (ddt_t *ddt, ddt_entry_t *dde)
ddt_entry_tddt_lookup (ddt_t *ddt, const blkptr_t *bp, boolean_t add)
void ddt_prefetch (spa_t *spa, const blkptr_t *bp)
int ddt_entry_compare (const void *x1, const void *x2)
static ddt_tddt_table_alloc (spa_t *spa, enum zio_checksum c)
static void ddt_table_free (ddt_t *ddt)
void ddt_create (spa_t *spa)
int ddt_load (spa_t *spa)
void ddt_unload (spa_t *spa)
boolean_t ddt_class_contains (spa_t *spa, enum ddt_class max_class, const blkptr_t *bp)
ddt_entry_tddt_repair_start (ddt_t *ddt, const blkptr_t *bp)
void ddt_repair_done (ddt_t *ddt, ddt_entry_t *dde)
static void ddt_repair_entry_done (zio_t *zio)
static void ddt_repair_entry (ddt_t *ddt, ddt_entry_t *dde, ddt_entry_t *rdde, zio_t *rio)
static void ddt_repair_table (ddt_t *ddt, zio_t *rio)
static void ddt_sync_entry (ddt_t *ddt, ddt_entry_t *dde, dmu_tx_t *tx, uint64_t txg)
static void ddt_sync_table (ddt_t *ddt, dmu_tx_t *tx, uint64_t txg)
void ddt_sync (spa_t *spa, uint64_t txg)
int ddt_walk (spa_t *spa, ddt_bookmark_t *ddb, ddt_entry_t *dde)

Variables

int zfs_dedup_prefetch = 1
 Enable/disable prefetching of dedup-ed blocks which are going to be freed.
static const ddt_ops_tddt_ops [DDT_TYPES]
static const char * ddt_class_name [DDT_CLASSES]

Function Documentation

static ddt_entry_t* ddt_alloc ( const ddt_key_t ddk) [static]

Definition at line 638 of file ddt.c.

void ddt_bp_create ( enum zio_checksum  checksum,
const ddt_key_t ddk,
const ddt_phys_t ddp,
blkptr_t bp 
)

Definition at line 264 of file ddt.c.

void ddt_bp_fill ( const ddt_phys_t ddp,
blkptr_t bp,
uint64_t  txg 
)

Definition at line 254 of file ddt.c.

boolean_t ddt_class_contains ( spa_t spa,
enum ddt_class  max_class,
const blkptr_t bp 
)

Definition at line 866 of file ddt.c.

size_t ddt_compress ( void *  src,
uchar_t *  dst,
size_t  s_len,
size_t  d_len 
)

Definition at line 576 of file ddt.c.

void ddt_create ( spa_t spa)

Definition at line 811 of file ddt.c.

void ddt_decompress ( uchar_t *  src,
void *  dst,
size_t  s_len,
size_t  d_len 
)

Definition at line 598 of file ddt.c.

int ddt_ditto_copies_needed ( ddt_t ddt,
ddt_entry_t dde,
ddt_phys_t ddp_willref 
)

Definition at line 524 of file ddt.c.

int ddt_ditto_copies_present ( ddt_entry_t dde)

Definition at line 560 of file ddt.c.

void ddt_enter ( ddt_t ddt)

Definition at line 626 of file ddt.c.

int ddt_entry_compare ( const void *  x1,
const void *  x2 
)

Definition at line 763 of file ddt.c.

void ddt_exit ( ddt_t ddt)

Definition at line 632 of file ddt.c.

static void ddt_free ( ddt_entry_t dde) [static]

Definition at line 651 of file ddt.c.

uint64_t ddt_get_dedup_dspace ( spa_t spa)

Definition at line 503 of file ddt.c.

void ddt_get_dedup_histogram ( spa_t spa,
ddt_histogram_t *  ddh 
)

Definition at line 477 of file ddt.c.

void ddt_get_dedup_object_stats ( spa_t spa,
ddt_object_t *  ddo_total 
)

Definition at line 452 of file ddt.c.

void ddt_get_dedup_stats ( spa_t spa,
ddt_stat_t *  dds_total 
)

Definition at line 492 of file ddt.c.

uint64_t ddt_get_pool_dedup_ratio ( spa_t spa)

Definition at line 512 of file ddt.c.

void ddt_histogram_add ( ddt_histogram_t *  dst,
const ddt_histogram_t *  src 
)

Definition at line 423 of file ddt.c.

boolean_t ddt_histogram_empty ( const ddt_histogram_t *  ddh)

Definition at line 439 of file ddt.c.

void ddt_histogram_stat ( ddt_stat_t *  dds,
const ddt_histogram_t *  ddh 
)

Definition at line 430 of file ddt.c.

void ddt_key_fill ( ddt_key_t ddk,
const blkptr_t bp 
)

Definition at line 286 of file ddt.c.

int ddt_load ( spa_t spa)

Definition at line 820 of file ddt.c.

ddt_entry_t* ddt_lookup ( ddt_t ddt,
const blkptr_t bp,
boolean_t  add 
)

Definition at line 676 of file ddt.c.

uint64_t ddt_object_count ( ddt_t ddt,
enum ddt_type  type,
enum ddt_class  class 
)

Definition at line 219 of file ddt.c.

static void ddt_object_create ( ddt_t ddt,
enum ddt_type  type,
enum ddt_class  class,
dmu_tx_t tx 
) [static]

Definition at line 64 of file ddt.c.

static void ddt_object_destroy ( ddt_t ddt,
enum ddt_type  type,
enum ddt_class  class,
dmu_tx_t tx 
) [static]

Definition at line 88 of file ddt.c.

boolean_t ddt_object_exists ( ddt_t ddt,
enum ddt_type  type,
enum ddt_class  class 
)

Definition at line 239 of file ddt.c.

int ddt_object_info ( ddt_t ddt,
enum ddt_type  type,
enum ddt_class  class,
dmu_object_info_t doi 
)

Definition at line 228 of file ddt.c.

static int ddt_object_load ( ddt_t ddt,
enum ddt_type  type,
enum ddt_class  class 
) [static]

Definition at line 110 of file ddt.c.

static int ddt_object_lookup ( ddt_t ddt,
enum ddt_type  type,
enum ddt_class  class,
ddt_entry_t dde 
) [static]

Definition at line 167 of file ddt.c.

void ddt_object_name ( ddt_t ddt,
enum ddt_type  type,
enum ddt_class  class,
char *  name 
)

Definition at line 245 of file ddt.c.

static void ddt_object_prefetch ( ddt_t ddt,
enum ddt_type  type,
enum ddt_class  class,
ddt_entry_t dde 
) [static]

Definition at line 178 of file ddt.c.

static int ddt_object_remove ( ddt_t ddt,
enum ddt_type  type,
enum ddt_class  class,
ddt_entry_t dde,
dmu_tx_t tx 
) [static]

Definition at line 199 of file ddt.c.

static void ddt_object_sync ( ddt_t ddt,
enum ddt_type  type,
enum ddt_class  class,
dmu_tx_t tx 
) [static]

Definition at line 143 of file ddt.c.

int ddt_object_update ( ddt_t ddt,
enum ddt_type  type,
enum ddt_class  class,
ddt_entry_t dde,
dmu_tx_t tx 
)

Definition at line 189 of file ddt.c.

int ddt_object_walk ( ddt_t ddt,
enum ddt_type  type,
enum ddt_class  class,
uint64_t *  walk,
ddt_entry_t dde 
)

Definition at line 209 of file ddt.c.

void ddt_phys_addref ( ddt_phys_t ddp)

Definition at line 313 of file ddt.c.

void ddt_phys_clear ( ddt_phys_t ddp)

Definition at line 307 of file ddt.c.

void ddt_phys_decref ( ddt_phys_t ddp)

Definition at line 319 of file ddt.c.

void ddt_phys_fill ( ddt_phys_t ddp,
const blkptr_t bp 
)

Definition at line 297 of file ddt.c.

void ddt_phys_free ( ddt_t ddt,
ddt_key_t ddk,
ddt_phys_t ddp,
uint64_t  txg 
)

Definition at line 326 of file ddt.c.

ddt_phys_t* ddt_phys_select ( const ddt_entry_t dde,
const blkptr_t bp 
)

Definition at line 336 of file ddt.c.

uint64_t ddt_phys_total_refcnt ( const ddt_entry_t dde)

Definition at line 349 of file ddt.c.

void ddt_prefetch ( spa_t spa,
const blkptr_t bp 
)

Definition at line 739 of file ddt.c.

void ddt_remove ( ddt_t ddt,
ddt_entry_t dde 
)

Definition at line 667 of file ddt.c.

void ddt_repair_done ( ddt_t ddt,
ddt_entry_t dde 
)

Definition at line 918 of file ddt.c.

static void ddt_repair_entry ( ddt_t ddt,
ddt_entry_t dde,
ddt_entry_t rdde,
zio_t rio 
) [static]

Definition at line 942 of file ddt.c.

static void ddt_repair_entry_done ( zio_t zio) [static]

Definition at line 934 of file ddt.c.

ddt_entry_t* ddt_repair_start ( ddt_t ddt,
const blkptr_t bp 
)

Definition at line 890 of file ddt.c.

static void ddt_repair_table ( ddt_t ddt,
zio_t rio 
) [static]

Definition at line 969 of file ddt.c.

ddt_t* ddt_select ( spa_t spa,
const blkptr_t bp 
)

Definition at line 620 of file ddt.c.

ddt_t* ddt_select_by_checksum ( spa_t spa,
enum zio_checksum  c 
)

Definition at line 614 of file ddt.c.

void ddt_stat_add ( ddt_stat_t *  dst,
const ddt_stat_t *  src,
uint64_t  neg 
)

Definition at line 393 of file ddt.c.

static void ddt_stat_generate ( ddt_t ddt,
ddt_entry_t dde,
ddt_stat_t *  dds 
) [static]

Definition at line 360 of file ddt.c.

static void ddt_stat_update ( ddt_t ddt,
ddt_entry_t dde,
uint64_t  neg 
) [static]

Definition at line 406 of file ddt.c.

void ddt_sync ( spa_t spa,
uint64_t  txg 
)

Definition at line 1102 of file ddt.c.

static void ddt_sync_entry ( ddt_t ddt,
ddt_entry_t dde,
dmu_tx_t tx,
uint64_t  txg 
) [static]

Definition at line 994 of file ddt.c.

static void ddt_sync_table ( ddt_t ddt,
dmu_tx_t tx,
uint64_t  txg 
) [static]

Definition at line 1061 of file ddt.c.

static ddt_t* ddt_table_alloc ( spa_t spa,
enum zio_checksum  c 
) [static]

Definition at line 781 of file ddt.c.

static void ddt_table_free ( ddt_t ddt) [static]

Definition at line 800 of file ddt.c.

void ddt_unload ( spa_t spa)

Definition at line 855 of file ddt.c.

int ddt_walk ( spa_t spa,
ddt_bookmark_t ddb,
ddt_entry_t dde 
)

Definition at line 1126 of file ddt.c.

SYSCTL_DECL ( _vfs_zfs  )
SYSCTL_INT ( _vfs_zfs_dedup  ,
OID_AUTO  ,
prefetch  ,
CTLFLAG_RW  ,
zfs_dedup_prefetch,
,
"Enable/disable prefetching of dedup-ed blocks which are going to be freed"   
)
SYSCTL_NODE ( _vfs_zfs  ,
OID_AUTO  ,
dedup  ,
CTLFLAG_RW  ,
,
"ZFS DEDUP"   
)
TUNABLE_INT ( "vfs.zfs.dedup.prefetch"  ,
zfs_dedup_prefetch 
)

Variable Documentation

const char* ddt_class_name[DDT_CLASSES] [static]
Initial value:
 {
        "ditto",
        "duplicate",
        "unique",
}

Definition at line 57 of file ddt.c.

const ddt_ops_t* ddt_ops[DDT_TYPES] [static]
Initial value:
 {
        &ddt_zap_ops,
}

Definition at line 53 of file ddt.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines