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

dmu_objset.c File Reference

#include <sys/cred.h>
#include <sys/zfs_context.h>
#include <sys/dmu_objset.h>
#include <sys/dsl_dir.h>
#include <sys/dsl_dataset.h>
#include <sys/dsl_prop.h>
#include <sys/dsl_pool.h>
#include <sys/dsl_synctask.h>
#include <sys/dsl_deleg.h>
#include <sys/dnode.h>
#include <sys/dbuf.h>
#include <sys/zvol.h>
#include <sys/dmu_tx.h>
#include <sys/zap.h>
#include <sys/zil.h>
#include <sys/dmu_impl.h>
#include <sys/zfs_ioctl.h>
#include <sys/sa.h>
#include <sys/zfs_onexit.h>
Include dependency graph for dmu_objset.c:

Go to the source code of this file.

Data Structures

struct  oscarg
struct  snaparg
struct  findarg

Functions

void dmu_objset_init (void)
void dmu_objset_fini (void)
spa_tdmu_objset_spa (objset_t *os)
zilog_tdmu_objset_zil (objset_t *os)
dsl_pool_tdmu_objset_pool (objset_t *os)
dsl_dataset_tdmu_objset_ds (objset_t *os)
dmu_objset_type_t dmu_objset_type (objset_t *os)
void dmu_objset_name (objset_t *os, char *buf)
uint64_t dmu_objset_id (objset_t *os)
uint64_t dmu_objset_syncprop (objset_t *os)
uint64_t dmu_objset_logbias (objset_t *os)
static void checksum_changed_cb (void *arg, uint64_t newval)
static void compression_changed_cb (void *arg, uint64_t newval)
static void copies_changed_cb (void *arg, uint64_t newval)
static void dedup_changed_cb (void *arg, uint64_t newval)
static void primary_cache_changed_cb (void *arg, uint64_t newval)
static void secondary_cache_changed_cb (void *arg, uint64_t newval)
static void sync_changed_cb (void *arg, uint64_t newval)
static void logbias_changed_cb (void *arg, uint64_t newval)
void dmu_objset_byteswap (void *buf, size_t size)
int dmu_objset_open_impl (spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp, objset_t **osp)
int dmu_objset_from_ds (dsl_dataset_t *ds, objset_t **osp)
int dmu_objset_hold (const char *name, void *tag, objset_t **osp)
int dmu_objset_own (const char *name, dmu_objset_type_t type, boolean_t readonly, void *tag, objset_t **osp)
void dmu_objset_rele (objset_t *os, void *tag)
void dmu_objset_disown (objset_t *os, void *tag)
int dmu_objset_evict_dbufs (objset_t *os)
void dmu_objset_evict (objset_t *os)
timestruc_t dmu_objset_snap_cmtime (objset_t *os)
objset_tdmu_objset_create_impl (spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp, dmu_objset_type_t type, dmu_tx_t *tx)
static int dmu_objset_create_check (void *arg1, void *arg2, dmu_tx_t *tx)
static void dmu_objset_create_sync (void *arg1, void *arg2, dmu_tx_t *tx)
int dmu_objset_create (const char *name, dmu_objset_type_t type, uint64_t flags, void(*func)(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx), void *arg)
int dmu_objset_clone (const char *name, dsl_dataset_t *clone_origin, uint64_t flags)
int dmu_objset_destroy (const char *name, boolean_t defer)
static int snapshot_check (void *arg1, void *arg2, dmu_tx_t *tx)
static void snapshot_sync (void *arg1, void *arg2, dmu_tx_t *tx)
static int dmu_objset_snapshot_one (const char *name, void *arg)
int dmu_objset_snapshot (char *fsname, char *snapname, char *tag, nvlist_t *props, boolean_t recursive, boolean_t temporary, int cleanup_fd)
static void dmu_objset_sync_dnodes (list_t *list, list_t *newlist, dmu_tx_t *tx)
static void dmu_objset_write_ready (zio_t *zio, arc_buf_t *abuf, void *arg)
static void dmu_objset_write_done (zio_t *zio, arc_buf_t *abuf, void *arg)
void dmu_objset_sync (objset_t *os, zio_t *pio, dmu_tx_t *tx)
boolean_t dmu_objset_is_dirty (objset_t *os, uint64_t txg)
void dmu_objset_register_type (dmu_objset_type_t ost, objset_used_cb_t *cb)
boolean_t dmu_objset_userused_enabled (objset_t *os)
static void do_userquota_update (objset_t *os, uint64_t used, uint64_t flags, uint64_t user, uint64_t group, boolean_t subtract, dmu_tx_t *tx)
void dmu_objset_do_userquota_updates (objset_t *os, dmu_tx_t *tx)
static void * dmu_objset_userquota_find_data (dmu_buf_impl_t *db, dmu_tx_t *tx)
 Returns a pointer to data to find uid/gid from.
void dmu_objset_userquota_get_ids (dnode_t *dn, boolean_t before, dmu_tx_t *tx)
boolean_t dmu_objset_userspace_present (objset_t *os)
int dmu_objset_userspace_upgrade (objset_t *os)
void dmu_objset_space (objset_t *os, uint64_t *refdbytesp, uint64_t *availbytesp, uint64_t *usedobjsp, uint64_t *availobjsp)
 Get the space usage statistics for statvfs().
uint64_t dmu_objset_fsid_guid (objset_t *os)
 The fsid_guid is a 56-bit ID that can change to avoid collisions.
void dmu_objset_fast_stat (objset_t *os, dmu_objset_stats_t *stat)
 Get stats on a dataset.
void dmu_objset_stats (objset_t *os, nvlist_t *nv)
int dmu_objset_is_snapshot (objset_t *os)
int dmu_snapshot_realname (objset_t *os, char *name, char *real, int maxlen, boolean_t *conflict)
int dmu_snapshot_list_next (objset_t *os, int namelen, char *name, uint64_t *idp, uint64_t *offp, boolean_t *case_conflict)
int dmu_dir_list_next (objset_t *os, int namelen, char *name, uint64_t *idp, uint64_t *offp)
static int findfunc (spa_t *spa, uint64_t dsobj, const char *dsname, void *arg)
int dmu_objset_find (const char *name, int func(const char *, void *), void *arg, int flags)
 Find all objsets under name, and for each, call 'func(child_name, arg)'.
int dmu_objset_find_spa (spa_t *spa, const char *name, int func(spa_t *, uint64_t, const char *, void *), void *arg, int flags)
 Find all objsets under name, call func on each.
int dmu_objset_prefetch (const char *name, void *arg)
void dmu_objset_set_user (objset_t *os, void *user_ptr)
void * dmu_objset_get_user (objset_t *os)

Variables

krwlock_t os_lock
 Needed to close a window in dnode_move() that allows the objset to be freed before it can be safely accessed.
static objset_used_cb_tused_cbs [DMU_OST_NUMTYPES]

Function Documentation

static void checksum_changed_cb ( void *  arg,
uint64_t  newval 
) [static]

Definition at line 127 of file dmu_objset.c.

static void compression_changed_cb ( void *  arg,
uint64_t  newval 
) [static]

Definition at line 140 of file dmu_objset.c.

static void copies_changed_cb ( void *  arg,
uint64_t  newval 
) [static]

Definition at line 153 of file dmu_objset.c.

static void dedup_changed_cb ( void *  arg,
uint64_t  newval 
) [static]

Definition at line 167 of file dmu_objset.c.

int dmu_dir_list_next ( objset_t os,
int  namelen,
char *  name,
uint64_t *  idp,
uint64_t *  offp 
)

Definition at line 1582 of file dmu_objset.c.

void dmu_objset_byteswap ( void *  buf,
size_t  size 
)

Definition at line 241 of file dmu_objset.c.

int dmu_objset_clone ( const char *  name,
dsl_dataset_t clone_origin,
uint64_t  flags 
)

Definition at line 760 of file dmu_objset.c.

int dmu_objset_create ( const char *  name,
dmu_objset_type_t  type,
uint64_t  flags,
void(*)(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx)  func,
void *  arg 
)

Definition at line 729 of file dmu_objset.c.

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

Definition at line 669 of file dmu_objset.c.

objset_t* dmu_objset_create_impl ( spa_t spa,
dsl_dataset_t ds,
blkptr_t bp,
dmu_objset_type_t  type,
dmu_tx_t tx 
)

Definition at line 599 of file dmu_objset.c.

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

Definition at line 696 of file dmu_objset.c.

int dmu_objset_destroy ( const char *  name,
boolean_t  defer 
)

Definition at line 788 of file dmu_objset.c.

void dmu_objset_disown ( objset_t os,
void *  tag 
)

Definition at line 482 of file dmu_objset.c.

void dmu_objset_do_userquota_updates ( objset_t os,
dmu_tx_t tx 
)

Definition at line 1222 of file dmu_objset.c.

dsl_dataset_t* dmu_objset_ds ( objset_t os) [read]

Definition at line 89 of file dmu_objset.c.

void dmu_objset_evict ( objset_t os)

Definition at line 528 of file dmu_objset.c.

int dmu_objset_evict_dbufs ( objset_t os)

Definition at line 488 of file dmu_objset.c.

void dmu_objset_fast_stat ( objset_t os,
dmu_objset_stats_t stat 
)

Get stats on a dataset.

Definition at line 1498 of file dmu_objset.c.

int dmu_objset_find ( const char *  name,
int   funcconst char *, void *,
void *  arg,
int  flags 
)

Find all objsets under name, and for each, call 'func(child_name, arg)'.

Todo:
Perhaps change all callers to use dmu_objset_find_spa()?

Definition at line 1637 of file dmu_objset.c.

int dmu_objset_find_spa ( spa_t spa,
const char *  name,
int   funcspa_t *, uint64_t, const char *, void *,
void *  arg,
int  flags 
)

Find all objsets under name, call func on each.

Definition at line 1650 of file dmu_objset.c.

void dmu_objset_fini ( void  )

Definition at line 60 of file dmu_objset.c.

int dmu_objset_from_ds ( dsl_dataset_t ds,
objset_t **  osp 
)

Definition at line 418 of file dmu_objset.c.

uint64_t dmu_objset_fsid_guid ( objset_t os)

The fsid_guid is a 56-bit ID that can change to avoid collisions.

(Contrast with the ds_guid which is a 64-bit ID that will never change, so there is a small probability that it will collide.)

Definition at line 1492 of file dmu_objset.c.

void* dmu_objset_get_user ( objset_t os)

Definition at line 1789 of file dmu_objset.c.

int dmu_objset_hold ( const char *  name,
void *  tag,
objset_t **  osp 
)

Definition at line 434 of file dmu_objset.c.

uint64_t dmu_objset_id ( objset_t os)

Definition at line 107 of file dmu_objset.c.

void dmu_objset_init ( void  )

Definition at line 54 of file dmu_objset.c.

boolean_t dmu_objset_is_dirty ( objset_t os,
uint64_t  txg 
)

Definition at line 1184 of file dmu_objset.c.

int dmu_objset_is_snapshot ( objset_t os)

Definition at line 1521 of file dmu_objset.c.

uint64_t dmu_objset_logbias ( objset_t os)

Definition at line 121 of file dmu_objset.c.

void dmu_objset_name ( objset_t os,
char *  buf 
)

Definition at line 101 of file dmu_objset.c.

int dmu_objset_open_impl ( spa_t spa,
dsl_dataset_t ds,
blkptr_t bp,
objset_t **  osp 
)

Definition at line 257 of file dmu_objset.c.

int dmu_objset_own ( const char *  name,
dmu_objset_type_t  type,
boolean_t  readonly,
void *  tag,
objset_t **  osp 
)

Definition at line 452 of file dmu_objset.c.

dsl_pool_t* dmu_objset_pool ( objset_t os) [read]

Definition at line 78 of file dmu_objset.c.

int dmu_objset_prefetch ( const char *  name,
void *  arg 
)

Definition at line 1752 of file dmu_objset.c.

void dmu_objset_register_type ( dmu_objset_type_t  ost,
objset_used_cb_t cb 
)

Definition at line 1193 of file dmu_objset.c.

void dmu_objset_rele ( objset_t os,
void *  tag 
)

Definition at line 476 of file dmu_objset.c.

void dmu_objset_set_user ( objset_t os,
void *  user_ptr 
)

Definition at line 1782 of file dmu_objset.c.

timestruc_t dmu_objset_snap_cmtime ( objset_t os)

Definition at line 592 of file dmu_objset.c.

int dmu_objset_snapshot ( char *  fsname,
char *  snapname,
char *  tag,
nvlist_t *  props,
boolean_t  recursive,
boolean_t  temporary,
int  cleanup_fd 
)

Definition at line 944 of file dmu_objset.c.

static int dmu_objset_snapshot_one ( const char *  name,
void *  arg 
) [static]

Definition at line 888 of file dmu_objset.c.

spa_t* dmu_objset_spa ( objset_t os) [read]

Definition at line 66 of file dmu_objset.c.

void dmu_objset_space ( objset_t os,
uint64_t *  refdbytesp,
uint64_t *  availbytesp,
uint64_t *  usedobjsp,
uint64_t *  availobjsp 
)

Get the space usage statistics for statvfs().

refdbytes is the amount of space "referenced" by this objset. availbytes is the amount of space available to this objset, taking into account quotas & reservations, assuming that no other objsets use the space first. These values correspond to the 'referenced' and 'available' properties, described in the zfs(1m) manpage.

usedobjs and availobjs are the number of objects currently allocated, and available.

Definition at line 1484 of file dmu_objset.c.

void dmu_objset_stats ( objset_t os,
nvlist_t *  nv 
)

Definition at line 1506 of file dmu_objset.c.

void dmu_objset_sync ( objset_t os,
zio_t pio,
dmu_tx_t tx 
)

Definition at line 1096 of file dmu_objset.c.

static void dmu_objset_sync_dnodes ( list_t *  list,
list_t *  newlist,
dmu_tx_t tx 
) [static]

Definition at line 1026 of file dmu_objset.c.

uint64_t dmu_objset_syncprop ( objset_t os)

Definition at line 115 of file dmu_objset.c.

Definition at line 95 of file dmu_objset.c.

static void* dmu_objset_userquota_find_data ( dmu_buf_impl_t db,
dmu_tx_t tx 
) [static]

Returns a pointer to data to find uid/gid from.

If a dirty record for transaction group that is syncing can't be found then NULL is returned. In the NULL case it is assumed the uid/gid aren't changing.

Definition at line 1294 of file dmu_objset.c.

void dmu_objset_userquota_get_ids ( dnode_t dn,
boolean_t  before,
dmu_tx_t tx 
)

Definition at line 1327 of file dmu_objset.c.

boolean_t dmu_objset_userspace_present ( objset_t os)

Definition at line 1428 of file dmu_objset.c.

int dmu_objset_userspace_upgrade ( objset_t os)

Definition at line 1435 of file dmu_objset.c.

boolean_t dmu_objset_userused_enabled ( objset_t os)

Definition at line 1199 of file dmu_objset.c.

static void dmu_objset_write_done ( zio_t zio,
arc_buf_t abuf,
void *  arg 
) [static]

Definition at line 1077 of file dmu_objset.c.

static void dmu_objset_write_ready ( zio_t zio,
arc_buf_t abuf,
void *  arg 
) [static]

Definition at line 1054 of file dmu_objset.c.

zilog_t* dmu_objset_zil ( objset_t os) [read]

Definition at line 72 of file dmu_objset.c.

int dmu_snapshot_list_next ( objset_t os,
int  namelen,
char *  name,
uint64_t *  idp,
uint64_t *  offp,
boolean_t *  case_conflict 
)

Definition at line 1545 of file dmu_objset.c.

int dmu_snapshot_realname ( objset_t os,
char *  name,
char *  real,
int  maxlen,
boolean_t *  conflict 
)

Definition at line 1530 of file dmu_objset.c.

static void do_userquota_update ( objset_t os,
uint64_t  used,
uint64_t  flags,
uint64_t  user,
uint64_t  group,
boolean_t  subtract,
dmu_tx_t tx 
) [static]

Definition at line 1207 of file dmu_objset.c.

static int findfunc ( spa_t spa,
uint64_t  dsobj,
const char *  dsname,
void *  arg 
) [static]

Definition at line 1625 of file dmu_objset.c.

static void logbias_changed_cb ( void *  arg,
uint64_t  newval 
) [static]

Definition at line 229 of file dmu_objset.c.

static void primary_cache_changed_cb ( void *  arg,
uint64_t  newval 
) [static]

Definition at line 185 of file dmu_objset.c.

static void secondary_cache_changed_cb ( void *  arg,
uint64_t  newval 
) [static]

Definition at line 199 of file dmu_objset.c.

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

Definition at line 816 of file dmu_objset.c.

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

Definition at line 858 of file dmu_objset.c.

static void sync_changed_cb ( void *  arg,
uint64_t  newval 
) [static]

Definition at line 213 of file dmu_objset.c.


Variable Documentation

krwlock_t os_lock

Needed to close a window in dnode_move() that allows the objset to be freed before it can be safely accessed.

Definition at line 51 of file dmu_objset.c.

objset_used_cb_t* used_cbs[DMU_OST_NUMTYPES] [static]

Definition at line 1190 of file dmu_objset.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines