FreeBSD ZFS
The Zettabyte File System
|
#include <sys/zio.h>
#include <sys/spa.h>
#include <sys/dmu.h>
#include <sys/zfs_context.h>
#include <sys/zap.h>
#include <sys/refcount.h>
#include <sys/zap_impl.h>
#include <sys/zap_leaf.h>
#include <sys/avl.h>
#include <sys/arc.h>
#include <sys/sunddi.h>
Go to the source code of this file.
Functions | |
static int | mzap_upgrade (zap_t **zapp, dmu_tx_t *tx, zap_flags_t flags) |
uint64_t | zap_getflags (zap_t *zap) |
int | zap_hashbits (zap_t *zap) |
uint32_t | zap_maxcd (zap_t *zap) |
static uint64_t | zap_hash (zap_name_t *zn) |
static int | zap_normalize (zap_t *zap, const char *name, char *namenorm) |
boolean_t | zap_match (zap_name_t *zn, const char *matchname) |
void | zap_name_free (zap_name_t *zn) |
zap_name_t * | zap_name_alloc (zap_t *zap, const char *key, matchtype_t mt) |
zap_name_t * | zap_name_alloc_uint64 (zap_t *zap, const uint64_t *key, int numints) |
static void | mzap_byteswap (mzap_phys_t *buf, size_t size) |
void | zap_byteswap (void *buf, size_t size) |
static int | mze_compare (const void *arg1, const void *arg2) |
static int | mze_insert (zap_t *zap, int chunkid, uint64_t hash) |
static mzap_ent_t * | mze_find (zap_name_t *zn) |
static uint32_t | mze_find_unused_cd (zap_t *zap, uint64_t hash) |
static void | mze_remove (zap_t *zap, mzap_ent_t *mze) |
static void | mze_destroy (zap_t *zap) |
static zap_t * | mzap_open (objset_t *os, uint64_t obj, dmu_buf_t *db) |
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) |
static void | mzap_create_impl (objset_t *os, uint64_t obj, int normflags, zap_flags_t flags, dmu_tx_t *tx) |
int | zap_create_claim (objset_t *os, uint64_t obj, dmu_object_type_t ot, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx) |
Create a new zapobj with no attributes from the given (unallocated) object number. | |
int | zap_create_claim_norm (objset_t *os, uint64_t obj, int normflags, dmu_object_type_t ot, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx) |
uint64_t | zap_create (objset_t *os, dmu_object_type_t ot, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx) |
Create a new zapobj with no attributes and return its object number. | |
uint64_t | zap_create_norm (objset_t *os, int normflags, dmu_object_type_t ot, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx) |
uint64_t | zap_create_flags (objset_t *os, int normflags, zap_flags_t flags, dmu_object_type_t ot, int leaf_blockshift, int indirect_blockshift, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx) |
int | zap_destroy (objset_t *os, uint64_t zapobj, dmu_tx_t *tx) |
Destroy this zapobj and all its attributes. | |
void | zap_evict (dmu_buf_t *db, void *vzap) |
int | zap_count (objset_t *os, uint64_t zapobj, uint64_t *count) |
Get the number of attributes in the specified zap object. | |
static boolean_t | mzap_normalization_conflict (zap_t *zap, zap_name_t *zn, mzap_ent_t *mze) |
zn may be NULL; if not specified, it will be computed if needed. | |
int | zap_lookup (objset_t *os, uint64_t zapobj, const char *name, uint64_t integer_size, uint64_t num_integers, void *buf) |
Routines for manipulating attributes. | |
int | zap_lookup_norm (objset_t *os, uint64_t zapobj, const char *name, uint64_t integer_size, uint64_t num_integers, void *buf, matchtype_t mt, char *realname, int rn_len, boolean_t *ncp) |
int | zap_prefetch_uint64 (objset_t *os, uint64_t zapobj, const uint64_t *key, int key_numints) |
int | zap_lookup_uint64 (objset_t *os, uint64_t zapobj, const uint64_t *key, int key_numints, uint64_t integer_size, uint64_t num_integers, void *buf) |
int | zap_contains (objset_t *os, uint64_t zapobj, const char *name) |
int | zap_length (objset_t *os, uint64_t zapobj, const char *name, uint64_t *integer_size, uint64_t *num_integers) |
Get the length (in integers) and the integer size of the specified attribute. | |
int | zap_length_uint64 (objset_t *os, uint64_t zapobj, const uint64_t *key, int key_numints, uint64_t *integer_size, uint64_t *num_integers) |
static void | mzap_addent (zap_name_t *zn, uint64_t value) |
int | zap_add (objset_t *os, uint64_t zapobj, const char *key, int integer_size, uint64_t num_integers, const void *val, dmu_tx_t *tx) |
Create an attribute with the given name and value. | |
int | zap_add_uint64 (objset_t *os, uint64_t zapobj, const uint64_t *key, int key_numints, int integer_size, uint64_t num_integers, const void *val, dmu_tx_t *tx) |
int | zap_update (objset_t *os, uint64_t zapobj, const char *name, int integer_size, uint64_t num_integers, const void *val, dmu_tx_t *tx) |
Set the attribute with the given name to the given value. | |
int | zap_update_uint64 (objset_t *os, uint64_t zapobj, const uint64_t *key, int key_numints, int integer_size, uint64_t num_integers, const void *val, dmu_tx_t *tx) |
int | zap_remove (objset_t *os, uint64_t zapobj, const char *name, dmu_tx_t *tx) |
Remove the specified attribute. | |
int | zap_remove_norm (objset_t *os, uint64_t zapobj, const char *name, matchtype_t mt, dmu_tx_t *tx) |
int | zap_remove_uint64 (objset_t *os, uint64_t zapobj, const uint64_t *key, int key_numints, dmu_tx_t *tx) |
void | zap_cursor_init_serialized (zap_cursor_t *zc, objset_t *os, uint64_t zapobj, uint64_t serialized) |
void | zap_cursor_init (zap_cursor_t *zc, objset_t *os, uint64_t zapobj) |
Initialize a zap cursor, pointing to the "first" attribute of the zapobj. | |
void | zap_cursor_fini (zap_cursor_t *zc) |
uint64_t | zap_cursor_serialize (zap_cursor_t *zc) |
Get a persistent cookie pointing to the current position of the zap cursor. | |
int | zap_cursor_retrieve (zap_cursor_t *zc, zap_attribute_t *za) |
Get the attribute currently pointed to by the cursor. | |
void | zap_cursor_advance (zap_cursor_t *zc) |
Advance the cursor to the next attribute. | |
int | zap_cursor_move_to_key (zap_cursor_t *zc, const char *name, matchtype_t mt) |
int | zap_get_stats (objset_t *os, uint64_t zapobj, zap_stats_t *zs) |
Get statistics about a ZAP object. | |
int | zap_count_write (objset_t *os, uint64_t zapobj, const char *name, int add, uint64_t *towrite, uint64_t *tooverwrite) |
static void mzap_addent | ( | zap_name_t * | zn, |
uint64_t | value | ||
) | [static] |
Definition at line 941 of file zap_micro.c.
static void mzap_byteswap | ( | mzap_phys_t * | buf, |
size_t | size | ||
) | [static] |
Definition at line 219 of file zap_micro.c.
static void mzap_create_impl | ( | objset_t * | os, |
uint64_t | obj, | ||
int | normflags, | ||
zap_flags_t | flags, | ||
dmu_tx_t * | tx | ||
) | [static] |
Definition at line 587 of file zap_micro.c.
static boolean_t mzap_normalization_conflict | ( | zap_t * | zap, |
zap_name_t * | zn, | ||
mzap_ent_t * | mze | ||
) | [static] |
zn may be NULL; if not specified, it will be computed if needed.
See also the comment above zap_entry_normalization_conflict().
Definition at line 729 of file zap_micro.c.
Definition at line 366 of file zap_micro.c.
static int mzap_upgrade | ( | zap_t ** | zapp, |
dmu_tx_t * | tx, | ||
zap_flags_t | flags | ||
) | [static] |
Definition at line 537 of file zap_micro.c.
static int mze_compare | ( | const void * | arg1, |
const void * | arg2 | ||
) | [static] |
Definition at line 250 of file zap_micro.c.
static void mze_destroy | ( | zap_t * | zap | ) | [static] |
Definition at line 355 of file zap_micro.c.
static mzap_ent_t* mze_find | ( | zap_name_t * | zn | ) | [static] |
Definition at line 289 of file zap_micro.c.
static uint32_t mze_find_unused_cd | ( | zap_t * | zap, |
uint64_t | hash | ||
) | [static] |
Definition at line 319 of file zap_micro.c.
static int mze_insert | ( | zap_t * | zap, |
int | chunkid, | ||
uint64_t | hash | ||
) | [static] |
Definition at line 267 of file zap_micro.c.
static void mze_remove | ( | zap_t * | zap, |
mzap_ent_t * | mze | ||
) | [static] |
Definition at line 345 of file zap_micro.c.
int zap_add | ( | objset_t * | ds, |
uint64_t | zapobj, | ||
const char * | key, | ||
int | integer_size, | ||
uint64_t | num_integers, | ||
const void * | val, | ||
dmu_tx_t * | tx | ||
) |
Create an attribute with the given name and value.
EEXIST | An attribute with the given name already exists |
Definition at line 985 of file zap_micro.c.
int zap_add_uint64 | ( | objset_t * | os, |
uint64_t | zapobj, | ||
const uint64_t * | key, | ||
int | key_numints, | ||
int | integer_size, | ||
uint64_t | num_integers, | ||
const void * | val, | ||
dmu_tx_t * | tx | ||
) |
Definition at line 1028 of file zap_micro.c.
void zap_byteswap | ( | void * | buf, |
size_t | size | ||
) |
Definition at line 235 of file zap_micro.c.
int zap_contains | ( | objset_t * | os, |
uint64_t | zapobj, | ||
const char * | name | ||
) |
Definition at line 874 of file zap_micro.c.
int zap_count | ( | objset_t * | ds, |
uint64_t | zapobj, | ||
uint64_t * | count | ||
) |
Get the number of attributes in the specified zap object.
[out] | count | The number of attributes |
Definition at line 707 of file zap_micro.c.
int zap_count_write | ( | objset_t * | os, |
uint64_t | zapobj, | ||
const char * | name, | ||
int | add, | ||
uint64_t * | towrite, | ||
uint64_t * | tooverwrite | ||
) |
Definition at line 1394 of file zap_micro.c.
uint64_t zap_create | ( | objset_t * | ds, |
dmu_object_type_t | ot, | ||
dmu_object_type_t | bonustype, | ||
int | bonuslen, | ||
dmu_tx_t * | tx | ||
) |
Create a new zapobj with no attributes and return its object number.
MT_EXACT will cause the zap object to only support MT_EXACT lookups, otherwise any matchtype can be used for lookups.
normflags specifies what normalization will be done. values are: 0: no normalization (legacy on-disk format, supports MT_EXACT matching only) U8_TEXTPREP_TOLOWER: case normalization will be performed. MT_FIRST/MT_BEST matching will find entries that match without regard to case (eg. looking for "foo" can find an entry "Foo"). Eventually, other flags will permit unicode normalization as well.
Definition at line 643 of file zap_micro.c.
int zap_create_claim | ( | objset_t * | os, |
uint64_t | obj, | ||
dmu_object_type_t | ot, | ||
dmu_object_type_t | bonustype, | ||
int | bonuslen, | ||
dmu_tx_t * | tx | ||
) |
Create a new zapobj with no attributes from the given (unallocated) object number.
Definition at line 621 of file zap_micro.c.
int zap_create_claim_norm | ( | objset_t * | os, |
uint64_t | obj, | ||
int | normflags, | ||
dmu_object_type_t | ot, | ||
dmu_object_type_t | bonustype, | ||
int | bonuslen, | ||
dmu_tx_t * | tx | ||
) |
Definition at line 629 of file zap_micro.c.
uint64_t zap_create_flags | ( | objset_t * | os, |
int | normflags, | ||
zap_flags_t | flags, | ||
dmu_object_type_t | ot, | ||
int | leaf_blockshift, | ||
int | indirect_blockshift, | ||
dmu_object_type_t | bonustype, | ||
int | bonuslen, | ||
dmu_tx_t * | tx | ||
) |
Definition at line 660 of file zap_micro.c.
uint64_t zap_create_norm | ( | objset_t * | os, |
int | normflags, | ||
dmu_object_type_t | ot, | ||
dmu_object_type_t | bonustype, | ||
int | bonuslen, | ||
dmu_tx_t * | tx | ||
) |
Definition at line 650 of file zap_micro.c.
void zap_cursor_advance | ( | zap_cursor_t * | zc | ) |
Advance the cursor to the next attribute.
Definition at line 1323 of file zap_micro.c.
void zap_cursor_fini | ( | zap_cursor_t * | zc | ) |
Definition at line 1220 of file zap_micro.c.
void zap_cursor_init | ( | zap_cursor_t * | zc, |
objset_t * | ds, | ||
uint64_t | zapobj | ||
) |
Initialize a zap cursor, pointing to the "first" attribute of the zapobj.
You must _fini the cursor when you are done with it.
Definition at line 1214 of file zap_micro.c.
void zap_cursor_init_serialized | ( | zap_cursor_t * | zc, |
objset_t * | os, | ||
uint64_t | zapobj, | ||
uint64_t | serialized | ||
) |
Definition at line 1201 of file zap_micro.c.
int zap_cursor_move_to_key | ( | zap_cursor_t * | zc, |
const char * | name, | ||
matchtype_t | mt | ||
) |
Definition at line 1331 of file zap_micro.c.
int zap_cursor_retrieve | ( | zap_cursor_t * | zc, |
zap_attribute_t * | za | ||
) |
Get the attribute currently pointed to by the cursor.
ENOENT | At the end of the attributes. |
Definition at line 1258 of file zap_micro.c.
uint64_t zap_cursor_serialize | ( | zap_cursor_t * | zc | ) |
Get a persistent cookie pointing to the current position of the zap cursor.
The low 4 bits in the cookie are always zero, and thus can be used as to differentiate a serialized cookie from a different type of value. The cookie will be less than 2^32 as long as there are fewer than 2^22 (4.2 million) entries in the zap object.
Definition at line 1236 of file zap_micro.c.
Destroy this zapobj and all its attributes.
Frees the object number using dmu_object_free.
Definition at line 679 of file zap_micro.c.
void zap_evict | ( | dmu_buf_t * | db, |
void * | vzap | ||
) |
Definition at line 692 of file zap_micro.c.
int zap_get_stats | ( | objset_t * | ds, |
uint64_t | zapobj, | ||
zap_stats_t * | zs | ||
) |
Get statistics about a ZAP object.
Definition at line 1371 of file zap_micro.c.
uint64_t zap_getflags | ( | zap_t * | zap | ) |
Definition at line 44 of file zap_micro.c.
static uint64_t zap_hash | ( | zap_name_t * | zn | ) | [static] |
Definition at line 70 of file zap_micro.c.
int zap_hashbits | ( | zap_t * | zap | ) |
Definition at line 52 of file zap_micro.c.
int zap_length | ( | objset_t * | ds, |
uint64_t | zapobj, | ||
const char * | name, | ||
uint64_t * | integer_size, | ||
uint64_t * | num_integers | ||
) |
Get the length (in integers) and the integer size of the specified attribute.
ENOENT | The requested attribute does not exist |
Definition at line 884 of file zap_micro.c.
int zap_length_uint64 | ( | objset_t * | os, |
uint64_t | zapobj, | ||
const uint64_t * | key, | ||
int | key_numints, | ||
uint64_t * | integer_size, | ||
uint64_t * | num_integers | ||
) |
Definition at line 919 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.
int zap_lookup | ( | objset_t * | os, |
uint64_t | zapobj, | ||
const char * | name, | ||
uint64_t | integer_size, | ||
uint64_t | num_integers, | ||
void * | buf | ||
) |
Routines for manipulating attributes.
Retrieve the contents of the attribute with the given name.
Definition at line 770 of file zap_micro.c.
int zap_lookup_norm | ( | objset_t * | ds, |
uint64_t | zapobj, | ||
const char * | name, | ||
uint64_t | integer_size, | ||
uint64_t | num_integers, | ||
void * | buf, | ||
matchtype_t | mt, | ||
char * | realname, | ||
int | rn_len, | ||
boolean_t * | ncp | ||
) |
[in] | rn_len | If nonzero, realname will be set to the name of the found entry (which may be different from the requested name if matchtype is not MT_EXACT). |
[in,out] | ncp | If not NULL, it will be set if there is another name with the same case/unicode normalized form. |
Definition at line 778 of file zap_micro.c.
int zap_lookup_uint64 | ( | objset_t * | os, |
uint64_t | zapobj, | ||
const uint64_t * | key, | ||
int | key_numints, | ||
uint64_t | integer_size, | ||
uint64_t | num_integers, | ||
void * | buf | ||
) |
Definition at line 850 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.
zap_name_t* zap_name_alloc_uint64 | ( | zap_t * | zap, |
const uint64_t * | key, | ||
int | numints | ||
) |
Definition at line 203 of file zap_micro.c.
void zap_name_free | ( | zap_name_t * | zn | ) |
Definition at line 167 of file zap_micro.c.
static int zap_normalize | ( | zap_t * | zap, |
const char * | name, | ||
char * | namenorm | ||
) | [static] |
Definition at line 130 of file zap_micro.c.
int zap_prefetch_uint64 | ( | objset_t * | os, |
uint64_t | zapobj, | ||
const uint64_t * | key, | ||
int | key_numints | ||
) |
Definition at line 827 of file zap_micro.c.
Remove the specified attribute.
ENOENT | The specified attribute does not exist |
Definition at line 1134 of file zap_micro.c.
int zap_remove_norm | ( | objset_t * | os, |
uint64_t | zapobj, | ||
const char * | name, | ||
matchtype_t | mt, | ||
dmu_tx_t * | tx | ||
) |
Definition at line 1140 of file zap_micro.c.
int zap_remove_uint64 | ( | objset_t * | os, |
uint64_t | zapobj, | ||
const uint64_t * | key, | ||
int | key_numints, | ||
dmu_tx_t * | tx | ||
) |
Definition at line 1175 of file zap_micro.c.
void zap_unlockdir | ( | zap_t * | zap | ) |
Definition at line 530 of file zap_micro.c.
int zap_update | ( | objset_t * | ds, |
uint64_t | zapobj, | ||
const char * | name, | ||
int | integer_size, | ||
uint64_t | num_integers, | ||
const void * | val, | ||
dmu_tx_t * | tx | ||
) |
Set the attribute with the given name to the given value.
If an attribute with the given name does not exist, it will be created. If an attribute with the given name already exists, the previous value will be overwritten. The integer_size may be different from the existing attribute's integer size, in which case the attribute's integer size will be updated to the new value.
Definition at line 1053 of file zap_micro.c.
int zap_update_uint64 | ( | objset_t * | os, |
uint64_t | zapobj, | ||
const uint64_t * | key, | ||
int | key_numints, | ||
int | integer_size, | ||
uint64_t | num_integers, | ||
const void * | val, | ||
dmu_tx_t * | tx | ||
) |
Definition at line 1109 of file zap_micro.c.