FreeBSD ZFS
The Zettabyte File System
Data Structures | Functions | Variables

dsl_dir.c File Reference

#include <sys/dmu.h>
#include <sys/dmu_objset.h>
#include <sys/dmu_tx.h>
#include <sys/dsl_dataset.h>
#include <sys/dsl_dir.h>
#include <sys/dsl_prop.h>
#include <sys/dsl_synctask.h>
#include <sys/dsl_deleg.h>
#include <sys/spa.h>
#include <sys/metaslab.h>
#include <sys/zap.h>
#include <sys/zio.h>
#include <sys/arc.h>
#include <sys/sunddi.h>
#include <sys/zvol.h>
#include <sys/zfs_vfsops.h>
#include "zfs_namecheck.h"
Include dependency graph for dsl_dir.c:

Go to the source code of this file.

Data Structures

struct  tempreserve
struct  renamearg

Functions

static uint64_t dsl_dir_space_towrite (dsl_dir_t *dd)
static void dsl_dir_set_reservation_sync (void *arg1, void *arg2, dmu_tx_t *tx)
static void dsl_dir_evict (dmu_buf_t *db, void *arg)
int dsl_dir_open_obj (dsl_pool_t *dp, uint64_t ddobj, const char *tail, void *tag, dsl_dir_t **ddp)
void dsl_dir_close (dsl_dir_t *dd, void *tag)
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.
static int getcomponent (const char *path, char *component, const char **nextp)
int dsl_dir_open_spa (spa_t *spa, const char *name, void *tag, dsl_dir_t **ddp, const char **tailp)
 same as dsl_open_dir, ignore the first component of name and use the spa instead
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.
uint64_t dsl_dir_create_sync (dsl_pool_t *dp, dsl_dir_t *pds, const char *name, dmu_tx_t *tx)
int dsl_dir_destroy_check (void *arg1, void *arg2, dmu_tx_t *tx)
void dsl_dir_destroy_sync (void *arg1, void *tag, dmu_tx_t *tx)
boolean_t dsl_dir_is_clone (dsl_dir_t *dd)
void dsl_dir_stats (dsl_dir_t *dd, nvlist_t *nv)
void dsl_dir_dirty (dsl_dir_t *dd, dmu_tx_t *tx)
static int64_t parent_delta (dsl_dir_t *dd, uint64_t used, int64_t delta)
void dsl_dir_sync (dsl_dir_t *dd, dmu_tx_t *tx)
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.
static int dsl_dir_tempreserve_impl (dsl_dir_t *dd, uint64_t asize, boolean_t netfree, boolean_t ignorequota, boolean_t checkrefquota, list_t *tr_list, dmu_tx_t *tx, boolean_t first)
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.
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().
static void dsl_dir_willuse_space_impl (dsl_dir_t *dd, int64_t space, dmu_tx_t *tx)
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)
static int dsl_dir_set_quota_check (void *arg1, void *arg2, dmu_tx_t *tx)
static void dsl_dir_set_quota_sync (void *arg1, void *arg2, dmu_tx_t *tx)
int dsl_dir_set_quota (const char *ddname, zprop_source_t source, uint64_t quota)
int dsl_dir_set_reservation_check (void *arg1, void *arg2, dmu_tx_t *tx)
int dsl_dir_set_reservation (const char *ddname, zprop_source_t source, uint64_t reservation)
static dsl_dir_tclosest_common_ancestor (dsl_dir_t *ds1, dsl_dir_t *ds2)
static int64_t would_change (dsl_dir_t *dd, int64_t delta, dsl_dir_t *ancestor)
 If delta is applied to dd, how much of that delta would be applied to ancestor? Syncing context only.
static int dsl_dir_rename_check (void *arg1, void *arg2, dmu_tx_t *tx)
static void dsl_dir_rename_sync (void *arg1, void *arg2, dmu_tx_t *tx)
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)
timestruc_t dsl_dir_snap_cmtime (dsl_dir_t *dd)
void dsl_dir_snap_cmtime_update (dsl_dir_t *dd)

Variables

dsl_syncfunc_t dsl_prop_set_sync

Function Documentation

static dsl_dir_t* closest_common_ancestor ( dsl_dir_t ds1,
dsl_dir_t ds2 
) [static]

Definition at line 1212 of file dsl_dir.c.

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.

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

Definition at line 453 of file dsl_dir.c.

void dsl_dir_destroy_sync ( void *  arg1,
void *  tag,
dmu_tx_t tx 
)

Definition at line 485 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.

static void dsl_dir_evict ( dmu_buf_t db,
void *  arg 
) [static]

Definition at line 53 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.

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 **  ddp 
)

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 **  ddp,
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.

static int dsl_dir_rename_check ( void *  arg1,
void *  arg2,
dmu_tx_t tx 
) [static]

Definition at line 1247 of file dsl_dir.c.

static void dsl_dir_rename_sync ( void *  arg1,
void *  arg2,
dmu_tx_t tx 
) [static]

Definition at line 1295 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.

static int dsl_dir_set_quota_check ( void *  arg1,
void *  arg2,
dmu_tx_t tx 
) [static]

Definition at line 1017 of file dsl_dir.c.

static void dsl_dir_set_quota_sync ( void *  arg1,
void *  arg2,
dmu_tx_t tx 
) [static]

Definition at line 1051 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.

static void dsl_dir_set_reservation_sync ( void *  arg1,
void *  arg2,
dmu_tx_t tx 
) [static]

Definition at line 1152 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.

static uint64_t dsl_dir_space_towrite ( dsl_dir_t dd) [static]

Definition at line 609 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.

static int dsl_dir_tempreserve_impl ( dsl_dir_t dd,
uint64_t  asize,
boolean_t  netfree,
boolean_t  ignorequota,
boolean_t  checkrefquota,
list_t *  tr_list,
dmu_tx_t tx,
boolean_t  first 
) [static]

Definition at line 698 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.

static void dsl_dir_willuse_space_impl ( dsl_dir_t dd,
int64_t  space,
dmu_tx_t tx 
) [static]

Definition at line 909 of file dsl_dir.c.

static int getcomponent ( const char *  path,
char *  component,
const char **  nextp 
) [static]

Definition at line 255 of file dsl_dir.c.

static int64_t parent_delta ( dsl_dir_t dd,
uint64_t  used,
int64_t  delta 
) [static]

Definition at line 585 of file dsl_dir.c.

static int64_t would_change ( dsl_dir_t dd,
int64_t  delta,
dsl_dir_t ancestor 
) [static]

If delta is applied to dd, how much of that delta would be applied to ancestor? Syncing context only.

Definition at line 1229 of file dsl_dir.c.


Variable Documentation

dsl_syncfunc_t dsl_prop_set_sync
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines