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

sys/sa_impl.h File Reference

Zap attribute format for attribute registration. More...

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

Go to the source code of this file.

Data Structures

struct  sa_attr_table
 Array of known attributes and their various characteristics. More...
struct  sa_lot
 Each unique layout will have their own table sa_lot (layout_table) More...
struct  sa_idx_tab
 index table of offsets More...
struct  sa_os
 Since the offset/index information into the actual data will usually be identical we can share that information with all handles that have the exact same offsets. More...
struct  sa_hdr_phys
 header for all bonus and spill buffers. More...
struct  sa_handle
 Opaque handle used for most sa functions. More...

Defines

#define ATTR_BSWAP(x)   BF32_GET(x, 16, 8)
#define ATTR_LENGTH(x)   BF32_GET(x, 24, 16)
#define ATTR_NUM(x)   BF32_GET(x, 0, 16)
#define ATTR_ENCODE(x, attr, length, bswap)
#define TOC_OFF(x)   BF32_GET(x, 0, 23)
#define TOC_ATTR_PRESENT(x)   BF32_GET(x, 31, 1)
#define TOC_LEN_IDX(x)   BF32_GET(x, 24, 4)
#define TOC_ATTR_ENCODE(x, len_idx, offset)
#define SA_LAYOUTS   "LAYOUTS"
#define SA_REGISTRY   "REGISTRY"
#define SA_MAGIC   0x2F505A
#define SA_HDR_LAYOUT_NUM(hdr)   BF32_GET(hdr->sa_layout_info, 0, 10)
#define SA_HDR_SIZE(hdr)   BF32_GET_SB(hdr->sa_layout_info, 10, 6, 3, 0)
#define SA_HDR_LAYOUT_INFO_ENCODE(x, num, size)
#define SA_GET_DB(hdl, type)   (dmu_buf_impl_t *)((type == SA_BONUS) ? hdl->sa_bonus : hdl->sa_spill)
#define SA_GET_HDR(hdl, type)
#define SA_IDX_TAB_GET(hdl, type)   (type == SA_BONUS ? hdl->sa_bonus_tab : hdl->sa_spill_tab)
#define IS_SA_BONUSTYPE(a)   ((a == DMU_OT_SA) ? B_TRUE : B_FALSE)
#define SA_BONUSTYPE_FROM_DB(db)   (dmu_get_bonustype((dmu_buf_t *)db))
#define SA_BLKPTR_SPACE   (DN_MAX_BONUSLEN - sizeof (blkptr_t))
#define SA_LAYOUT_NUM(x, type)
#define SA_REGISTERED_LEN(sa, attr)   sa->sa_attr_table[attr].sa_length
#define SA_ATTR_LEN(sa, idx, attr, hdr)
#define SA_SET_HDR(hdr, num, size)
#define SA_ATTR_INFO(sa, idx, hdr, attr, bulk, type, hdl)
#define SA_HDR_SIZE_MATCH_LAYOUT(hdr, tb)

Typedefs

typedef struct sa_attr_table sa_attr_table_t
 Array of known attributes and their various characteristics.
typedef struct sa_lot sa_lot_t
 Each unique layout will have their own table sa_lot (layout_table)
typedef struct sa_idx_tab sa_idx_tab_t
 index table of offsets
typedef struct sa_hdr_phys sa_hdr_phys_t
 header for all bonus and spill buffers.
typedef enum sa_buf_type sa_buf_type_t
typedef enum sa_data_op sa_data_op_t

Enumerations

enum  sa_buf_type { SA_BONUS = 1, SA_SPILL = 2 }
enum  sa_data_op {
  SA_LOOKUP, SA_UPDATE, SA_ADD, SA_REPLACE,
  SA_REMOVE
}

Functions

int sa_add_impl (sa_handle_t *, sa_attr_type_t, uint32_t, sa_data_locator_t, void *, dmu_tx_t *)
void sa_register_update_callback_locked (objset_t *, sa_update_cb_t *)
int sa_size_locked (sa_handle_t *, sa_attr_type_t, int *)
void sa_default_locator (void **, uint32_t *, uint32_t, boolean_t, void *)
int sa_attr_size (sa_os_t *, sa_idx_tab_t *, sa_attr_type_t, uint16_t *, sa_hdr_phys_t *)

Detailed Description

Zap attribute format for attribute registration.

   64      56      48      40      32      24      16      8       0
   +-------+-------+-------+-------+-------+-------+-------+-------+
   |        unused         |      len      | bswap |   attr num    |
   +-------+-------+-------+-------+-------+-------+-------+-------+
 

Zap attribute format for layout information.

layout information is stored as an array of attribute numbers The name of the attribute is the layout number (0, 1, 2, ...)

   16       0
   +---- ---+
   | attr # |
   +--------+
   | attr # |
   +--- ----+
    ......
 

Definition in file sa_impl.h.


Define Documentation

#define ATTR_BSWAP (   x)    BF32_GET(x, 16, 8)

Definition at line 70 of file sa_impl.h.

#define ATTR_ENCODE (   x,
  attr,
  length,
  bswap 
)
Value:
{ \
        BF64_SET(x, 24, 16, length); \
        BF64_SET(x, 16, 8, bswap); \
        BF64_SET(x, 0, 16, attr); \
}

Definition at line 73 of file sa_impl.h.

#define ATTR_LENGTH (   x)    BF32_GET(x, 24, 16)

Definition at line 71 of file sa_impl.h.

#define ATTR_NUM (   x)    BF32_GET(x, 0, 16)

Definition at line 72 of file sa_impl.h.

#define IS_SA_BONUSTYPE (   a)    ((a == DMU_OT_SA) ? B_TRUE : B_FALSE)

Definition at line 233 of file sa_impl.h.

#define SA_ATTR_INFO (   sa,
  idx,
  hdr,
  attr,
  bulk,
  type,
  hdl 
)
Value:
{ \
                bulk.sa_size = SA_ATTR_LEN(sa, idx, attr, hdr); \
                bulk.sa_buftype = type; \
                bulk.sa_addr = \
                    (void *)((uintptr_t)TOC_OFF(idx->sa_idx_tab[attr]) + \
                    (uintptr_t)hdr); \
}

Definition at line 258 of file sa_impl.h.

#define SA_ATTR_LEN (   sa,
  idx,
  attr,
  hdr 
)
Value:
((SA_REGISTERED_LEN(sa, attr) == 0) ?\
        hdr->sa_lengths[TOC_LEN_IDX(idx->sa_idx_tab[attr])] : \
        SA_REGISTERED_LEN(sa, attr))

Definition at line 248 of file sa_impl.h.

#define SA_BLKPTR_SPACE   (DN_MAX_BONUSLEN - sizeof (blkptr_t))

Definition at line 239 of file sa_impl.h.

#define SA_BONUSTYPE_FROM_DB (   db)    (dmu_get_bonustype((dmu_buf_t *)db))

Definition at line 236 of file sa_impl.h.

#define SA_GET_DB (   hdl,
  type 
)    (dmu_buf_impl_t *)((type == SA_BONUS) ? hdl->sa_bonus : hdl->sa_spill)

Definition at line 223 of file sa_impl.h.

#define SA_GET_HDR (   hdl,
  type 
)
Value:
((sa_hdr_phys_t *)((dmu_buf_impl_t *)(SA_GET_DB(hdl, \
        type))->db.db_data))

Definition at line 226 of file sa_impl.h.

#define SA_HDR_LAYOUT_INFO_ENCODE (   x,
  num,
  size 
)
Value:
{ \
        BF32_SET_SB(x, 10, 6, 3, 0, size); \
        BF32_SET(x, 0, 10, num); \
}

Definition at line 189 of file sa_impl.h.

#define SA_HDR_LAYOUT_NUM (   hdr)    BF32_GET(hdr->sa_layout_info, 0, 10)

Definition at line 187 of file sa_impl.h.

#define SA_HDR_SIZE (   hdr)    BF32_GET_SB(hdr->sa_layout_info, 10, 6, 3, 0)

Definition at line 188 of file sa_impl.h.

#define SA_HDR_SIZE_MATCH_LAYOUT (   hdr,
  tb 
)
Value:
(SA_HDR_SIZE(hdr) == (sizeof (sa_hdr_phys_t) + \
        (tb->lot_var_sizes > 1 ? P2ROUNDUP((tb->lot_var_sizes - 1) * \
        sizeof (uint16_t), 8) : 0)))

Definition at line 267 of file sa_impl.h.

#define SA_IDX_TAB_GET (   hdl,
  type 
)    (type == SA_BONUS ? hdl->sa_bonus_tab : hdl->sa_spill_tab)

Definition at line 230 of file sa_impl.h.

#define SA_LAYOUT_NUM (   x,
  type 
)
Value:
((!IS_SA_BONUSTYPE(type) ? 0 : (((IS_SA_BONUSTYPE(type)) && \
        ((SA_HDR_LAYOUT_NUM(x)) == 0)) ? 1 : SA_HDR_LAYOUT_NUM(x))))

Definition at line 241 of file sa_impl.h.

#define SA_LAYOUTS   "LAYOUTS"

Definition at line 90 of file sa_impl.h.

#define SA_MAGIC   0x2F505A

Definition at line 153 of file sa_impl.h.

#define SA_REGISTERED_LEN (   sa,
  attr 
)    sa->sa_attr_table[attr].sa_length

Definition at line 246 of file sa_impl.h.

#define SA_REGISTRY   "REGISTRY"

Definition at line 91 of file sa_impl.h.

#define SA_SET_HDR (   hdr,
  num,
  size 
)
Value:
{ \
                hdr->sa_magic = SA_MAGIC; \
                SA_HDR_LAYOUT_INFO_ENCODE(hdr->sa_layout_info, num, size); \
        }

Definition at line 252 of file sa_impl.h.

#define TOC_ATTR_ENCODE (   x,
  len_idx,
  offset 
)
Value:
{ \
        BF32_SET(x, 31, 1, 1); \
        BF32_SET(x, 24, 7, len_idx); \
        BF32_SET(x, 0, 24, offset); \
}

Definition at line 83 of file sa_impl.h.

#define TOC_ATTR_PRESENT (   x)    BF32_GET(x, 31, 1)

Definition at line 81 of file sa_impl.h.

#define TOC_LEN_IDX (   x)    BF32_GET(x, 24, 4)

Definition at line 82 of file sa_impl.h.

#define TOC_OFF (   x)    BF32_GET(x, 0, 23)

Definition at line 80 of file sa_impl.h.


Typedef Documentation

Array of known attributes and their various characteristics.

typedef enum sa_buf_type sa_buf_type_t
typedef enum sa_data_op sa_data_op_t
typedef struct sa_hdr_phys sa_hdr_phys_t

header for all bonus and spill buffers.

The header has a fixed portion with a variable number of "lengths" depending on the number of variable sized attribues which are determined by the "layout number"

typedef struct sa_idx_tab sa_idx_tab_t

index table of offsets

typedef struct sa_lot sa_lot_t

Each unique layout will have their own table sa_lot (layout_table)


Enumeration Type Documentation

Enumerator:
SA_BONUS 
SA_SPILL 

Definition at line 195 of file sa_impl.h.

enum sa_data_op
Enumerator:
SA_LOOKUP 
SA_UPDATE 
SA_ADD 
SA_REPLACE 
SA_REMOVE 

Definition at line 200 of file sa_impl.h.


Function Documentation

int sa_add_impl ( sa_handle_t ,
sa_attr_type_t  ,
uint32_t  ,
sa_data_locator_t  ,
void *  ,
dmu_tx_t  
)
int sa_attr_size ( sa_os_t ,
sa_idx_tab_t ,
sa_attr_type_t  ,
uint16_t *  ,
sa_hdr_phys_t  
)
void sa_default_locator ( void **  ,
uint32_t *  ,
uint32_t  ,
boolean_t  ,
void *   
)

Definition at line 1540 of file sa.c.

void sa_register_update_callback_locked ( objset_t ,
sa_update_cb_t  
)

Definition at line 1926 of file sa.c.

int sa_size_locked ( sa_handle_t ,
sa_attr_type_t  ,
int *   
)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines