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

sys/space_map.h File Reference

debug entry More...

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

Go to the source code of this file.

Data Structures

struct  space_map
struct  space_seg
struct  space_ref
struct  space_map_obj
struct  space_map_ops

Defines

#define SM_RUN_DECODE(x)   (BF64_DECODE(x, 0, 15) + 1)
#define SM_RUN_ENCODE(x)   BF64_ENCODE((x) - 1, 0, 15)
#define SM_TYPE_DECODE(x)   BF64_DECODE(x, 15, 1)
#define SM_TYPE_ENCODE(x)   BF64_ENCODE(x, 15, 1)
#define SM_OFFSET_DECODE(x)   BF64_DECODE(x, 16, 47)
#define SM_OFFSET_ENCODE(x)   BF64_ENCODE(x, 16, 47)
#define SM_DEBUG_DECODE(x)   BF64_DECODE(x, 63, 1)
#define SM_DEBUG_ENCODE(x)   BF64_ENCODE(x, 63, 1)
#define SM_DEBUG_ACTION_DECODE(x)   BF64_DECODE(x, 60, 3)
#define SM_DEBUG_ACTION_ENCODE(x)   BF64_ENCODE(x, 60, 3)
#define SM_DEBUG_SYNCPASS_DECODE(x)   BF64_DECODE(x, 50, 10)
#define SM_DEBUG_SYNCPASS_ENCODE(x)   BF64_ENCODE(x, 50, 10)
#define SM_DEBUG_TXG_DECODE(x)   BF64_DECODE(x, 0, 50)
#define SM_DEBUG_TXG_ENCODE(x)   BF64_ENCODE(x, 0, 50)
#define SM_RUN_MAX   SM_RUN_DECODE(~0ULL)
#define SM_ALLOC   0x0
#define SM_FREE   0x1
#define SPACE_MAP_BLOCKSHIFT   12
 The data for a given space map can be kept on blocks of any size.

Typedefs

typedef struct space_map_ops space_map_ops_t
typedef struct space_map space_map_t
typedef struct space_seg space_seg_t
typedef struct space_ref space_ref_t
typedef struct space_map_obj space_map_obj_t
typedef void space_map_func_t (space_map_t *sm, uint64_t start, uint64_t size)

Functions

void space_map_create (space_map_t *sm, uint64_t start, uint64_t size, uint8_t shift, kmutex_t *lp)
void space_map_destroy (space_map_t *sm)
void space_map_add (space_map_t *sm, uint64_t start, uint64_t size)
void space_map_remove (space_map_t *sm, uint64_t start, uint64_t size)
boolean_t space_map_contains (space_map_t *sm, uint64_t start, uint64_t size)
void space_map_vacate (space_map_t *sm, space_map_func_t *func, space_map_t *mdest)
void space_map_walk (space_map_t *sm, space_map_func_t *func, space_map_t *mdest)
void space_map_load_wait (space_map_t *sm)
 Wait for any in-progress space_map_load() to complete.
int space_map_load (space_map_t *sm, space_map_ops_t *ops, uint8_t maptype, space_map_obj_t *smo, objset_t *os)
 Note: space_map_load() will drop sm_lock across dmu_read() calls.
void space_map_unload (space_map_t *sm)
uint64_t space_map_alloc (space_map_t *sm, uint64_t size)
void space_map_claim (space_map_t *sm, uint64_t start, uint64_t size)
void space_map_free (space_map_t *sm, uint64_t start, uint64_t size)
uint64_t space_map_maxsize (space_map_t *sm)
void space_map_sync (space_map_t *sm, uint8_t maptype, space_map_obj_t *smo, objset_t *os, dmu_tx_t *tx)
 Note: space_map_sync() will drop sm_lock across dmu_write() calls.
void space_map_truncate (space_map_obj_t *smo, objset_t *os, dmu_tx_t *tx)
void space_map_ref_create (avl_tree_t *t)
void space_map_ref_destroy (avl_tree_t *t)
void space_map_ref_add_seg (avl_tree_t *t, uint64_t start, uint64_t end, int64_t refcnt)
void space_map_ref_add_map (avl_tree_t *t, space_map_t *sm, int64_t refcnt)
 Convert (or add) a space map into a reference tree.
void space_map_ref_generate_map (avl_tree_t *t, space_map_t *sm, int64_t minref)
 Convert a reference tree into a space map.

Detailed Description

debug entry

     1      3         10                     50
   ,---+--------+------------+---------------------------------.
   | 1 | action |  syncpass  |        txg (lower bits)         |
   `---+--------+------------+---------------------------------'
    63  62    60 59        50 49                               0
 

non-debug entry

     1               47                   1           15
   ,-----------------------------------------------------------.
   | 0 |   offset (sm_shift units)    | type |       run       |
   `-----------------------------------------------------------'
    63  62                          17   16   15               0
 

Definition in file space_map.h.


Define Documentation

#define SM_ALLOC   0x0

Definition at line 126 of file space_map.h.

#define SM_DEBUG_ACTION_DECODE (   x)    BF64_DECODE(x, 60, 3)

Definition at line 115 of file space_map.h.

#define SM_DEBUG_ACTION_ENCODE (   x)    BF64_ENCODE(x, 60, 3)

Definition at line 116 of file space_map.h.

#define SM_DEBUG_DECODE (   x)    BF64_DECODE(x, 63, 1)

Definition at line 112 of file space_map.h.

#define SM_DEBUG_ENCODE (   x)    BF64_ENCODE(x, 63, 1)

Definition at line 113 of file space_map.h.

#define SM_DEBUG_SYNCPASS_DECODE (   x)    BF64_DECODE(x, 50, 10)

Definition at line 118 of file space_map.h.

#define SM_DEBUG_SYNCPASS_ENCODE (   x)    BF64_ENCODE(x, 50, 10)

Definition at line 119 of file space_map.h.

#define SM_DEBUG_TXG_DECODE (   x)    BF64_DECODE(x, 0, 50)

Definition at line 121 of file space_map.h.

#define SM_DEBUG_TXG_ENCODE (   x)    BF64_ENCODE(x, 0, 50)

Definition at line 122 of file space_map.h.

#define SM_FREE   0x1

Definition at line 127 of file space_map.h.

#define SM_OFFSET_DECODE (   x)    BF64_DECODE(x, 16, 47)

Definition at line 110 of file space_map.h.

#define SM_OFFSET_ENCODE (   x)    BF64_ENCODE(x, 16, 47)

Definition at line 111 of file space_map.h.

#define SM_RUN_DECODE (   x)    (BF64_DECODE(x, 0, 15) + 1)

Definition at line 106 of file space_map.h.

#define SM_RUN_ENCODE (   x)    BF64_ENCODE((x) - 1, 0, 15)

Definition at line 107 of file space_map.h.

#define SM_RUN_MAX   SM_RUN_DECODE(~0ULL)

Definition at line 124 of file space_map.h.

#define SM_TYPE_DECODE (   x)    BF64_DECODE(x, 15, 1)

Definition at line 108 of file space_map.h.

#define SM_TYPE_ENCODE (   x)    BF64_ENCODE(x, 15, 1)

Definition at line 109 of file space_map.h.

#define SPACE_MAP_BLOCKSHIFT   12

The data for a given space map can be kept on blocks of any size.

Larger blocks entail fewer i/o operations, but they also cause the DMU to keep more data in-core, and also to waste more i/o bandwidth when only a few blocks have changed since the last transaction group. This could use a lot more research, but for now, set the freelist block size to 4k (2^12).

Definition at line 137 of file space_map.h.


Typedef Documentation

typedef void space_map_func_t(space_map_t *sm, uint64_t start, uint64_t size)

Definition at line 139 of file space_map.h.

Definition at line 36 of file space_map.h.

typedef struct space_map space_map_t
typedef struct space_ref space_ref_t
typedef struct space_seg space_seg_t

Function Documentation

void space_map_add ( space_map_t sm,
uint64_t  start,
uint64_t  size 
)

Definition at line 94 of file space_map.c.

uint64_t space_map_alloc ( space_map_t sm,
uint64_t  size 
)

Definition at line 403 of file space_map.c.

void space_map_claim ( space_map_t sm,
uint64_t  start,
uint64_t  size 
)

Definition at line 414 of file space_map.c.

boolean_t space_map_contains ( space_map_t sm,
uint64_t  start,
uint64_t  size 
)

Definition at line 236 of file space_map.c.

void space_map_create ( space_map_t sm,
uint64_t  start,
uint64_t  size,
uint8_t  shift,
kmutex_t *  lp 
)

Definition at line 68 of file space_map.c.

void space_map_destroy ( space_map_t sm)

Definition at line 85 of file space_map.c.

void space_map_free ( space_map_t sm,
uint64_t  start,
uint64_t  size 
)

Definition at line 421 of file space_map.c.

int space_map_load ( space_map_t sm,
space_map_ops_t ops,
uint8_t  maptype,
space_map_obj_t smo,
objset_t os 
)

Note: space_map_load() will drop sm_lock across dmu_read() calls.

The caller must be OK with this.

Definition at line 300 of file space_map.c.

void space_map_load_wait ( space_map_t sm)

Wait for any in-progress space_map_load() to complete.

Definition at line 285 of file space_map.c.

uint64_t space_map_maxsize ( space_map_t sm)

Definition at line 396 of file space_map.c.

void space_map_ref_add_map ( avl_tree_t *  t,
space_map_t sm,
int64_t  refcnt 
)

Convert (or add) a space map into a reference tree.

Definition at line 601 of file space_map.c.

void space_map_ref_add_seg ( avl_tree_t *  t,
uint64_t  start,
uint64_t  end,
int64_t  refcnt 
)

Definition at line 590 of file space_map.c.

void space_map_ref_create ( avl_tree_t *  t)

Definition at line 559 of file space_map.c.

void space_map_ref_destroy ( avl_tree_t *  t)

Definition at line 566 of file space_map.c.

void space_map_ref_generate_map ( avl_tree_t *  t,
space_map_t sm,
int64_t  minref 
)

Convert a reference tree into a space map.

The space map will contain all members of the reference tree for which refcnt >= minref.

Definition at line 616 of file space_map.c.

void space_map_remove ( space_map_t sm,
uint64_t  start,
uint64_t  size 
)

Definition at line 179 of file space_map.c.

void space_map_sync ( space_map_t sm,
uint8_t  maptype,
space_map_obj_t smo,
objset_t os,
dmu_tx_t tx 
)

Note: space_map_sync() will drop sm_lock across dmu_write() calls.

Definition at line 431 of file space_map.c.

void space_map_truncate ( space_map_obj_t smo,
objset_t os,
dmu_tx_t tx 
)

Definition at line 510 of file space_map.c.

void space_map_unload ( space_map_t sm)

Definition at line 382 of file space_map.c.

void space_map_vacate ( space_map_t sm,
space_map_func_t func,
space_map_t mdest 
)

Definition at line 255 of file space_map.c.

void space_map_walk ( space_map_t sm,
space_map_func_t func,
space_map_t mdest 
)

Definition at line 271 of file space_map.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines