FreeBSD ZFS
The Zettabyte File System
Typedefs | Functions

dmu_tx.c File Reference

#include <sys/dmu.h>
#include <sys/dmu_impl.h>
#include <sys/dbuf.h>
#include <sys/dmu_tx.h>
#include <sys/dmu_objset.h>
#include <sys/dsl_dataset.h>
#include <sys/dsl_dir.h>
#include <sys/dsl_pool.h>
#include <sys/zap_impl.h>
#include <sys/spa.h>
#include <sys/sa.h>
#include <sys/sa_impl.h>
#include <sys/zfs_context.h>
#include <sys/varargs.h>
Include dependency graph for dmu_tx.c:

Go to the source code of this file.

Typedefs

typedef void(* dmu_tx_hold_func_t )(dmu_tx_t *tx, struct dnode *dn, uint64_t arg1, uint64_t arg2)

Functions

dmu_tx_tdmu_tx_create_dd (dsl_dir_t *dd)
dmu_tx_tdmu_tx_create (objset_t *os)
dmu_tx_tdmu_tx_create_assigned (struct dsl_pool *dp, uint64_t txg)
int dmu_tx_is_syncing (dmu_tx_t *tx)
int dmu_tx_private_ok (dmu_tx_t *tx)
static dmu_tx_hold_tdmu_tx_hold_object_impl (dmu_tx_t *tx, objset_t *os, uint64_t object, enum dmu_tx_hold_type type, uint64_t arg1, uint64_t arg2)
void dmu_tx_add_new_object (dmu_tx_t *tx, objset_t *os, uint64_t object)
static int dmu_tx_check_ioerr (zio_t *zio, dnode_t *dn, int level, uint64_t blkid)
static void dmu_tx_count_twig (dmu_tx_hold_t *txh, dnode_t *dn, dmu_buf_impl_t *db, int level, uint64_t blkid, boolean_t freeable, uint64_t *history)
static void dmu_tx_count_write (dmu_tx_hold_t *txh, uint64_t off, uint64_t len)
static void dmu_tx_count_dnode (dmu_tx_hold_t *txh)
void dmu_tx_hold_write (dmu_tx_t *tx, uint64_t object, uint64_t off, int len)
static void dmu_tx_count_free (dmu_tx_hold_t *txh, uint64_t off, uint64_t len)
void dmu_tx_hold_free (dmu_tx_t *tx, uint64_t object, uint64_t off, uint64_t len)
void dmu_tx_hold_zap (dmu_tx_t *tx, uint64_t object, int add, const char *name)
void dmu_tx_hold_bonus (dmu_tx_t *tx, uint64_t object)
void dmu_tx_hold_space (dmu_tx_t *tx, uint64_t space)
int dmu_tx_holds (dmu_tx_t *tx, uint64_t object)
static int dmu_tx_try_assign (dmu_tx_t *tx, uint64_t txg_how)
static void dmu_tx_unassign (dmu_tx_t *tx)
int dmu_tx_assign (dmu_tx_t *tx, uint64_t txg_how)
 Assign tx to a transaction group.
void dmu_tx_wait (dmu_tx_t *tx)
void dmu_tx_willuse_space (dmu_tx_t *tx, int64_t delta)
void dmu_tx_commit (dmu_tx_t *tx)
void dmu_tx_abort (dmu_tx_t *tx)
uint64_t dmu_tx_get_txg (dmu_tx_t *tx)
 Return the txg number for the given assigned transaction.
void dmu_tx_callback_register (dmu_tx_t *tx, dmu_tx_callback_func_t *func, void *data)
 Registers a commit callback.
void dmu_tx_do_callbacks (list_t *cb_list, int error)
 Call all the commit callbacks on a list, with a given error code.
static void dmu_tx_sa_registration_hold (sa_os_t *sa, dmu_tx_t *tx)
 hold necessary attribute name for attribute registration.
void dmu_tx_hold_spill (dmu_tx_t *tx, uint64_t object)
void dmu_tx_hold_sa_create (dmu_tx_t *tx, int attrsize)
 Interface to hold a bunch of attributes.
void dmu_tx_hold_sa (dmu_tx_t *tx, sa_handle_t *hdl, boolean_t may_grow)
 Hold SA attribute.

Typedef Documentation

typedef void(* dmu_tx_hold_func_t)(dmu_tx_t *tx, struct dnode *dn, uint64_t arg1, uint64_t arg2)

Definition at line 42 of file dmu_tx.c.


Function Documentation

void dmu_tx_abort ( dmu_tx_t tx)

Definition at line 1191 of file dmu_tx.c.

void dmu_tx_add_new_object ( dmu_tx_t tx,
objset_t os,
uint64_t  object 
)

Definition at line 141 of file dmu_tx.c.

int dmu_tx_assign ( dmu_tx_t tx,
uint64_t  txg_how 
)

Assign tx to a transaction group.

txg_how can be one of:

  1. TXG_WAIT. If the current open txg is full, waits until there's a new one. This should be used when you're not holding locks. If will only fail if we're truly out of space (or over quota).
  2. TXG_NOWAIT. If we can't assign into the current open txg without blocking, returns immediately with ERESTART. This should be used whenever you're holding locks. On an ERESTART error, the caller should drop locks, do a dmu_tx_wait(tx), and try again.
  3. A specific txg. Use this if you need to ensure that multiple transactions all sync in the same txg. Like TXG_NOWAIT, it returns ERESTART if it can't assign you into the requested txg.

Definition at line 1072 of file dmu_tx.c.

void dmu_tx_callback_register ( dmu_tx_t tx,
dmu_tx_callback_func_t func,
void *  data 
)

Registers a commit callback.

When registering a callback, the transaction must be already created, but it cannot be committed or aborted. It can be assigned to a txg or not.

The callback will be called after the transaction has been safely written to stable storage and will also be called if the dmu_tx is aborted. If there is any error which prevents the transaction from being committed to disk, the callback will be called with a value of error != 0.

Parameters:
[in]func
[in,out]dataA pointer to caller private data that is passed on as a callback parameter. The caller is responsible for properly allocating and freeing it.

Definition at line 1231 of file dmu_tx.c.

static int dmu_tx_check_ioerr ( zio_t zio,
dnode_t dn,
int  level,
uint64_t  blkid 
) [static]

Definition at line 154 of file dmu_tx.c.

void dmu_tx_commit ( dmu_tx_t tx)

Definition at line 1139 of file dmu_tx.c.

static void dmu_tx_count_dnode ( dmu_tx_hold_t txh) [static]

Definition at line 386 of file dmu_tx.c.

static void dmu_tx_count_free ( dmu_tx_hold_t txh,
uint64_t  off,
uint64_t  len 
) [static]

Definition at line 424 of file dmu_tx.c.

static void dmu_tx_count_twig ( dmu_tx_hold_t txh,
dnode_t dn,
dmu_buf_impl_t db,
int  level,
uint64_t  blkid,
boolean_t  freeable,
uint64_t *  history 
) [static]

Definition at line 170 of file dmu_tx.c.

static void dmu_tx_count_write ( dmu_tx_hold_t txh,
uint64_t  off,
uint64_t  len 
) [static]

Definition at line 215 of file dmu_tx.c.

dmu_tx_t* dmu_tx_create ( objset_t os)

Definition at line 65 of file dmu_tx.c.

dmu_tx_t* dmu_tx_create_assigned ( struct dsl_pool dp,
uint64_t  txg 
)

Definition at line 74 of file dmu_tx.c.

dmu_tx_t* dmu_tx_create_dd ( dsl_dir_t dd)

Definition at line 47 of file dmu_tx.c.

void dmu_tx_do_callbacks ( list_t *  cb_list,
int  error 
)

Call all the commit callbacks on a list, with a given error code.

Definition at line 1247 of file dmu_tx.c.

uint64_t dmu_tx_get_txg ( dmu_tx_t tx)

Return the txg number for the given assigned transaction.

Definition at line 1224 of file dmu_tx.c.

void dmu_tx_hold_bonus ( dmu_tx_t tx,
uint64_t  object 
)

Definition at line 749 of file dmu_tx.c.

void dmu_tx_hold_free ( dmu_tx_t tx,
uint64_t  object,
uint64_t  off,
uint64_t  len 
)

Definition at line 592 of file dmu_tx.c.

static dmu_tx_hold_t* dmu_tx_hold_object_impl ( dmu_tx_t tx,
objset_t os,
uint64_t  object,
enum dmu_tx_hold_type  type,
uint64_t  arg1,
uint64_t  arg2 
) [static]

Definition at line 99 of file dmu_tx.c.

void dmu_tx_hold_sa ( dmu_tx_t tx,
sa_handle_t hdl,
boolean_t  may_grow 
)

Hold SA attribute.

dmu_tx_hold_sa(dmu_tx_t *tx, sa_handle_t *, attribute, add, size)

variable_size is the total size of all variable sized attributes passed to this function. It is not the total size of all variable size attributes that *may* exist on this object.

Definition at line 1362 of file dmu_tx.c.

void dmu_tx_hold_sa_create ( dmu_tx_t tx,
int  attrsize 
)

Interface to hold a bunch of attributes.

Used for creating new files.

For updating/adding a single attribute dmu_tx_hold_sa() should be used.

Parameters:
[in]attrsizeThe total size of all attributes to be added during object creation.

Definition at line 1325 of file dmu_tx.c.

void dmu_tx_hold_space ( dmu_tx_t tx,
uint64_t  space 
)

Definition at line 762 of file dmu_tx.c.

void dmu_tx_hold_spill ( dmu_tx_t tx,
uint64_t  object 
)

Definition at line 1285 of file dmu_tx.c.

void dmu_tx_hold_write ( dmu_tx_t tx,
uint64_t  object,
uint64_t  off,
int  len 
)

Definition at line 406 of file dmu_tx.c.

void dmu_tx_hold_zap ( dmu_tx_t tx,
uint64_t  object,
int  add,
const char *  name 
)

Definition at line 663 of file dmu_tx.c.

int dmu_tx_holds ( dmu_tx_t tx,
uint64_t  object 
)

Definition at line 774 of file dmu_tx.c.

int dmu_tx_is_syncing ( dmu_tx_t tx)

Definition at line 87 of file dmu_tx.c.

int dmu_tx_private_ok ( dmu_tx_t tx)

Definition at line 93 of file dmu_tx.c.

static void dmu_tx_sa_registration_hold ( sa_os_t sa,
dmu_tx_t tx 
) [static]

hold necessary attribute name for attribute registration.

should be a very rare case where this is needed. If it does happen it would only happen on the first write to the file system.

Definition at line 1264 of file dmu_tx.c.

static int dmu_tx_try_assign ( dmu_tx_t tx,
uint64_t  txg_how 
) [static]

Definition at line 907 of file dmu_tx.c.

static void dmu_tx_unassign ( dmu_tx_t tx) [static]

Definition at line 1021 of file dmu_tx.c.

void dmu_tx_wait ( dmu_tx_t tx)

Definition at line 1095 of file dmu_tx.c.

void dmu_tx_willuse_space ( dmu_tx_t tx,
int64_t  delta 
)

Definition at line 1122 of file dmu_tx.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines