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

sys/dsl_dir.h File Reference

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

Go to the source code of this file.

Data Structures

struct  dsl_dir_phys
struct  dsl_dir

Defines

#define DD_FLAG_USED_BREAKDOWN   (1<<0)
#define MOS_DIR_NAME   "$MOS"
#define ORIGIN_DIR_NAME   "$ORIGIN"
#define XLATION_DIR_NAME   "$XLATION"
#define FREE_DIR_NAME   "$FREE"
#define dprintf_dd(dd, fmt,...)

Typedefs

typedef enum dd_used dd_used_t
typedef struct dsl_dir_phys dsl_dir_phys_t

Enumerations

enum  dd_used {
  DD_USED_HEAD, DD_USED_SNAP, DD_USED_CHILD, DD_USED_CHILD_RSRV,
  DD_USED_REFRSRV, DD_USED_NUM
}

Functions

void dsl_dir_close (dsl_dir_t *dd, void *tag)
int dsl_dir_open (const char *name, void *tag, dsl_dir_t **, const char **tail)
 Return the dsl_dir_t, and possibly the last component which couldn't be found in *tail.
int dsl_dir_open_spa (spa_t *spa, const char *name, void *tag, dsl_dir_t **, const char **tailp)
 same as dsl_open_dir, ignore the first component of name and use the spa instead
int dsl_dir_open_obj (dsl_pool_t *dp, uint64_t ddobj, const char *tail, void *tag, dsl_dir_t **)
void dsl_dir_name (dsl_dir_t *dd, char *buf)
 buf must be long enough (MAXNAMELEN + strlen(MOS_DIR_NAME) + 1 should do)
int dsl_dir_namelen (dsl_dir_t *dd)
 Calculate name length, avoiding all the strcat calls of dsl_dir_name.
uint64_t dsl_dir_create_sync (dsl_pool_t *dp, dsl_dir_t *pds, const char *name, dmu_tx_t *tx)
void dsl_dir_stats (dsl_dir_t *dd, nvlist_t *nv)
uint64_t dsl_dir_space_available (dsl_dir_t *dd, dsl_dir_t *ancestor, int64_t delta, int ondiskonly)
 How much space would dd have available if ancestor had delta applied to it? If ondiskonly is set, we're only interested in what's on-disk, not estimated pending changes.
void dsl_dir_dirty (dsl_dir_t *dd, dmu_tx_t *tx)
void dsl_dir_sync (dsl_dir_t *dd, dmu_tx_t *tx)
int dsl_dir_tempreserve_space (dsl_dir_t *dd, uint64_t mem, uint64_t asize, uint64_t fsize, uint64_t usize, void **tr_cookiep, dmu_tx_t *tx)
 Reserve space in this dsl_dir, to be used in this tx's txg.
void dsl_dir_tempreserve_clear (void *tr_cookie, dmu_tx_t *tx)
 Clear a temporary reservation that we previously made with dsl_dir_tempreserve_space().
void dsl_dir_willuse_space (dsl_dir_t *dd, int64_t space, dmu_tx_t *tx)
 Call in open context when we think we're going to write/free space, eg.
void dsl_dir_diduse_space (dsl_dir_t *dd, dd_used_t type, int64_t used, int64_t compressed, int64_t uncompressed, dmu_tx_t *tx)
 call from syncing context when we actually write/free space for this dd
void dsl_dir_transfer_space (dsl_dir_t *dd, int64_t delta, dd_used_t oldtype, dd_used_t newtype, dmu_tx_t *tx)
int dsl_dir_set_quota (const char *ddname, zprop_source_t source, uint64_t quota)
int dsl_dir_set_reservation (const char *ddname, zprop_source_t source, uint64_t reservation)
int dsl_dir_rename (dsl_dir_t *dd, const char *newname, int flags)
int dsl_dir_transfer_possible (dsl_dir_t *sdd, dsl_dir_t *tdd, uint64_t space)
int dsl_dir_set_reservation_check (void *arg1, void *arg2, dmu_tx_t *tx)
boolean_t dsl_dir_is_clone (dsl_dir_t *dd)
void dsl_dir_new_refreservation (dsl_dir_t *dd, struct dsl_dataset *ds, uint64_t reservation, cred_t *cr, dmu_tx_t *tx)
void dsl_dir_snap_cmtime_update (dsl_dir_t *dd)
timestruc_t dsl_dir_snap_cmtime (dsl_dir_t *dd)

Variables

dsl_checkfunc_t dsl_dir_destroy_check
dsl_syncfunc_t dsl_dir_destroy_sync

Define Documentation

#define DD_FLAG_USED_BREAKDOWN   (1<<0)

Definition at line 51 of file dsl_dir.h.

#define dprintf_dd (   dd,
  fmt,
  ... 
)

Definition at line 174 of file dsl_dir.h.

#define FREE_DIR_NAME   "$FREE"

Definition at line 161 of file dsl_dir.h.

#define MOS_DIR_NAME   "$MOS"

Definition at line 158 of file dsl_dir.h.

#define ORIGIN_DIR_NAME   "$ORIGIN"

Definition at line 159 of file dsl_dir.h.

#define XLATION_DIR_NAME   "$XLATION"

Definition at line 160 of file dsl_dir.h.


Typedef Documentation

typedef enum dd_used dd_used_t
typedef struct dsl_dir_phys dsl_dir_phys_t

Enumeration Type Documentation

enum dd_used
Enumerator:
DD_USED_HEAD 
DD_USED_SNAP 
DD_USED_CHILD 
DD_USED_CHILD_RSRV 
DD_USED_REFRSRV 
DD_USED_NUM 

Definition at line 42 of file dsl_dir.h.


Function Documentation

void dsl_dir_close ( dsl_dir_t dd,
void *  tag 
)

Definition at line 201 of file dsl_dir.c.

uint64_t dsl_dir_create_sync ( dsl_pool_t dp,
dsl_dir_t pds,
const char *  name,
dmu_tx_t tx 
)

Definition at line 415 of file dsl_dir.c.

void dsl_dir_diduse_space ( dsl_dir_t dd,
dd_used_t  type,
int64_t  used,
int64_t  compressed,
int64_t  uncompressed,
dmu_tx_t tx 
)

call from syncing context when we actually write/free space for this dd

Definition at line 944 of file dsl_dir.c.

void dsl_dir_dirty ( dsl_dir_t dd,
dmu_tx_t tx 
)

Definition at line 572 of file dsl_dir.c.

boolean_t dsl_dir_is_clone ( dsl_dir_t dd)

Definition at line 523 of file dsl_dir.c.

void dsl_dir_name ( dsl_dir_t dd,
char *  buf 
)

buf must be long enough (MAXNAMELEN + strlen(MOS_DIR_NAME) + 1 should do)

Definition at line 210 of file dsl_dir.c.

int dsl_dir_namelen ( dsl_dir_t dd)

Calculate name length, avoiding all the strcat calls of dsl_dir_name.

Definition at line 233 of file dsl_dir.c.

void dsl_dir_new_refreservation ( dsl_dir_t dd,
struct dsl_dataset ds,
uint64_t  reservation,
cred_t *  cr,
dmu_tx_t tx 
)
int dsl_dir_open ( const char *  name,
void *  tag,
dsl_dir_t **  ddp,
const char **  tailp 
)

Return the dsl_dir_t, and possibly the last component which couldn't be found in *tail.

Return NULL if the path is bogus, or if tail==NULL and we couldn't parse the whole name. (*tail)[0] == '@' means that the last component is a snapshot.

Definition at line 409 of file dsl_dir.c.

int dsl_dir_open_obj ( dsl_pool_t dp,
uint64_t  ddobj,
const char *  tail,
void *  tag,
dsl_dir_t **   
)

Definition at line 80 of file dsl_dir.c.

int dsl_dir_open_spa ( spa_t spa,
const char *  name,
void *  tag,
dsl_dir_t **  ,
const char **  tailp 
)

same as dsl_open_dir, ignore the first component of name and use the spa instead

Definition at line 308 of file dsl_dir.c.

int dsl_dir_rename ( dsl_dir_t dd,
const char *  newname,
int  flags 
)

Definition at line 1356 of file dsl_dir.c.

int dsl_dir_set_quota ( const char *  ddname,
zprop_source_t  source,
uint64_t  quota 
)

Definition at line 1069 of file dsl_dir.c.

int dsl_dir_set_reservation ( const char *  ddname,
zprop_source_t  source,
uint64_t  reservation 
)

Definition at line 1181 of file dsl_dir.c.

int dsl_dir_set_reservation_check ( void *  arg1,
void *  arg2,
dmu_tx_t tx 
)

Definition at line 1105 of file dsl_dir.c.

timestruc_t dsl_dir_snap_cmtime ( dsl_dir_t dd)

Definition at line 1405 of file dsl_dir.c.

void dsl_dir_snap_cmtime_update ( dsl_dir_t dd)

Definition at line 1417 of file dsl_dir.c.

uint64_t dsl_dir_space_available ( dsl_dir_t dd,
dsl_dir_t ancestor,
int64_t  delta,
int  ondiskonly 
)

How much space would dd have available if ancestor had delta applied to it? If ondiskonly is set, we're only interested in what's on-disk, not estimated pending changes.

Definition at line 629 of file dsl_dir.c.

void dsl_dir_stats ( dsl_dir_t dd,
nvlist_t *  nv 
)

Definition at line 532 of file dsl_dir.c.

void dsl_dir_sync ( dsl_dir_t dd,
dmu_tx_t tx 
)

Definition at line 593 of file dsl_dir.c.

void dsl_dir_tempreserve_clear ( void *  tr_cookie,
dmu_tx_t tx 
)

Clear a temporary reservation that we previously made with dsl_dir_tempreserve_space().

Definition at line 878 of file dsl_dir.c.

int dsl_dir_tempreserve_space ( dsl_dir_t dd,
uint64_t  lsize,
uint64_t  asize,
uint64_t  fsize,
uint64_t  usize,
void **  tr_cookiep,
dmu_tx_t tx 
)

Reserve space in this dsl_dir, to be used in this tx's txg.

After the space has been dirtied (and dsl_dir_willuse_space() has been called), the reservation should be canceled, using dsl_dir_tempreserve_clear().

Definition at line 819 of file dsl_dir.c.

int dsl_dir_transfer_possible ( dsl_dir_t sdd,
dsl_dir_t tdd,
uint64_t  space 
)

Definition at line 1389 of file dsl_dir.c.

void dsl_dir_transfer_space ( dsl_dir_t dd,
int64_t  delta,
dd_used_t  oldtype,
dd_used_t  newtype,
dmu_tx_t tx 
)

Definition at line 991 of file dsl_dir.c.

void dsl_dir_willuse_space ( dsl_dir_t dd,
int64_t  space,
dmu_tx_t tx 
)

Call in open context when we think we're going to write/free space, eg.

when dirtying data. Be conservative (ie. OK to write less than this or free more than this, but don't write more or free less).

Definition at line 936 of file dsl_dir.c.


Variable Documentation

dsl_checkfunc_t dsl_dir_destroy_check

Definition at line 128 of file dsl_dir.h.

dsl_syncfunc_t dsl_dir_destroy_sync

Definition at line 129 of file dsl_dir.h.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines