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

sys/dsl_dataset.h File Reference

#include <sys/dmu.h>
#include <sys/spa.h>
#include <sys/txg.h>
#include <sys/zio.h>
#include <sys/bplist.h>
#include <sys/dsl_synctask.h>
#include <sys/zfs_context.h>
#include <sys/dsl_deadlist.h>
#include <sys/dsl_synctask.h>
#include <sys/dsl_deadlist.h>
Include dependency graph for dsl_dataset.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dsl_dataset_phys
struct  dsl_dataset
struct  dsl_ds_destroyarg
struct  dsl_ds_holdarg

Defines

#define DS_FLAG_INCONSISTENT   (1ULL<<0)
#define DS_IS_INCONSISTENT(ds)   ((ds)->ds_phys->ds_flags & DS_FLAG_INCONSISTENT)
#define DS_FLAG_NOPROMOTE   (1ULL<<1)
 NB: nopromote can not yet be set, but we want support for it in this on-disk version, so that we don't need to upgrade for it later.
#define DS_FLAG_UNIQUE_ACCURATE   (1ULL<<2)
 DS_FLAG_UNIQUE_ACCURATE is set if ds_unique_bytes has been correctly calculated for head datasets (starting with SPA_VERSION_UNIQUE_ACCURATE, refquota/refreservations).
#define DS_FLAG_DEFER_DESTROY   (1ULL<<3)
 DS_FLAG_DEFER_DESTROY is set after 'zfs destroy -d' has been called on a dataset.
#define DS_IS_DEFER_DESTROY(ds)   ((ds)->ds_phys->ds_flags & DS_FLAG_DEFER_DESTROY)
#define DS_FLAG_CI_DATASET   (1ULL<<16)
 DS_FLAG_CI_DATASET is set if the dataset contains a file system whose name lookups should be performed case-insensitively.
#define MAX_TAG_PREFIX_LEN   17
 The max length of a temporary tag prefix is the number of hex digits required to express UINT64_MAX plus one for the hyphen.
#define ZFS_RENAME_RECURSIVE   0x01
#define ZFS_RENAME_ALLOW_MOUNTED   0x02
#define dsl_dataset_is_snapshot(ds)   ((ds)->ds_phys->ds_num_children != 0)
#define DS_UNIQUE_IS_ACCURATE(ds)   (((ds)->ds_phys->ds_flags & DS_FLAG_UNIQUE_ACCURATE) != 0)
#define dprintf_ds(dd, fmt,...)

Typedefs

typedef struct dsl_dataset_phys dsl_dataset_phys_t
typedef struct dsl_dataset dsl_dataset_t

Functions

int dsl_dataset_hold (const char *name, void *tag, dsl_dataset_t **dsp)
int dsl_dataset_hold_obj (struct dsl_pool *dp, uint64_t dsobj, void *tag, dsl_dataset_t **)
int dsl_dataset_own (const char *name, boolean_t inconsistentok, void *tag, dsl_dataset_t **dsp)
int dsl_dataset_own_obj (struct dsl_pool *dp, uint64_t dsobj, boolean_t inconsistentok, void *tag, dsl_dataset_t **dsp)
void dsl_dataset_name (dsl_dataset_t *ds, char *name)
void dsl_dataset_rele (dsl_dataset_t *ds, void *tag)
void dsl_dataset_disown (dsl_dataset_t *ds, void *tag)
void dsl_dataset_drop_ref (dsl_dataset_t *ds, void *tag)
boolean_t dsl_dataset_tryown (dsl_dataset_t *ds, boolean_t inconsistentok, void *tag)
void dsl_dataset_make_exclusive (dsl_dataset_t *ds, void *tag)
void dsl_register_onexit_hold_cleanup (dsl_dataset_t *ds, const char *htag, minor_t minor)
uint64_t dsl_dataset_create_sync (dsl_dir_t *pds, const char *lastname, dsl_dataset_t *origin, uint64_t flags, cred_t *, dmu_tx_t *)
uint64_t dsl_dataset_create_sync_dd (dsl_dir_t *dd, dsl_dataset_t *origin, uint64_t flags, dmu_tx_t *tx)
int dsl_dataset_destroy (dsl_dataset_t *ds, void *tag, boolean_t defer)
 ds must be opened as OWNER.
int dsl_snapshots_destroy (char *fsname, char *snapname, boolean_t defer)
int dsl_dataset_rename (char *name, const char *newname, int flags)
int dsl_dataset_promote (const char *name, char *conflsnap)
 Promote a clone.
int dsl_dataset_clone_swap (dsl_dataset_t *clone, dsl_dataset_t *origin_head, boolean_t force)
 Swap 'clone' with its origin head datasets.
int dsl_dataset_user_hold (char *dsname, char *snapname, char *htag, boolean_t recursive, boolean_t temphold, int cleanup_fd)
int dsl_dataset_user_hold_for_send (dsl_dataset_t *ds, char *htag, boolean_t temphold)
int dsl_dataset_user_release (char *dsname, char *snapname, char *htag, boolean_t recursive)
int dsl_dataset_user_release_tmp (struct dsl_pool *dp, uint64_t dsobj, char *htag, boolean_t retry)
 Called at spa_load time (with retry == B_FALSE) to release a stale temporary user hold.
int dsl_dataset_get_holds (const char *dsname, nvlist_t **nvp)
blkptr_tdsl_dataset_get_blkptr (dsl_dataset_t *ds)
void dsl_dataset_set_blkptr (dsl_dataset_t *ds, blkptr_t *bp, dmu_tx_t *tx)
spa_tdsl_dataset_get_spa (dsl_dataset_t *ds)
boolean_t dsl_dataset_modified_since_lastsnap (dsl_dataset_t *ds)
void dsl_dataset_sync (dsl_dataset_t *os, zio_t *zio, dmu_tx_t *tx)
void dsl_dataset_block_born (dsl_dataset_t *ds, const blkptr_t *bp, dmu_tx_t *tx)
int dsl_dataset_block_kill (dsl_dataset_t *ds, const blkptr_t *bp, dmu_tx_t *tx, boolean_t async)
boolean_t dsl_dataset_block_freeable (dsl_dataset_t *ds, const blkptr_t *bp, uint64_t blk_birth)
uint64_t dsl_dataset_prev_snap_txg (dsl_dataset_t *ds)
void dsl_dataset_dirty (dsl_dataset_t *ds, dmu_tx_t *tx)
void dsl_dataset_stats (dsl_dataset_t *os, nvlist_t *nv)
void dsl_dataset_fast_stat (dsl_dataset_t *ds, dmu_objset_stats_t *stat)
void dsl_dataset_space (dsl_dataset_t *ds, uint64_t *refdbytesp, uint64_t *availbytesp, uint64_t *usedobjsp, uint64_t *availobjsp)
uint64_t dsl_dataset_fsid_guid (dsl_dataset_t *ds)
int dsl_dataset_space_written (dsl_dataset_t *oldsnap, dsl_dataset_t *new, uint64_t *usedp, uint64_t *compp, uint64_t *uncompp)
int dsl_dataset_space_wouldfree (dsl_dataset_t *firstsnap, dsl_dataset_t *last, uint64_t *usedp, uint64_t *compp, uint64_t *uncompp)
boolean_t dsl_dataset_is_dirty (dsl_dataset_t *ds)
int dsl_dsobj_to_dsname (char *pname, uint64_t obj, char *buf)
 Find the name of a dataset.
int dsl_dataset_check_quota (dsl_dataset_t *ds, boolean_t check_quota, uint64_t asize, uint64_t inflight, uint64_t *used, uint64_t *ref_rsrv)
int dsl_dataset_set_quota (const char *dsname, zprop_source_t source, uint64_t quota)
int dsl_dataset_set_reservation (const char *dsname, zprop_source_t source, uint64_t reservation)
int dsl_destroy_inconsistent (const char *dsname, void *arg)

Variables

dsl_checkfunc_t dsl_dataset_destroy_check
dsl_syncfunc_t dsl_dataset_destroy_sync
dsl_checkfunc_t dsl_dataset_snapshot_check
dsl_syncfunc_t dsl_dataset_snapshot_sync
dsl_syncfunc_t dsl_dataset_user_hold_sync
dsl_syncfunc_t dsl_dataset_set_quota_sync

Define Documentation

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

Definition at line 327 of file dsl_dataset.h.

#define DS_FLAG_CI_DATASET   (1ULL<<16)

DS_FLAG_CI_DATASET is set if the dataset contains a file system whose name lookups should be performed case-insensitively.

Definition at line 79 of file dsl_dataset.h.

#define DS_FLAG_DEFER_DESTROY   (1ULL<<3)

DS_FLAG_DEFER_DESTROY is set after 'zfs destroy -d' has been called on a dataset.

This allows the dataset to be destroyed using 'zfs release'.

Definition at line 71 of file dsl_dataset.h.

#define DS_FLAG_INCONSISTENT   (1ULL<<0)

Definition at line 49 of file dsl_dataset.h.

#define DS_FLAG_NOPROMOTE   (1ULL<<1)

NB: nopromote can not yet be set, but we want support for it in this on-disk version, so that we don't need to upgrade for it later.

It will be needed when we implement 'zfs split' (where the split off clone should not be promoted).

Definition at line 58 of file dsl_dataset.h.

#define DS_FLAG_UNIQUE_ACCURATE   (1ULL<<2)

DS_FLAG_UNIQUE_ACCURATE is set if ds_unique_bytes has been correctly calculated for head datasets (starting with SPA_VERSION_UNIQUE_ACCURATE, refquota/refreservations).

Definition at line 65 of file dsl_dataset.h.

#define DS_IS_DEFER_DESTROY (   ds)    ((ds)->ds_phys->ds_flags & DS_FLAG_DEFER_DESTROY)

Definition at line 72 of file dsl_dataset.h.

#define DS_IS_INCONSISTENT (   ds)    ((ds)->ds_phys->ds_flags & DS_FLAG_INCONSISTENT)

Definition at line 50 of file dsl_dataset.h.

#define DS_UNIQUE_IS_ACCURATE (   ds)    (((ds)->ds_phys->ds_flags & DS_FLAG_UNIQUE_ACCURATE) != 0)

Definition at line 230 of file dsl_dataset.h.

#define dsl_dataset_is_snapshot (   ds)    ((ds)->ds_phys->ds_num_children != 0)

Definition at line 227 of file dsl_dataset.h.

#define MAX_TAG_PREFIX_LEN   17

The max length of a temporary tag prefix is the number of hex digits required to express UINT64_MAX plus one for the hyphen.

Definition at line 209 of file dsl_dataset.h.

#define ZFS_RENAME_ALLOW_MOUNTED   0x02

Definition at line 225 of file dsl_dataset.h.

#define ZFS_RENAME_RECURSIVE   0x01

Definition at line 224 of file dsl_dataset.h.


Typedef Documentation

typedef struct dsl_dataset dsl_dataset_t

Function Documentation

void dsl_dataset_block_born ( dsl_dataset_t ds,
const blkptr_t bp,
dmu_tx_t tx 
)

Definition at line 93 of file dsl_dataset.c.

boolean_t dsl_dataset_block_freeable ( dsl_dataset_t ds,
const blkptr_t bp,
uint64_t  blk_birth 
)

Definition at line 241 of file dsl_dataset.c.

int dsl_dataset_block_kill ( dsl_dataset_t ds,
const blkptr_t bp,
dmu_tx_t tx,
boolean_t  async 
)

Definition at line 131 of file dsl_dataset.c.

int dsl_dataset_check_quota ( dsl_dataset_t ds,
boolean_t  check_quota,
uint64_t  asize,
uint64_t  inflight,
uint64_t *  used,
uint64_t *  ref_rsrv 
)

Definition at line 3435 of file dsl_dataset.c.

int dsl_dataset_clone_swap ( dsl_dataset_t clone,
dsl_dataset_t origin_head,
boolean_t  force 
)

Swap 'clone' with its origin head datasets.

Used at the end of "zfs recv" into an existing fs to swizzle the file system to the new version, and by "zfs rollback". Can also be used to swap two independent head datasets if neither has any snapshots.

Definition at line 3373 of file dsl_dataset.c.

uint64_t dsl_dataset_create_sync ( dsl_dir_t pds,
const char *  lastname,
dsl_dataset_t origin,
uint64_t  flags,
cred_t *  ,
dmu_tx_t  
)

Definition at line 874 of file dsl_dataset.c.

uint64_t dsl_dataset_create_sync_dd ( dsl_dir_t dd,
dsl_dataset_t origin,
uint64_t  flags,
dmu_tx_t tx 
)

Definition at line 775 of file dsl_dataset.c.

int dsl_dataset_destroy ( dsl_dataset_t ds,
void *  tag,
boolean_t  defer 
)

ds must be opened as OWNER.

On return (whether successful or not), ds will be closed and caller can no longer dereference it.

Definition at line 1079 of file dsl_dataset.c.

void dsl_dataset_dirty ( dsl_dataset_t ds,
dmu_tx_t tx 
)

Definition at line 1244 of file dsl_dataset.c.

void dsl_dataset_disown ( dsl_dataset_t ds,
void *  tag 
)

Definition at line 731 of file dsl_dataset.c.

void dsl_dataset_drop_ref ( dsl_dataset_t ds,
void *  tag 
)

Definition at line 716 of file dsl_dataset.c.

void dsl_dataset_fast_stat ( dsl_dataset_t ds,
dmu_objset_stats_t stat 
)

Definition at line 2368 of file dsl_dataset.c.

uint64_t dsl_dataset_fsid_guid ( dsl_dataset_t ds)

Definition at line 2397 of file dsl_dataset.c.

blkptr_t* dsl_dataset_get_blkptr ( dsl_dataset_t ds)

Definition at line 1219 of file dsl_dataset.c.

int dsl_dataset_get_holds ( const char *  dsname,
nvlist_t **  nvp 
)

Definition at line 4170 of file dsl_dataset.c.

spa_t* dsl_dataset_get_spa ( dsl_dataset_t ds)

Definition at line 1238 of file dsl_dataset.c.

int dsl_dataset_hold ( const char *  name,
void *  tag,
dsl_dataset_t **  dsp 
)

Definition at line 593 of file dsl_dataset.c.

int dsl_dataset_hold_obj ( struct dsl_pool dp,
uint64_t  dsobj,
void *  tag,
dsl_dataset_t **   
)

Definition at line 567 of file dsl_dataset.c.

boolean_t dsl_dataset_is_dirty ( dsl_dataset_t ds)

Definition at line 1265 of file dsl_dataset.c.

void dsl_dataset_make_exclusive ( dsl_dataset_t ds,
void *  tag 
)

Definition at line 767 of file dsl_dataset.c.

boolean_t dsl_dataset_modified_since_lastsnap ( dsl_dataset_t ds)

Definition at line 2426 of file dsl_dataset.c.

void dsl_dataset_name ( dsl_dataset_t ds,
char *  name 
)

Definition at line 666 of file dsl_dataset.c.

int dsl_dataset_own ( const char *  name,
boolean_t  inconsistentok,
void *  tag,
dsl_dataset_t **  dsp 
)

Definition at line 652 of file dsl_dataset.c.

int dsl_dataset_own_obj ( struct dsl_pool dp,
uint64_t  dsobj,
boolean_t  inconsistentok,
void *  tag,
dsl_dataset_t **  dsp 
)

Definition at line 578 of file dsl_dataset.c.

uint64_t dsl_dataset_prev_snap_txg ( dsl_dataset_t ds)

Definition at line 218 of file dsl_dataset.c.

int dsl_dataset_promote ( const char *  name,
char *  conflsnap 
)

Promote a clone.

Nomenclature note:

  • "clone" or "cds": the original clone which is being promoted
  • "origin" or "ods": the snapshot which is originally clone's origin
  • "origin head" or "ohds": the dataset which is the head (filesystem/volume) for the origin
  • "origin origin": the origin of the origin's filesystem (typically NULL, indicating that the clone is not a clone of a clone).

Definition at line 3108 of file dsl_dataset.c.

void dsl_dataset_rele ( dsl_dataset_t ds,
void *  tag 
)

Definition at line 722 of file dsl_dataset.c.

int dsl_dataset_rename ( char *  name,
const char *  newname,
int  flags 
)

Definition at line 2640 of file dsl_dataset.c.

void dsl_dataset_set_blkptr ( dsl_dataset_t ds,
blkptr_t bp,
dmu_tx_t tx 
)

Definition at line 1225 of file dsl_dataset.c.

int dsl_dataset_set_quota ( const char *  dsname,
zprop_source_t  source,
uint64_t  quota 
)

Definition at line 3525 of file dsl_dataset.c.

int dsl_dataset_set_reservation ( const char *  dsname,
zprop_source_t  source,
uint64_t  reservation 
)

Definition at line 3627 of file dsl_dataset.c.

void dsl_dataset_space ( dsl_dataset_t ds,
uint64_t *  refdbytesp,
uint64_t *  availbytesp,
uint64_t *  usedobjsp,
uint64_t *  availobjsp 
)

Definition at line 2403 of file dsl_dataset.c.

int dsl_dataset_space_wouldfree ( dsl_dataset_t firstsnap,
dsl_dataset_t last,
uint64_t *  usedp,
uint64_t *  compp,
uint64_t *  uncompp 
)

Definition at line 4326 of file dsl_dataset.c.

int dsl_dataset_space_written ( dsl_dataset_t oldsnap,
dsl_dataset_t new,
uint64_t *  usedp,
uint64_t *  compp,
uint64_t *  uncompp 
)

Definition at line 4238 of file dsl_dataset.c.

void dsl_dataset_stats ( dsl_dataset_t os,
nvlist_t *  nv 
)

Definition at line 2301 of file dsl_dataset.c.

void dsl_dataset_sync ( dsl_dataset_t os,
zio_t zio,
dmu_tx_t tx 
)

Definition at line 2223 of file dsl_dataset.c.

boolean_t dsl_dataset_tryown ( dsl_dataset_t ds,
boolean_t  inconsistentok,
void *  tag 
)

Definition at line 750 of file dsl_dataset.c.

int dsl_dataset_user_hold ( char *  dsname,
char *  snapname,
char *  htag,
boolean_t  recursive,
boolean_t  temphold,
int  cleanup_fd 
)

Definition at line 3799 of file dsl_dataset.c.

int dsl_dataset_user_hold_for_send ( dsl_dataset_t ds,
char *  htag,
boolean_t  temphold 
)

Definition at line 3781 of file dsl_dataset.c.

int dsl_dataset_user_release ( char *  dsname,
char *  snapname,
char *  htag,
boolean_t  recursive 
)

Definition at line 4051 of file dsl_dataset.c.

int dsl_dataset_user_release_tmp ( dsl_pool_t dp,
uint64_t  dsobj,
char *  htag,
boolean_t  retry 
)

Called at spa_load time (with retry == B_FALSE) to release a stale temporary user hold.

Also called by the onexit code (with retry == B_TRUE).

Definition at line 4128 of file dsl_dataset.c.

int dsl_destroy_inconsistent ( const char *  dsname,
void *  arg 
)
Note:
This function is used as the callback for dmu_objset_find(). We always return 0 so that we will continue to find and process inconsistent datasets, even if we encounter an error trying to process one of them.

Definition at line 4207 of file dsl_dataset.c.

int dsl_dsobj_to_dsname ( char *  pname,
uint64_t  obj,
char *  buf 
)

Find the name of a dataset.

Given a pool name and a dataset object number in that pool, return the name of that dataset.

Definition at line 3413 of file dsl_dataset.c.

void dsl_register_onexit_hold_cleanup ( dsl_dataset_t ds,
const char *  htag,
minor_t  minor 
)

Definition at line 3666 of file dsl_dataset.c.

int dsl_snapshots_destroy ( char *  fsname,
char *  snapname,
boolean_t  defer 
)

Variable Documentation

dsl_checkfunc_t dsl_dataset_destroy_check

Definition at line 255 of file dsl_dataset.h.

dsl_syncfunc_t dsl_dataset_destroy_sync

Definition at line 256 of file dsl_dataset.h.

dsl_syncfunc_t dsl_dataset_set_quota_sync

Definition at line 311 of file dsl_dataset.h.

dsl_checkfunc_t dsl_dataset_snapshot_check

Definition at line 257 of file dsl_dataset.h.

dsl_syncfunc_t dsl_dataset_snapshot_sync

Definition at line 258 of file dsl_dataset.h.

dsl_syncfunc_t dsl_dataset_user_hold_sync

Definition at line 259 of file dsl_dataset.h.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines