FreeBSD ZFS
The Zettabyte File System
Functions | Variables

zfs_log.c File Reference

Routines to manage intent log entries. More...

#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysmacros.h>
#include <sys/cmn_err.h>
#include <sys/kmem.h>
#include <sys/file.h>
#include <sys/vfs.h>
#include <sys/zfs_znode.h>
#include <sys/zfs_dir.h>
#include <sys/zil.h>
#include <sys/zil_impl.h>
#include <sys/byteorder.h>
#include <sys/policy.h>
#include <sys/stat.h>
#include <sys/acl.h>
#include <sys/dmu.h>
#include <sys/spa.h>
#include <sys/zfs_fuid.h>
#include <sys/dsl_dataset.h>
Include dependency graph for zfs_log.c:

Go to the source code of this file.

Functions

int zfs_log_create_txtype (zil_create_t type, vsecattr_t *vsecp, vattr_t *vap)
static void zfs_log_xvattr (lr_attr_t *lrattr, xvattr_t *xvap)
 build up the log data necessary for logging xvattr_t First lr_attr_t is initialized.
static void * zfs_log_fuid_ids (zfs_fuid_info_t *fuidp, void *start)
static void * zfs_log_fuid_domains (zfs_fuid_info_t *fuidp, void *start)
void zfs_log_create (zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, znode_t *dzp, znode_t *zp, char *name, vsecattr_t *vsecp, zfs_fuid_info_t *fuidp, vattr_t *vap)
 Handles TX_CREATE, TX_CREATE_ATTR, TX_MKDIR, TX_MKDIR_ATTR and TX_MKXATTR transactions.
void zfs_log_remove (zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, znode_t *dzp, char *name, uint64_t foid)
 handles both TX_REMOVE and TX_RMDIR transactions.
void zfs_log_link (zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, znode_t *dzp, znode_t *zp, char *name)
 handles TX_LINK transactions.
void zfs_log_symlink (zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, znode_t *dzp, znode_t *zp, char *name, char *link)
 handles TX_SYMLINK transactions.
void zfs_log_rename (zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, znode_t *sdzp, char *sname, znode_t *tdzp, char *dname, znode_t *szp)
 handles TX_RENAME transactions.
void zfs_log_write (zilog_t *zilog, dmu_tx_t *tx, int txtype, znode_t *zp, offset_t off, ssize_t resid, int ioflag)
void zfs_log_truncate (zilog_t *zilog, dmu_tx_t *tx, int txtype, znode_t *zp, uint64_t off, uint64_t len)
 handles TX_TRUNCATE transactions.
void zfs_log_setattr (zilog_t *zilog, dmu_tx_t *tx, int txtype, znode_t *zp, vattr_t *vap, uint_t mask_applied, zfs_fuid_info_t *fuidp)
 handles TX_SETATTR transactions.
void zfs_log_acl (zilog_t *zilog, dmu_tx_t *tx, znode_t *zp, vsecattr_t *vsecp, zfs_fuid_info_t *fuidp)
 handles TX_ACL transactions.

Variables

ssize_t zfs_immediate_write_sz = 32768
 handles TX_WRITE transactions.

Detailed Description

Routines to manage intent log entries.

These zfs_log_* functions must be called within a dmu tx, in one of 2 contexts depending on zilog->z_replay:

Non replay mode --------------- We need to record the transaction so that if it is committed to the Intent Log then it can be replayed. An intent log transaction structure (itx_t) is allocated and all the information necessary to possibly replay the transaction is saved in it. The itx is then assigned a sequence number and inserted in the in-memory list anchored in the zilog.

Replay mode ----------- We need to mark the intent log record as replayed in the log header. This is done in the same transaction as the replay so that they commit atomically.

Definition in file zfs_log.c.


Function Documentation

void zfs_log_acl ( zilog_t zilog,
dmu_tx_t tx,
znode_t zp,
vsecattr_t *  vsecp,
zfs_fuid_info_t fuidp 
)

handles TX_ACL transactions.

Definition at line 623 of file zfs_log.c.

void zfs_log_create ( zilog_t zilog,
dmu_tx_t tx,
uint64_t  txtype,
znode_t dzp,
znode_t zp,
char *  name,
vsecattr_t *  vsecp,
zfs_fuid_info_t fuidp,
vattr_t *  vap 
)

Handles TX_CREATE, TX_CREATE_ATTR, TX_MKDIR, TX_MKDIR_ATTR and TX_MKXATTR transactions.

TX_CREATE and TX_MKDIR are standard creates, but they may have FUID domain information appended prior to the name. In this case the uid/gid in the log record will be a log centric FUID.

TX_CREATE_ACL_ATTR and TX_MKDIR_ACL_ATTR handle special creates that may contain attributes, ACL and optional fuid information.

TX_CREATE_ACL and TX_MKDIR_ACL handle special creates that specify and ACL and normal users/groups in the ACEs.

There may be an optional xvattr attribute information similar to zfs_log_setattr.

Also, after the file name "domain" strings may be appended.

Definition at line 241 of file zfs_log.c.

int zfs_log_create_txtype ( zil_create_t  type,
vsecattr_t *  vsecp,
vattr_t *  vap 
)

Definition at line 69 of file zfs_log.c.

static void* zfs_log_fuid_domains ( zfs_fuid_info_t fuidp,
void *  start 
) [static]

Definition at line 204 of file zfs_log.c.

static void* zfs_log_fuid_ids ( zfs_fuid_info_t fuidp,
void *  start 
) [static]

Definition at line 189 of file zfs_log.c.

void zfs_log_link ( zilog_t zilog,
dmu_tx_t tx,
uint64_t  txtype,
znode_t dzp,
znode_t zp,
char *  name 
)

handles TX_LINK transactions.

Definition at line 378 of file zfs_log.c.

void zfs_log_remove ( zilog_t zilog,
dmu_tx_t tx,
uint64_t  txtype,
znode_t dzp,
char *  name,
uint64_t  foid 
)

handles both TX_REMOVE and TX_RMDIR transactions.

Definition at line 354 of file zfs_log.c.

void zfs_log_rename ( zilog_t zilog,
dmu_tx_t tx,
uint64_t  txtype,
znode_t sdzp,
char *  sname,
znode_t tdzp,
char *  dname,
znode_t szp 
)

handles TX_RENAME transactions.

Definition at line 433 of file zfs_log.c.

void zfs_log_setattr ( zilog_t zilog,
dmu_tx_t tx,
int  txtype,
znode_t zp,
vattr_t *  vap,
uint_t  mask_applied,
zfs_fuid_info_t fuidp 
)

handles TX_SETATTR transactions.

Definition at line 561 of file zfs_log.c.

void zfs_log_symlink ( zilog_t zilog,
dmu_tx_t tx,
uint64_t  txtype,
znode_t dzp,
znode_t zp,
char *  name,
char *  link 
)

handles TX_SYMLINK transactions.

Definition at line 401 of file zfs_log.c.

void zfs_log_truncate ( zilog_t zilog,
dmu_tx_t tx,
int  txtype,
znode_t zp,
uint64_t  off,
uint64_t  len 
)

handles TX_TRUNCATE transactions.

Definition at line 538 of file zfs_log.c.

void zfs_log_write ( zilog_t zilog,
dmu_tx_t tx,
int  txtype,
znode_t zp,
offset_t  off,
ssize_t  resid,
int  ioflag 
)

Definition at line 461 of file zfs_log.c.

static void zfs_log_xvattr ( lr_attr_t lrattr,
xvattr_t *  xvap 
) [static]

build up the log data necessary for logging xvattr_t First lr_attr_t is initialized.

following the lr_attr_t is the mapsize and attribute bitmap copied from the xvattr_t. Following the bitmap and bitmapsize two 64 bit words are reserved for the create time which may be set. Following the create time records a single 64 bit integer which has the bits to set on replay for the xvattr.

Definition at line 117 of file zfs_log.c.


Variable Documentation

ssize_t zfs_immediate_write_sz = 32768

handles TX_WRITE transactions.

Definition at line 458 of file zfs_log.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines