FreeBSD ZFS
The Zettabyte File System
Data Structures | Defines | Typedefs | Functions | Variables

sys/zap_impl.h File Reference

#include <sys/zap.h>
#include <sys/zfs_context.h>
#include <sys/avl.h>
Include dependency graph for zap_impl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mzap_ent_phys
struct  mzap_phys
struct  mzap_ent
struct  zap_phys
 This structure is followed by padding, and then the embedded pointer table. More...
struct  zap_phys::zap_table_phys
struct  zap
struct  zap_name

Defines

#define ZAP_MAGIC   0x2F52AB2ABULL
#define FZAP_BLOCK_SHIFT(zap)   ((zap)->zap_f.zap_block_shift)
#define MZAP_ENT_LEN   64
#define MZAP_NAME_LEN   (MZAP_ENT_LEN - 8 - 4 - 2)
#define MZAP_MAX_BLKSHIFT   SPA_MAXBLOCKSHIFT
#define MZAP_MAX_BLKSZ   (1 << MZAP_MAX_BLKSHIFT)
#define ZAP_NEED_CD   (-1U)
#define MZE_PHYS(zap, mze)   (&(zap)->zap_m.zap_phys->mz_chunk[(mze)->mze_chunkid])
#define ZBT_LEAF   ((1ULL << 63) + 0)
#define ZBT_HEADER   ((1ULL << 63) + 1)
#define ZBT_MICRO   ((1ULL << 63) + 3)
#define ZAP_EMBEDDED_PTRTBL_SHIFT(zap)   (FZAP_BLOCK_SHIFT(zap) - 3 - 1)
 the embedded pointer table takes up half a block: block size / entry size (2^3) / 2
#define ZAP_EMBEDDED_PTRTBL_ENT(zap, idx)
 The embedded pointer table starts half-way through the block.
#define zap_f   zap_u.zap_fat
#define zap_m   zap_u.zap_micro
#define ZAP_HASH_IDX(hash, n)   (((n) == 0) ? 0 : ((hash) >> (64 - (n))))

Typedefs

typedef struct mzap_ent_phys mzap_ent_phys_t
typedef struct mzap_phys mzap_phys_t
typedef struct mzap_ent mzap_ent_t
typedef struct zap_phys zap_phys_t
 This structure is followed by padding, and then the embedded pointer table.
typedef struct zap_table_phys zap_table_phys_t
typedef struct zap zap_t
typedef struct zap_name zap_name_t

Functions

boolean_t zap_match (zap_name_t *zn, const char *matchname)
int zap_lockdir (objset_t *os, uint64_t obj, dmu_tx_t *tx, krw_t lti, boolean_t fatreader, boolean_t adding, zap_t **zapp)
void zap_unlockdir (zap_t *zap)
void zap_evict (dmu_buf_t *db, void *vmzap)
zap_name_tzap_name_alloc (zap_t *zap, const char *key, matchtype_t mt)
void zap_name_free (zap_name_t *zn)
int zap_hashbits (zap_t *zap)
uint32_t zap_maxcd (zap_t *zap)
uint64_t zap_getflags (zap_t *zap)
void fzap_byteswap (void *buf, size_t size)
int fzap_count (zap_t *zap, uint64_t *count)
int fzap_lookup (zap_name_t *zn, uint64_t integer_size, uint64_t num_integers, void *buf, char *realname, int rn_len, boolean_t *normalization_conflictp)
 Routines for manipulating attributes.
void fzap_prefetch (zap_name_t *zn)
int fzap_count_write (zap_name_t *zn, int add, uint64_t *towrite, uint64_t *tooverwrite)
int fzap_add (zap_name_t *zn, uint64_t integer_size, uint64_t num_integers, const void *val, dmu_tx_t *tx)
int fzap_update (zap_name_t *zn, int integer_size, uint64_t num_integers, const void *val, dmu_tx_t *tx)
int fzap_length (zap_name_t *zn, uint64_t *integer_size, uint64_t *num_integers)
int fzap_remove (zap_name_t *zn, dmu_tx_t *tx)
int fzap_cursor_retrieve (zap_t *zap, zap_cursor_t *zc, zap_attribute_t *za)
void fzap_get_stats (zap_t *zap, zap_stats_t *zs)
void zap_put_leaf (struct zap_leaf *l)
int fzap_add_cd (zap_name_t *zn, uint64_t integer_size, uint64_t num_integers, const void *val, uint32_t cd, dmu_tx_t *tx)
void fzap_upgrade (zap_t *zap, dmu_tx_t *tx, zap_flags_t flags)
int fzap_cursor_move_to_key (zap_cursor_t *zc, zap_name_t *zn)

Variables

int fzap_default_block_shift

Define Documentation

#define FZAP_BLOCK_SHIFT (   zap)    ((zap)->zap_f.zap_block_shift)

Definition at line 40 of file zap_impl.h.

#define MZAP_ENT_LEN   64

Definition at line 42 of file zap_impl.h.

#define MZAP_MAX_BLKSHIFT   SPA_MAXBLOCKSHIFT

Definition at line 44 of file zap_impl.h.

#define MZAP_MAX_BLKSZ   (1 << MZAP_MAX_BLKSHIFT)

Definition at line 45 of file zap_impl.h.

#define MZAP_NAME_LEN   (MZAP_ENT_LEN - 8 - 4 - 2)

Definition at line 43 of file zap_impl.h.

#define MZE_PHYS (   zap,
  mze 
)    (&(zap)->zap_m.zap_phys->mz_chunk[(mze)->mze_chunkid])

Definition at line 72 of file zap_impl.h.

#define ZAP_EMBEDDED_PTRTBL_ENT (   zap,
  idx 
)
Value:
((uint64_t *)(zap)->zap_f.zap_phys) \
        [(idx) + (1<<ZAP_EMBEDDED_PTRTBL_SHIFT(zap))]

The embedded pointer table starts half-way through the block.

Since the pointer table itself is half the block, it starts at (64-bit) word number (1<<ZAP_EMBEDDED_PTRTBL_SHIFT(zap)).

Definition at line 106 of file zap_impl.h.

#define ZAP_EMBEDDED_PTRTBL_SHIFT (   zap)    (FZAP_BLOCK_SHIFT(zap) - 3 - 1)

the embedded pointer table takes up half a block: block size / entry size (2^3) / 2

Definition at line 99 of file zap_impl.h.

#define zap_f   zap_u.zap_fat

Definition at line 178 of file zap_impl.h.

#define ZAP_HASH_IDX (   hash,
 
)    (((n) == 0) ? 0 : ((hash) >> (64 - (n))))

Definition at line 192 of file zap_impl.h.

#define zap_m   zap_u.zap_micro

Definition at line 179 of file zap_impl.h.

#define ZAP_MAGIC   0x2F52AB2ABULL

Definition at line 38 of file zap_impl.h.

#define ZAP_NEED_CD   (-1U)

Definition at line 47 of file zap_impl.h.

#define ZBT_HEADER   ((1ULL << 63) + 1)

Definition at line 91 of file zap_impl.h.

#define ZBT_LEAF   ((1ULL << 63) + 0)

Definition at line 90 of file zap_impl.h.

#define ZBT_MICRO   ((1ULL << 63) + 3)

Definition at line 92 of file zap_impl.h.


Typedef Documentation

typedef struct mzap_ent mzap_ent_t
typedef struct mzap_phys mzap_phys_t
typedef struct zap_name zap_name_t
typedef struct zap_phys zap_phys_t

This structure is followed by padding, and then the embedded pointer table.

The embedded pointer table takes up second half of the block. It is accessed using the ZAP_EMBEDDED_PTRTBL_ENT() macro.

Note:
If zap_phys_t is modified, zap_byteswap() must be modified.
typedef struct zap zap_t
typedef struct zap_table_phys zap_table_phys_t

Definition at line 138 of file zap_impl.h.


Function Documentation

int fzap_add ( zap_name_t zn,
uint64_t  integer_size,
uint64_t  num_integers,
const void *  val,
dmu_tx_t tx 
)

Definition at line 835 of file zap.c.

int fzap_add_cd ( zap_name_t zn,
uint64_t  integer_size,
uint64_t  num_integers,
const void *  val,
uint32_t  cd,
dmu_tx_t tx 
)

Definition at line 791 of file zap.c.

void fzap_byteswap ( void *  buf,
size_t  size 
)

Definition at line 60 of file zap.c.

int fzap_count ( zap_t zap,
uint64_t *  count 
)

Definition at line 421 of file zap.c.

int fzap_count_write ( zap_name_t zn,
int  add,
uint64_t *  towrite,
uint64_t *  tooverwrite 
)

Definition at line 1328 of file zap.c.

int fzap_cursor_move_to_key ( zap_cursor_t zc,
zap_name_t zn 
)

Definition at line 1248 of file zap.c.

int fzap_cursor_retrieve ( zap_t zap,
zap_cursor_t zc,
zap_attribute_t za 
)

Definition at line 1153 of file zap.c.

void fzap_get_stats ( zap_t zap,
zap_stats_t zs 
)

Definition at line 1273 of file zap.c.

int fzap_length ( zap_name_t zn,
uint64_t *  integer_size,
uint64_t *  num_integers 
)

Definition at line 891 of file zap.c.

int fzap_lookup ( zap_name_t zn,
uint64_t  integer_size,
uint64_t  num_integers,
void *  buf,
char *  realname,
int  rn_len,
boolean_t *  normalization_conflictp 
)

Routines for manipulating attributes.

Definition at line 757 of file zap.c.

void fzap_prefetch ( zap_name_t zn)

Definition at line 934 of file zap.c.

int fzap_remove ( zap_name_t zn,
dmu_tx_t tx 
)

Definition at line 915 of file zap.c.

int fzap_update ( zap_name_t zn,
int  integer_size,
uint64_t  num_integers,
const void *  val,
dmu_tx_t tx 
)

Definition at line 848 of file zap.c.

void fzap_upgrade ( zap_t zap,
dmu_tx_t tx,
zap_flags_t  flags 
)

Definition at line 75 of file zap.c.

void zap_evict ( dmu_buf_t db,
void *  vmzap 
)

Definition at line 692 of file zap_micro.c.

uint64_t zap_getflags ( zap_t zap)

Definition at line 44 of file zap_micro.c.

int zap_hashbits ( zap_t zap)

Definition at line 52 of file zap_micro.c.

int zap_lockdir ( objset_t os,
uint64_t  obj,
dmu_tx_t tx,
krw_t  lti,
boolean_t  fatreader,
boolean_t  adding,
zap_t **  zapp 
)

Definition at line 457 of file zap_micro.c.

boolean_t zap_match ( zap_name_t zn,
const char *  matchname 
)

Definition at line 149 of file zap_micro.c.

uint32_t zap_maxcd ( zap_t zap)

Definition at line 61 of file zap_micro.c.

zap_name_t* zap_name_alloc ( zap_t zap,
const char *  key,
matchtype_t  mt 
)

Definition at line 173 of file zap_micro.c.

void zap_name_free ( zap_name_t zn)

Definition at line 167 of file zap_micro.c.

void zap_put_leaf ( struct zap_leaf l)

Definition at line 435 of file zap.c.

void zap_unlockdir ( zap_t zap)

Definition at line 530 of file zap_micro.c.


Variable Documentation

Definition at line 53 of file zap.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines