FreeBSD ZFS
The Zettabyte File System
Functions | Variables

zfs_replay.c File Reference

Functions to replay ZFS intent log (ZIL) records The functions are called through a function vector (zfs_replay_vector) which is indexed by the transaction type. 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/fcntl.h>
#include <sys/vfs.h>
#include <sys/fs/zfs.h>
#include <sys/zfs_znode.h>
#include <sys/zfs_dir.h>
#include <sys/zfs_acl.h>
#include <sys/zfs_fuid.h>
#include <sys/spa.h>
#include <sys/zil.h>
#include <sys/byteorder.h>
#include <sys/stat.h>
#include <sys/acl.h>
#include <sys/atomic.h>
#include <sys/cred.h>
#include <sys/namei.h>
Include dependency graph for zfs_replay.c:

Go to the source code of this file.

Functions

static void zfs_init_vattr (vattr_t *vap, uint64_t mask, uint64_t mode, uint64_t uid, uint64_t gid, uint64_t rdev, uint64_t nodeid)
static int zfs_replay_error (zfsvfs_t *zfsvfs, lr_t *lr, boolean_t byteswap)
static void zfs_replay_xvattr (lr_attr_t *lrattr, xvattr_t *xvap)
static int zfs_replay_domain_cnt (uint64_t uid, uint64_t gid)
static void * zfs_replay_fuid_domain_common (zfs_fuid_info_t *fuid_infop, void *start, int domcnt)
static void zfs_replay_fuid_ugid (zfs_fuid_info_t *fuid_infop, uint64_t uid, uint64_t gid)
 Set the uid/gid in the fuid_info structure.
static zfs_fuid_info_tzfs_replay_fuid_domain (void *buf, void **end, uint64_t uid, uint64_t gid)
 Load fuid domains into fuid_info_t.
static zfs_fuid_info_tzfs_replay_fuids (void *start, void **end, int idcnt, int domcnt, uint64_t uid, uint64_t gid)
 load zfs_fuid_t's and fuid_domains into fuid_info_t
static void zfs_replay_swap_attrs (lr_attr_t *lrattr)
static int zfs_replay_create_acl (zfsvfs_t *zfsvfs, lr_acl_create_t *lracl, boolean_t byteswap)
 Replay file create with optional ACL, xvattr information as well as option FUID information.
static int zfs_replay_create (zfsvfs_t *zfsvfs, lr_create_t *lr, boolean_t byteswap)
static int zfs_replay_remove (zfsvfs_t *zfsvfs, lr_remove_t *lr, boolean_t byteswap)
static int zfs_replay_link (zfsvfs_t *zfsvfs, lr_link_t *lr, boolean_t byteswap)
static int zfs_replay_rename (zfsvfs_t *zfsvfs, lr_rename_t *lr, boolean_t byteswap)
static int zfs_replay_write (zfsvfs_t *zfsvfs, lr_write_t *lr, boolean_t byteswap)
static int zfs_replay_write2 (zfsvfs_t *zfsvfs, lr_write_t *lr, boolean_t byteswap)
 TX_WRITE2 are only generated when dmu_sync() returns EALREADY meaning the pool block is already being synced.
static int zfs_replay_truncate (zfsvfs_t *zfsvfs, lr_truncate_t *lr, boolean_t byteswap)
static int zfs_replay_setattr (zfsvfs_t *zfsvfs, lr_setattr_t *lr, boolean_t byteswap)
int zfs_setsecattr (vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr, caller_context_t *ct)
static int zfs_replay_acl_v0 (zfsvfs_t *zfsvfs, lr_acl_v0_t *lr, boolean_t byteswap)
static int zfs_replay_acl (zfsvfs_t *zfsvfs, lr_acl_t *lr, boolean_t byteswap)
 Replaying ACLs is complicated by FUID support.

Variables

zil_replay_func_tzfs_replay_vector [TX_MAX_TYPE]
 Callback vectors for replaying records.

Detailed Description

Functions to replay ZFS intent log (ZIL) records The functions are called through a function vector (zfs_replay_vector) which is indexed by the transaction type.

Definition in file zfs_replay.c.


Function Documentation

static void zfs_init_vattr ( vattr_t *  vap,
uint64_t  mask,
uint64_t  mode,
uint64_t  uid,
uint64_t  gid,
uint64_t  rdev,
uint64_t  nodeid 
) [static]

Definition at line 56 of file zfs_replay.c.

static int zfs_replay_acl ( zfsvfs_t zfsvfs,
lr_acl_t lr,
boolean_t  byteswap 
) [static]

Replaying ACLs is complicated by FUID support.

The log record may contain some optional data to be used for replaying FUID's. These pieces are the actual FUIDs that were created initially. The FUID table index may no longer be valid and during zfs_create() a new index may be assigned. Because of this the log will contain the original doman+rid in order to create a new FUID.

The individual ACEs may contain an ephemeral uid/gid which is no longer valid and will need to be replaced with an actual FUID.

Definition at line 960 of file zfs_replay.c.

static int zfs_replay_acl_v0 ( zfsvfs_t zfsvfs,
lr_acl_v0_t lr,
boolean_t  byteswap 
) [static]

Definition at line 912 of file zfs_replay.c.

static int zfs_replay_create ( zfsvfs_t zfsvfs,
lr_create_t lr,
boolean_t  byteswap 
) [static]

Definition at line 417 of file zfs_replay.c.

static int zfs_replay_create_acl ( zfsvfs_t zfsvfs,
lr_acl_create_t lracl,
boolean_t  byteswap 
) [static]

Replay file create with optional ACL, xvattr information as well as option FUID information.

Definition at line 268 of file zfs_replay.c.

static int zfs_replay_domain_cnt ( uint64_t  uid,
uint64_t  gid 
) [static]

Definition at line 142 of file zfs_replay.c.

static int zfs_replay_error ( zfsvfs_t zfsvfs,
lr_t lr,
boolean_t  byteswap 
) [static]

Definition at line 75 of file zfs_replay.c.

static zfs_fuid_info_t* zfs_replay_fuid_domain ( void *  buf,
void **  end,
uint64_t  uid,
uint64_t  gid 
) [static]

Load fuid domains into fuid_info_t.

Definition at line 193 of file zfs_replay.c.

static void* zfs_replay_fuid_domain_common ( zfs_fuid_info_t fuid_infop,
void *  start,
int  domcnt 
) [static]

Definition at line 159 of file zfs_replay.c.

static void zfs_replay_fuid_ugid ( zfs_fuid_info_t fuid_infop,
uint64_t  uid,
uint64_t  gid 
) [static]

Set the uid/gid in the fuid_info structure.

Definition at line 176 of file zfs_replay.c.

static zfs_fuid_info_t* zfs_replay_fuids ( void *  start,
void **  end,
int  idcnt,
int  domcnt,
uint64_t  uid,
uint64_t  gid 
) [static]

load zfs_fuid_t's and fuid_domains into fuid_info_t

Definition at line 220 of file zfs_replay.c.

static int zfs_replay_link ( zfsvfs_t zfsvfs,
lr_link_t lr,
boolean_t  byteswap 
) [static]

Definition at line 600 of file zfs_replay.c.

static int zfs_replay_remove ( zfsvfs_t zfsvfs,
lr_remove_t lr,
boolean_t  byteswap 
) [static]

Definition at line 549 of file zfs_replay.c.

static int zfs_replay_rename ( zfsvfs_t zfsvfs,
lr_rename_t lr,
boolean_t  byteswap 
) [static]

Definition at line 640 of file zfs_replay.c.

static int zfs_replay_setattr ( zfsvfs_t zfsvfs,
lr_setattr_t lr,
boolean_t  byteswap 
) [static]

Definition at line 853 of file zfs_replay.c.

static void zfs_replay_swap_attrs ( lr_attr_t lrattr) [static]

Definition at line 251 of file zfs_replay.c.

static int zfs_replay_truncate ( zfsvfs_t zfsvfs,
lr_truncate_t lr,
boolean_t  byteswap 
) [static]

Definition at line 821 of file zfs_replay.c.

static int zfs_replay_write ( zfsvfs_t zfsvfs,
lr_write_t lr,
boolean_t  byteswap 
) [static]

Definition at line 710 of file zfs_replay.c.

static int zfs_replay_write2 ( zfsvfs_t zfsvfs,
lr_write_t lr,
boolean_t  byteswap 
) [static]

TX_WRITE2 are only generated when dmu_sync() returns EALREADY meaning the pool block is already being synced.

So now that we always write out full blocks, all we have to do is expand the eof if the file is grown.

Definition at line 776 of file zfs_replay.c.

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

Definition at line 81 of file zfs_replay.c.

int zfs_setsecattr ( vnode_t *  vp,
vsecattr_t *  vsecp,
int  flag,
cred_t *  cr,
caller_context_t *  ct 
)

Definition at line 5160 of file zfs_vnops.c.


Variable Documentation

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines