FreeBSD ZFS
The Zettabyte File System
|
The 512-byte leaf is broken into 32 16-byte chunks. More...
#include <sys/zio.h>
#include <sys/spa.h>
#include <sys/dmu.h>
#include <sys/zfs_context.h>
#include <sys/fs/zfs.h>
#include <sys/zap.h>
#include <sys/zap_impl.h>
#include <sys/zap_leaf.h>
#include <sys/arc.h>
Go to the source code of this file.
Defines | |
#define | CHAIN_END 0xffff |
#define | MAX_ARRAY_BYTES (8<<10) |
#define | LEAF_HASH(l, h) |
#define | LEAF_HASH_ENTPTR(l, h) (&(l)->l_phys->l_hash[LEAF_HASH(l, h)]) |
#define | HCD_GTEQ(h1, cd1, h2, cd2) ((h1 > h2) ? TRUE : ((h1 == h2 && cd1 >= cd2) ? TRUE : FALSE)) |
Functions | |
static uint16_t * | zap_leaf_rehash_entry (zap_leaf_t *l, uint16_t entry) |
static void | zap_memset (void *a, int c, size_t n) |
static void | stv (int len, void *addr, uint64_t value) |
static uint64_t | ldv (int len, const void *addr) |
void | zap_leaf_byteswap (zap_leaf_phys_t *buf, int size) |
void | zap_leaf_init (zap_leaf_t *l, boolean_t sort) |
static uint16_t | zap_leaf_chunk_alloc (zap_leaf_t *l) |
static void | zap_leaf_chunk_free (zap_leaf_t *l, uint16_t chunk) |
static uint16_t | zap_leaf_array_create (zap_leaf_t *l, const char *buf, int integer_size, int num_integers) |
static void | zap_leaf_array_free (zap_leaf_t *l, uint16_t *chunkp) |
static void | zap_leaf_array_read (zap_leaf_t *l, uint16_t chunk, int array_int_len, int array_len, int buf_int_len, uint64_t buf_len, void *buf) |
static boolean_t | zap_leaf_array_match (zap_leaf_t *l, zap_name_t *zn, int chunk, int array_numints) |
int | zap_leaf_lookup (zap_leaf_t *l, zap_name_t *zn, zap_entry_handle_t *zeh) |
Lookup a ZAP Leaf. | |
int | zap_leaf_lookup_closest (zap_leaf_t *l, uint64_t h, uint32_t cd, zap_entry_handle_t *zeh) |
int | zap_entry_read (const zap_entry_handle_t *zeh, uint8_t integer_size, uint64_t num_integers, void *buf) |
Read the first num_integers in the attribute. | |
int | zap_entry_read_name (zap_t *zap, const zap_entry_handle_t *zeh, uint16_t buflen, char *buf) |
int | zap_entry_update (zap_entry_handle_t *zeh, uint8_t integer_size, uint64_t num_integers, const void *buf) |
Replace the value of an existing entry. | |
void | zap_entry_remove (zap_entry_handle_t *zeh) |
Remove an entry. | |
int | zap_entry_create (zap_leaf_t *l, zap_name_t *zn, uint32_t cd, uint8_t integer_size, uint64_t num_integers, const void *buf, zap_entry_handle_t *zeh) |
Create an entry. | |
boolean_t | zap_entry_normalization_conflict (zap_entry_handle_t *zeh, zap_name_t *zn, const char *name, zap_t *zap) |
Determine if there is another entry with the same normalized form. | |
static uint16_t | zap_leaf_transfer_array (zap_leaf_t *l, uint16_t chunk, zap_leaf_t *nl) |
static void | zap_leaf_transfer_entry (zap_leaf_t *l, int entry, zap_leaf_t *nl) |
void | zap_leaf_split (zap_leaf_t *l, zap_leaf_t *nl, boolean_t sort) |
Transfer the entries whose hash prefix ends in 1 to the new leaf. | |
void | zap_leaf_stats (zap_t *zap, zap_leaf_t *l, zap_stats_t *zs) |
The 512-byte leaf is broken into 32 16-byte chunks.
chunk number n means l_chunk[n], even though the header precedes it. the names are stored null-terminated.
Definition in file zap_leaf.c.
#define CHAIN_END 0xffff |
Definition at line 44 of file zap_leaf.c.
#define HCD_GTEQ | ( | h1, | |
cd1, | |||
h2, | |||
cd2 | |||
) | ((h1 > h2) ? TRUE : ((h1 == h2 && cd1 >= cd2) ? TRUE : FALSE)) |
Definition at line 445 of file zap_leaf.c.
#define LEAF_HASH | ( | l, | |
h | |||
) |
((ZAP_LEAF_HASH_NUMENTRIES(l)-1) & \ ((h) >> (64 - ZAP_LEAF_HASH_SHIFT(l)-(l)->l_phys->l_hdr.lh_prefix_len)))
Definition at line 49 of file zap_leaf.c.
#define LEAF_HASH_ENTPTR | ( | l, | |
h | |||
) | (&(l)->l_phys->l_hash[LEAF_HASH(l, h)]) |
Definition at line 53 of file zap_leaf.c.
#define MAX_ARRAY_BYTES (8<<10) |
Definition at line 47 of file zap_leaf.c.
static uint64_t ldv | ( | int | len, |
const void * | addr | ||
) | [static] |
Definition at line 87 of file zap_leaf.c.
static void stv | ( | int | len, |
void * | addr, | ||
uint64_t | value | ||
) | [static] |
Definition at line 67 of file zap_leaf.c.
int zap_entry_create | ( | zap_leaf_t * | l, |
struct zap_name * | zn, | ||
uint32_t | cd, | ||
uint8_t | integer_size, | ||
uint64_t | num_integers, | ||
const void * | buf, | ||
zap_entry_handle_t * | zeh | ||
) |
Create an entry.
An equal entry must not exist, and this entry must belong in this leaf (according to its hash value). Fills in the entry handle on success.
Definition at line 576 of file zap_leaf.c.
boolean_t zap_entry_normalization_conflict | ( | zap_entry_handle_t * | zeh, |
zap_name_t * | zn, | ||
const char * | name, | ||
zap_t * | zap | ||
) |
Determine if there is another entry with the same normalized form.
For performance purposes, either zn or name must be provided (the other can be NULL). Note, there usually won't be any hash conflicts, in which case we don't need the concatenated/normalized form of the name. But all callers have one of these on hand anyway, so might as well take advantage. A cleaner but slower interface would accept neither argument, and compute the normalized name as needed (using zap_name_alloc(zap_entry_read_name(zeh))).
Definition at line 677 of file zap_leaf.c.
int zap_entry_read | ( | const zap_entry_handle_t * | zeh, |
uint8_t | integer_size, | ||
uint64_t | num_integers, | ||
void * | buf | ||
) |
Read the first num_integers in the attribute.
Integer size conversion will be done without sign extension.
0 | Success |
EINVAL | integer_size is too small |
EOVERFLOW | There are more than num_integers in the attribute. |
Definition at line 491 of file zap_leaf.c.
int zap_entry_read_name | ( | zap_t * | zap, |
const zap_entry_handle_t * | zeh, | ||
uint16_t | buflen, | ||
char * | buf | ||
) |
Definition at line 512 of file zap_leaf.c.
void zap_entry_remove | ( | zap_entry_handle_t * | zeh | ) |
Remove an entry.
Definition at line 554 of file zap_leaf.c.
int zap_entry_update | ( | zap_entry_handle_t * | zeh, |
uint8_t | integer_size, | ||
uint64_t | num_integers, | ||
const void * | buf | ||
) |
Replace the value of an existing entry.
May fail if it runs out of space (ENOSPC).
Definition at line 532 of file zap_leaf.c.
static uint16_t zap_leaf_array_create | ( | zap_leaf_t * | l, |
const char * | buf, | ||
int | integer_size, | ||
int | num_integers | ||
) | [static] |
Definition at line 218 of file zap_leaf.c.
static void zap_leaf_array_free | ( | zap_leaf_t * | l, |
uint16_t * | chunkp | ||
) | [static] |
Definition at line 258 of file zap_leaf.c.
static boolean_t zap_leaf_array_match | ( | zap_leaf_t * | l, |
zap_name_t * | zn, | ||
int | chunk, | ||
int | array_numints | ||
) | [static] |
Definition at line 337 of file zap_leaf.c.
static void zap_leaf_array_read | ( | zap_leaf_t * | l, |
uint16_t | chunk, | ||
int | array_int_len, | ||
int | array_len, | ||
int | buf_int_len, | ||
uint64_t | buf_len, | ||
void * | buf | ||
) | [static] |
array_len | In units of integers, not bytes |
buf_len | In units of integers, not bytes |
Definition at line 278 of file zap_leaf.c.
void zap_leaf_byteswap | ( | zap_leaf_phys_t * | buf, |
int | size | ||
) |
Definition at line 104 of file zap_leaf.c.
static uint16_t zap_leaf_chunk_alloc | ( | zap_leaf_t * | l | ) | [static] |
Definition at line 180 of file zap_leaf.c.
static void zap_leaf_chunk_free | ( | zap_leaf_t * | l, |
uint16_t | chunk | ||
) | [static] |
Definition at line 198 of file zap_leaf.c.
void zap_leaf_init | ( | zap_leaf_t * | l, |
boolean_t | sort | ||
) |
Definition at line 156 of file zap_leaf.c.
int zap_leaf_lookup | ( | zap_leaf_t * | l, |
struct zap_name * | zn, | ||
zap_entry_handle_t * | zeh | ||
) |
Lookup a ZAP Leaf.
The hash value must equal zap_hash(name).
Definition at line 394 of file zap_leaf.c.
int zap_leaf_lookup_closest | ( | zap_leaf_t * | l, |
uint64_t | hash, | ||
uint32_t | cd, | ||
zap_entry_handle_t * | zeh | ||
) |
Definition at line 449 of file zap_leaf.c.
static uint16_t * zap_leaf_rehash_entry | ( | zap_leaf_t * | l, |
uint16_t | entry | ||
) | [static] |
Definition at line 716 of file zap_leaf.c.
void zap_leaf_split | ( | zap_leaf_t * | l, |
zap_leaf_t * | nl, | ||
boolean_t | sort | ||
) |
Transfer the entries whose hash prefix ends in 1 to the new leaf.
Definition at line 796 of file zap_leaf.c.
void zap_leaf_stats | ( | zap_t * | zap, |
zap_leaf_t * | l, | ||
zap_stats_t * | zs | ||
) |
Definition at line 835 of file zap_leaf.c.
static uint16_t zap_leaf_transfer_array | ( | zap_leaf_t * | l, |
uint16_t | chunk, | ||
zap_leaf_t * | nl | ||
) | [static] |
Definition at line 740 of file zap_leaf.c.
static void zap_leaf_transfer_entry | ( | zap_leaf_t * | l, |
int | entry, | ||
zap_leaf_t * | nl | ||
) | [static] |
Definition at line 768 of file zap_leaf.c.
static void zap_memset | ( | void * | a, |
int | c, | ||
size_t | n | ||
) | [static] |
Definition at line 57 of file zap_leaf.c.