FreeBSD ZFS
The Zettabyte File System
|
#include <sys/zfs_context.h>
#include <sys/dbuf.h>
#include <sys/dnode.h>
#include <sys/dmu.h>
#include <sys/dmu_impl.h>
#include <sys/dmu_tx.h>
#include <sys/dmu_objset.h>
#include <sys/dsl_dir.h>
#include <sys/dsl_dataset.h>
#include <sys/spa.h>
#include <sys/zio.h>
#include <sys/dmu_zfetch.h>
Go to the source code of this file.
Defines | |
#define | DNODE_STAT_ADD(stat) |
Define DNODE_STATS to turn on statistic gathering. | |
Functions | |
static int | free_range_compar (const void *node1, const void *node2) |
static int | dnode_cons (void *arg, void *unused, int kmflag) |
static void | dnode_dest (void *arg, void *unused) |
void | dnode_init (void) |
void | dnode_fini (void) |
void | dnode_byteswap (dnode_phys_t *dnp) |
void | dnode_buf_byteswap (void *vbuf, size_t size) |
void | dnode_setbonuslen (dnode_t *dn, int newsize, dmu_tx_t *tx) |
void | dnode_setbonus_type (dnode_t *dn, dmu_object_type_t newtype, dmu_tx_t *tx) |
void | dnode_rm_spill (dnode_t *dn, dmu_tx_t *tx) |
static void | dnode_setdblksz (dnode_t *dn, int size) |
static dnode_t * | dnode_create (objset_t *os, dnode_phys_t *dnp, dmu_buf_impl_t *db, uint64_t object, dnode_handle_t *dnh) |
static void | dnode_destroy (dnode_t *dn) |
Caller must be holding the dnode handle, which is released upon return. | |
void | dnode_allocate (dnode_t *dn, dmu_object_type_t ot, int blocksize, int ibs, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx) |
void | dnode_reallocate (dnode_t *dn, dmu_object_type_t ot, int blocksize, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx) |
static void | dnode_move_impl (dnode_t *odn, dnode_t *ndn) |
void | dnode_special_close (dnode_handle_t *dnh) |
dnode_t * | dnode_special_open (objset_t *os, dnode_phys_t *dnp, uint64_t object, dnode_handle_t *dnh) |
static void | dnode_buf_pageout (dmu_buf_t *db, void *arg) |
int | dnode_hold_impl (objset_t *os, uint64_t object, int flag, void *tag, dnode_t **dnp) |
Succeeds even for free dnodes. | |
int | dnode_hold (objset_t *os, uint64_t object, void *tag, dnode_t **dnp) |
boolean_t | dnode_add_ref (dnode_t *dn, void *tag) |
Can only add a reference if there is already at least one reference on the dnode. | |
void | dnode_rele (dnode_t *dn, void *tag) |
void | dnode_setdirty (dnode_t *dn, dmu_tx_t *tx) |
void | dnode_free (dnode_t *dn, dmu_tx_t *tx) |
int | dnode_set_blksz (dnode_t *dn, uint64_t size, int ibs, dmu_tx_t *tx) |
Try to change the block size for the indicated dnode. | |
void | dnode_new_blkid (dnode_t *dn, uint64_t blkid, dmu_tx_t *tx, boolean_t have_read) |
read-holding callers must not rely on the lock being continuously held | |
void | dnode_clear_range (dnode_t *dn, uint64_t blkid, uint64_t nblks, dmu_tx_t *tx) |
void | dnode_free_range (dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) |
static boolean_t | dnode_spill_freed (dnode_t *dn) |
uint64_t | dnode_block_freed (dnode_t *dn, uint64_t blkid) |
void | dnode_diduse_space (dnode_t *dn, int64_t delta) |
call from syncing context when we actually write/free space for this dnode | |
void | dnode_willuse_space (dnode_t *dn, int64_t space, dmu_tx_t *tx) |
Call when we think we're going to write/free space in open context. | |
static int | dnode_next_offset_level (dnode_t *dn, int flags, uint64_t *offset, int lvl, uint64_t blkfill, uint64_t txg) |
Scans a block at the indicated "level" looking for a hole or data (depending on 'flags'). | |
int | dnode_next_offset (dnode_t *dn, int flags, uint64_t *offset, int minlvl, uint64_t blkfill, uint64_t txg) |
Find the next hole, data, or sparse region at or after *offset. | |
Variables | |
static kmem_cache_t * | dnode_cache |
static dnode_phys_t | dnode_phys_zero |
int | zfs_default_bs = SPA_MINBLOCKSHIFT |
int | zfs_default_ibs = DN_MAX_INDBLKSHIFT |
#define DNODE_STAT_ADD | ( | stat | ) |
boolean_t dnode_add_ref | ( | dnode_t * | dn, |
void * | tag | ||
) |
void dnode_allocate | ( | dnode_t * | dn, |
dmu_object_type_t | ot, | ||
int | blocksize, | ||
int | ibs, | ||
dmu_object_type_t | bonustype, | ||
int | bonuslen, | ||
dmu_tx_t * | tx | ||
) |
uint64_t dnode_block_freed | ( | dnode_t * | dn, |
uint64_t | blkid | ||
) |
static void dnode_buf_pageout | ( | dmu_buf_t * | db, |
void * | arg | ||
) | [static] |
void dnode_byteswap | ( | dnode_phys_t * | dnp | ) |
static int dnode_cons | ( | void * | arg, |
void * | unused, | ||
int | kmflag | ||
) | [static] |
static dnode_t* dnode_create | ( | objset_t * | os, |
dnode_phys_t * | dnp, | ||
dmu_buf_impl_t * | db, | ||
uint64_t | object, | ||
dnode_handle_t * | dnh | ||
) | [static] |
static void dnode_dest | ( | void * | arg, |
void * | unused | ||
) | [static] |
static void dnode_destroy | ( | dnode_t * | dn | ) | [static] |
void dnode_diduse_space | ( | dnode_t * | dn, |
int64_t | delta | ||
) |
int dnode_next_offset | ( | dnode_t * | dn, |
int | flags, | ||
uint64_t * | offset, | ||
int | minlvl, | ||
uint64_t | blkfill, | ||
uint64_t | txg | ||
) |
Find the next hole, data, or sparse region at or after *offset.
The value 'blkfill' tells us how many items we expect to find in an L0 data block; this value is 1 for normal objects, DNODES_PER_BLOCK for the meta dnode, and some fraction of DNODES_PER_BLOCK when searching for sparse regions thereof.
Examples:
dnode_next_offset(dn, flags, offset, 1, 1, 0); Finds the next/previous hole/data in a file. Used in dmu_offset_next().
dnode_next_offset(mdn, flags, offset, 0, DNODES_PER_BLOCK, txg); Finds the next free/allocated dnode an objset's meta-dnode. Only finds objects that have new contents since txg (ie. bonus buffer changes and content removal are ignored). Used in dmu_object_next().
dnode_next_offset(mdn, DNODE_FIND_HOLE, offset, 2, DNODES_PER_BLOCK >> 2, 0); Finds the next L2 meta-dnode bp that's at most 1/4 full. Used in dmu_object_alloc().
static int dnode_next_offset_level | ( | dnode_t * | dn, |
int | flags, | ||
uint64_t * | offset, | ||
int | lvl, | ||
uint64_t | blkfill, | ||
uint64_t | txg | ||
) | [static] |
Scans a block at the indicated "level" looking for a hole or data (depending on 'flags').
If level > 0, then we are scanning an indirect block looking at its pointers. If level == 0, then we are looking at a block of dnodes. If we don't find what we are looking for in the block, we return ESRCH. Otherwise, return with *offset pointing to the beginning (if searching forwards) or end (if searching backwards) of the range covered by the block pointer we matched on (or dnode).
The basic search algorithm used below by dnode_next_offset() is to use this function to search up the block tree (widen the search) until we find something (i.e., we don't return ESRCH) and then search back down the tree (narrow the search) until we reach our original search level.
void dnode_reallocate | ( | dnode_t * | dn, |
dmu_object_type_t | ot, | ||
int | blocksize, | ||
dmu_object_type_t | bonustype, | ||
int | bonuslen, | ||
dmu_tx_t * | tx | ||
) |
void dnode_setbonus_type | ( | dnode_t * | dn, |
dmu_object_type_t | newtype, | ||
dmu_tx_t * | tx | ||
) |
static void dnode_setdblksz | ( | dnode_t * | dn, |
int | size | ||
) | [static] |
void dnode_special_close | ( | dnode_handle_t * | dnh | ) |
dnode_t* dnode_special_open | ( | objset_t * | os, |
dnode_phys_t * | dnp, | ||
uint64_t | object, | ||
dnode_handle_t * | dnh | ||
) |
static boolean_t dnode_spill_freed | ( | dnode_t * | dn | ) | [static] |
static int free_range_compar | ( | const void * | node1, |
const void * | node2 | ||
) | [static] |
kmem_cache_t* dnode_cache [static] |
dnode_phys_t dnode_phys_zero [static] |
int zfs_default_bs = SPA_MINBLOCKSHIFT |
int zfs_default_ibs = DN_MAX_INDBLKSHIFT |