zfs_log.c revision f70bbcca912017a3c39932a2cf2972f660b31aed
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER START
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The contents of this file are subject to the terms of the
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin * Common Development and Distribution License (the "License").
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin * You may not use this file except in compliance with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens * or http://www.opensolaris.org/os/licensing.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens * and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * When distributing Covered Code, include this CDDL HEADER in each
fa9e4066f08beec538e775443c5be79dd423fcabahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If applicable, add the following below this CDDL HEADER, with the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * fields enclosed by brackets "[]" replaced with your own identifying
fa9e4066f08beec538e775443c5be79dd423fcabahrens * information: Portions Copyright [yyyy] [name of copyright owner]
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER END
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
abf76b6e4d85aa239adaaf63d27232cc4d65d9f0perrin * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Use is subject to license terms.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#pragma ident "%Z%%M% %I% %E% SMI"
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/types.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/param.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/systm.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/sysmacros.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/cmn_err.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/kmem.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/thread.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/file.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/vfs.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/zfs_znode.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/zfs_dir.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/zil.h>
6ce0521ac291be36119f359237066c4fb8088683perrin#include <sys/zil_impl.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/byteorder.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/policy.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/stat.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/mode.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/acl.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/dmu.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/spa.h>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#include <sys/zfs_fuid.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/ddi.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * All the functions in this file are used to construct the log entries
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * to record transactions. They allocate * an intent log transaction
fa9e4066f08beec538e775443c5be79dd423fcabahrens * structure (itx_t) and save within it all the information necessary to
fa9e4066f08beec538e775443c5be79dd423fcabahrens * possibly replay the transaction. The itx is then assigned a sequence
fa9e4066f08beec538e775443c5be79dd423fcabahrens * number and inserted in the in-memory list anchored in the zilog.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwint
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwzfs_log_create_txtype(zil_create_t type, vsecattr_t *vsecp, vattr_t *vap)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw{
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw int isxvattr = (vap->va_mask & AT_XVATTR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw switch (type) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw case Z_FILE:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (vsecp == NULL && !isxvattr)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (TX_CREATE);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (vsecp && isxvattr)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (TX_CREATE_ACL_ATTR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (vsecp)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (TX_CREATE_ACL);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw else
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (TX_CREATE_ATTR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /*NOTREACHED*/
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw case Z_DIR:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (vsecp == NULL && !isxvattr)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (TX_MKDIR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (vsecp && isxvattr)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (TX_MKDIR_ACL_ATTR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (vsecp)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (TX_MKDIR_ACL);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw else
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (TX_MKDIR_ATTR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw case Z_XATTRDIR:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (TX_MKXATTR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ASSERT(0);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (TX_MAX_TYPE);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw}
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * build up the log data necessary for logging xvattr_t
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * First lr_attr_t is initialized. following the lr_attr_t
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * is the mapsize and attribute bitmap copied from the xvattr_t.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Following the bitmap and bitmapsize two 64 bit words are reserved
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * for the create time which may be set. Following the create time
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * records a single 64 bit integer which has the bits to set on
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * replay for the xvattr.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwstatic void
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwzfs_log_xvattr(lr_attr_t *lrattr, xvattr_t *xvap)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw{
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint32_t *bitmap;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint64_t *attrs;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint64_t *crtime;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw xoptattr_t *xoap;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw void *scanstamp;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw int i;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw xoap = xva_getxoptattr(xvap);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ASSERT(xoap);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lrattr->lr_attr_masksize = xvap->xva_mapsize;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw bitmap = &lrattr->lr_attr_bitmap;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw for (i = 0; i != xvap->xva_mapsize; i++, bitmap++) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *bitmap = xvap->xva_reqattrmap[i];
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* Now pack the attributes up in a single uint64_t */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw attrs = (uint64_t *)bitmap;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw crtime = attrs + 1;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw scanstamp = (caddr_t)(crtime + 2);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *attrs = 0;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (XVA_ISSET_REQ(xvap, XAT_READONLY))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *attrs |= (xoap->xoa_readonly == 0) ? 0 :
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw XAT0_READONLY;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (XVA_ISSET_REQ(xvap, XAT_HIDDEN))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *attrs |= (xoap->xoa_hidden == 0) ? 0 :
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw XAT0_HIDDEN;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (XVA_ISSET_REQ(xvap, XAT_SYSTEM))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *attrs |= (xoap->xoa_system == 0) ? 0 :
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw XAT0_SYSTEM;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (XVA_ISSET_REQ(xvap, XAT_ARCHIVE))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *attrs |= (xoap->xoa_archive == 0) ? 0 :
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw XAT0_ARCHIVE;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (XVA_ISSET_REQ(xvap, XAT_IMMUTABLE))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *attrs |= (xoap->xoa_immutable == 0) ? 0 :
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw XAT0_IMMUTABLE;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (XVA_ISSET_REQ(xvap, XAT_NOUNLINK))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *attrs |= (xoap->xoa_nounlink == 0) ? 0 :
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw XAT0_NOUNLINK;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (XVA_ISSET_REQ(xvap, XAT_APPENDONLY))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *attrs |= (xoap->xoa_appendonly == 0) ? 0 :
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw XAT0_APPENDONLY;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (XVA_ISSET_REQ(xvap, XAT_OPAQUE))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *attrs |= (xoap->xoa_opaque == 0) ? 0 :
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw XAT0_APPENDONLY;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (XVA_ISSET_REQ(xvap, XAT_NODUMP))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *attrs |= (xoap->xoa_nodump == 0) ? 0 :
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw XAT0_NODUMP;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (XVA_ISSET_REQ(xvap, XAT_AV_QUARANTINED))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *attrs |= (xoap->xoa_av_quarantined == 0) ? 0 :
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw XAT0_AV_QUARANTINED;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (XVA_ISSET_REQ(xvap, XAT_AV_MODIFIED))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *attrs |= (xoap->xoa_av_modified == 0) ? 0 :
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw XAT0_AV_MODIFIED;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (XVA_ISSET_REQ(xvap, XAT_CREATETIME))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ZFS_TIME_ENCODE(&xoap->xoa_createtime, crtime);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (XVA_ISSET_REQ(xvap, XAT_AV_SCANSTAMP))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw bcopy(xoap->xoa_av_scanstamp, scanstamp, AV_SCANSTAMP_SZ);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw}
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwstatic void *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwzfs_log_fuid_ids(zfs_fuid_info_t *fuidp, void *start)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw{
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw zfs_fuid_t *zfuid;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint64_t *fuidloc = start;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* First copy in the ACE FUIDs */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw for (zfuid = list_head(&fuidp->z_fuids); zfuid;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw zfuid = list_next(&fuidp->z_fuids, zfuid)) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *fuidloc++ = zfuid->z_logfuid;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (fuidloc);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw}
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwstatic void *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwzfs_log_fuid_domains(zfs_fuid_info_t *fuidp, void *start)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw{
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw zfs_fuid_domain_t *zdomain;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* now copy in the domain info, if any */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (fuidp->z_domain_str_sz != 0) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw for (zdomain = list_head(&fuidp->z_domains); zdomain;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw zdomain = list_next(&fuidp->z_domains, zdomain)) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw bcopy((void *)zdomain->z_domain, start,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw strlen(zdomain->z_domain) + 1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw start = (caddr_t)start +
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw strlen(zdomain->z_domain) + 1;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (start);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw}
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * zfs_log_create() is used to handle TX_CREATE, TX_CREATE_ATTR, TX_MKDIR,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * TX_MKDIR_ATTR and TX_MKXATTR
fa9e4066f08beec538e775443c5be79dd423fcabahrens * transactions.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * TX_CREATE and TX_MKDIR are standard creates, but they may have FUID
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * domain information appended prior to the name. In this case the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * uid/gid in the log record will be a log centric FUID.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * TX_CREATE_ACL_ATTR and TX_MKDIR_ACL_ATTR handle special creates that
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * may contain attributes, ACL and optional fuid information.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * TX_CREATE_ACL and TX_MKDIR_ACL handle special creates that specify
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and ACL and normal users/groups in the ACEs.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * There may be an optional xvattr attribute information similar
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * to zfs_log_setattr.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Also, after the file name "domain" strings may be appended.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrinvoid
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwzfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw znode_t *dzp, znode_t *zp, char *name, vsecattr_t *vsecp,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw zfs_fuid_info_t *fuidp, vattr_t *vap)
fa9e4066f08beec538e775443c5be79dd423fcabahrens{
fa9e4066f08beec538e775443c5be79dd423fcabahrens itx_t *itx;
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr_create_t *lr;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr_acl_create_t *lracl;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw size_t aclsize;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw size_t xvatsize = 0;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw size_t txsize;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw xvattr_t *xvap = (xvattr_t *)vap;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw void *end;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw size_t lrsize;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
fa9e4066f08beec538e775443c5be79dd423fcabahrens size_t namesize = strlen(name) + 1;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw size_t fuidsz = 0;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens if (zilog == NULL)
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrin return;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If we have FUIDs present then add in space for
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * domains and ACE fuid's if any.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (fuidp) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw fuidsz += fuidp->z_domain_str_sz;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw fuidsz += fuidp->z_fuid_cnt * sizeof (uint64_t);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (vap->va_mask & AT_XVATTR)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw xvatsize = ZIL_XVAT_SIZE(xvap->xva_mapsize);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if ((int)txtype == TX_CREATE_ATTR || (int)txtype == TX_MKDIR_ATTR ||
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw (int)txtype == TX_CREATE || (int)txtype == TX_MKDIR ||
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw (int)txtype == TX_MKXATTR) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw txsize = sizeof (*lr) + namesize + fuidsz + xvatsize;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lrsize = sizeof (*lr);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw } else {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw aclsize = (vsecp) ? vsecp->vsa_aclentsz : 0;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw txsize =
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw sizeof (lr_acl_create_t) + namesize + fuidsz +
569e6c63191416b7413c148fd5a6194a0b820b2cmarks ZIL_ACE_LENGTH(aclsize) + xvatsize;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lrsize = sizeof (lr_acl_create_t);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw itx = zil_itx_create(txtype, txsize);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr = (lr_create_t *)&itx->itx_lr;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_doid = dzp->z_id;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_foid = zp->z_id;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_mode = zp->z_phys->zp_mode;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (!IS_EPHEMERAL(zp->z_phys->zp_uid)) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr->lr_uid = (uint64_t)zp->z_phys->zp_uid;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw } else {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr->lr_uid = fuidp->z_fuid_owner;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (!IS_EPHEMERAL(zp->z_phys->zp_gid)) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr->lr_gid = (uint64_t)zp->z_phys->zp_gid;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw } else {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr->lr_gid = fuidp->z_fuid_group;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_gen = zp->z_phys->zp_gen;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_crtime[0] = zp->z_phys->zp_crtime[0];
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_crtime[1] = zp->z_phys->zp_crtime[1];
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_rdev = zp->z_phys->zp_rdev;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Fill in xvattr info if any
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (vap->va_mask & AT_XVATTR) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw zfs_log_xvattr((lr_attr_t *)((caddr_t)lr + lrsize), xvap);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw end = (caddr_t)lr + lrsize + xvatsize;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw } else {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw end = (caddr_t)lr + lrsize;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* Now fill in any ACL info */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (vsecp) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lracl = (lr_acl_create_t *)&itx->itx_lr;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lracl->lr_aclcnt = vsecp->vsa_aclcnt;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lracl->lr_acl_bytes = aclsize;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lracl->lr_domcnt = fuidp ? fuidp->z_domain_cnt : 0;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lracl->lr_fuidcnt = fuidp ? fuidp->z_fuid_cnt : 0;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (vsecp->vsa_aclflags & VSA_ACE_ACLFLAGS)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lracl->lr_acl_flags = (uint64_t)vsecp->vsa_aclflags;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw else
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lracl->lr_acl_flags = 0;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw bcopy(vsecp->vsa_aclentp, end, aclsize);
569e6c63191416b7413c148fd5a6194a0b820b2cmarks end = (caddr_t)end + ZIL_ACE_LENGTH(aclsize);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* drop in FUID info */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (fuidp) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw end = zfs_log_fuid_ids(fuidp, end);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw end = zfs_log_fuid_domains(fuidp, end);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Now place file name in log record
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw bcopy(name, end, namesize);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens seq = zil_itx_assign(zilog, itx, tx);
fa9e4066f08beec538e775443c5be79dd423fcabahrens dzp->z_last_itx = seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens zp->z_last_itx = seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * zfs_log_remove() handles both TX_REMOVE and TX_RMDIR transactions.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrinvoid
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwzfs_log_remove(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
fa9e4066f08beec538e775443c5be79dd423fcabahrens znode_t *dzp, char *name)
fa9e4066f08beec538e775443c5be79dd423fcabahrens{
fa9e4066f08beec538e775443c5be79dd423fcabahrens itx_t *itx;
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr_remove_t *lr;
fa9e4066f08beec538e775443c5be79dd423fcabahrens size_t namesize = strlen(name) + 1;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens if (zilog == NULL)
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrin return;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens itx = zil_itx_create(txtype, sizeof (*lr) + namesize);
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr = (lr_remove_t *)&itx->itx_lr;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_doid = dzp->z_id;
fa9e4066f08beec538e775443c5be79dd423fcabahrens bcopy(name, (char *)(lr + 1), namesize);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens seq = zil_itx_assign(zilog, itx, tx);
fa9e4066f08beec538e775443c5be79dd423fcabahrens dzp->z_last_itx = seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * zfs_log_link() handles TX_LINK transactions.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrinvoid
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwzfs_log_link(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
fa9e4066f08beec538e775443c5be79dd423fcabahrens znode_t *dzp, znode_t *zp, char *name)
fa9e4066f08beec538e775443c5be79dd423fcabahrens{
fa9e4066f08beec538e775443c5be79dd423fcabahrens itx_t *itx;
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr_link_t *lr;
fa9e4066f08beec538e775443c5be79dd423fcabahrens size_t namesize = strlen(name) + 1;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens if (zilog == NULL)
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrin return;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens itx = zil_itx_create(txtype, sizeof (*lr) + namesize);
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr = (lr_link_t *)&itx->itx_lr;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_doid = dzp->z_id;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_link_obj = zp->z_id;
fa9e4066f08beec538e775443c5be79dd423fcabahrens bcopy(name, (char *)(lr + 1), namesize);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens seq = zil_itx_assign(zilog, itx, tx);
fa9e4066f08beec538e775443c5be79dd423fcabahrens dzp->z_last_itx = seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens zp->z_last_itx = seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * zfs_log_symlink() handles TX_SYMLINK transactions.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrinvoid
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwzfs_log_symlink(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw znode_t *dzp, znode_t *zp, char *name, char *link)
fa9e4066f08beec538e775443c5be79dd423fcabahrens{
fa9e4066f08beec538e775443c5be79dd423fcabahrens itx_t *itx;
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr_create_t *lr;
fa9e4066f08beec538e775443c5be79dd423fcabahrens size_t namesize = strlen(name) + 1;
fa9e4066f08beec538e775443c5be79dd423fcabahrens size_t linksize = strlen(link) + 1;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens if (zilog == NULL)
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrin return;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens itx = zil_itx_create(txtype, sizeof (*lr) + namesize + linksize);
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr = (lr_create_t *)&itx->itx_lr;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_doid = dzp->z_id;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_foid = zp->z_id;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_mode = zp->z_phys->zp_mode;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_uid = zp->z_phys->zp_uid;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_gid = zp->z_phys->zp_gid;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_gen = zp->z_phys->zp_gen;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_crtime[0] = zp->z_phys->zp_crtime[0];
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_crtime[1] = zp->z_phys->zp_crtime[1];
fa9e4066f08beec538e775443c5be79dd423fcabahrens bcopy(name, (char *)(lr + 1), namesize);
fa9e4066f08beec538e775443c5be79dd423fcabahrens bcopy(link, (char *)(lr + 1) + namesize, linksize);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens seq = zil_itx_assign(zilog, itx, tx);
fa9e4066f08beec538e775443c5be79dd423fcabahrens dzp->z_last_itx = seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens zp->z_last_itx = seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * zfs_log_rename() handles TX_RENAME transactions.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrinvoid
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwzfs_log_rename(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
fa9e4066f08beec538e775443c5be79dd423fcabahrens znode_t *sdzp, char *sname, znode_t *tdzp, char *dname, znode_t *szp)
fa9e4066f08beec538e775443c5be79dd423fcabahrens{
fa9e4066f08beec538e775443c5be79dd423fcabahrens itx_t *itx;
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr_rename_t *lr;
fa9e4066f08beec538e775443c5be79dd423fcabahrens size_t snamesize = strlen(sname) + 1;
fa9e4066f08beec538e775443c5be79dd423fcabahrens size_t dnamesize = strlen(dname) + 1;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens if (zilog == NULL)
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrin return;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens itx = zil_itx_create(txtype, sizeof (*lr) + snamesize + dnamesize);
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr = (lr_rename_t *)&itx->itx_lr;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_sdoid = sdzp->z_id;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_tdoid = tdzp->z_id;
fa9e4066f08beec538e775443c5be79dd423fcabahrens bcopy(sname, (char *)(lr + 1), snamesize);
fa9e4066f08beec538e775443c5be79dd423fcabahrens bcopy(dname, (char *)(lr + 1) + snamesize, dnamesize);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens seq = zil_itx_assign(zilog, itx, tx);
fa9e4066f08beec538e775443c5be79dd423fcabahrens sdzp->z_last_itx = seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens tdzp->z_last_itx = seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens szp->z_last_itx = seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * zfs_log_write() handles TX_WRITE transactions.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
c5c6ffa0498b9c8555798756141b4a3061a138c1maybeessize_t zfs_immediate_write_sz = 32768;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
6ce0521ac291be36119f359237066c4fb8088683perrin#define ZIL_MAX_LOG_DATA (SPA_MAXBLOCKSIZE - sizeof (zil_trailer_t) - \
6ce0521ac291be36119f359237066c4fb8088683perrin sizeof (lr_write_t))
6ce0521ac291be36119f359237066c4fb8088683perrin
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrinvoid
fa9e4066f08beec538e775443c5be79dd423fcabahrenszfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype,
6ce0521ac291be36119f359237066c4fb8088683perrin znode_t *zp, offset_t off, ssize_t resid, int ioflag)
fa9e4066f08beec538e775443c5be79dd423fcabahrens{
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin itx_wr_state_t write_state;
6ce0521ac291be36119f359237066c4fb8088683perrin boolean_t slogging;
ec533521f091387e2911769818ae4be26219fca2fr uintptr_t fsync_cnt;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
893a6d32980d24be1349478f44169009d4801c25ahrens if (zilog == NULL || zp->z_unlinked)
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrin return;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin /*
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin * Writes are handled in three different ways:
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin *
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin * WR_INDIRECT:
6ce0521ac291be36119f359237066c4fb8088683perrin * If the write is greater than zfs_immediate_write_sz and there are
6ce0521ac291be36119f359237066c4fb8088683perrin * no separate logs in this pool then later *if* we need to log the
6ce0521ac291be36119f359237066c4fb8088683perrin * write then dmu_sync() is used to immediately write the block and
6ce0521ac291be36119f359237066c4fb8088683perrin * its block pointer is put in the log record.
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin * WR_COPIED:
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin * If we know we'll immediately be committing the
f70bbcca912017a3c39932a2cf2972f660b31aedperrin * transaction (FSYNC or FDSYNC), the we allocate a larger
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin * log record here for the data and copy the data in.
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin * WR_NEED_COPY:
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin * Otherwise we don't allocate a buffer, and *if* we need to
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin * flush the write later then a buffer is allocated and
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin * we retrieve the data using the dmu.
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin */
6ce0521ac291be36119f359237066c4fb8088683perrin slogging = spa_has_slogs(zilog->zl_spa);
6ce0521ac291be36119f359237066c4fb8088683perrin if (resid > zfs_immediate_write_sz && !slogging)
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin write_state = WR_INDIRECT;
f70bbcca912017a3c39932a2cf2972f660b31aedperrin else if (ioflag & (FSYNC | FDSYNC))
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin write_state = WR_COPIED;
feb08c6bb47ceffa5bb7a70f2c0549113f40fcc5billm else
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin write_state = WR_NEED_COPY;
feb08c6bb47ceffa5bb7a70f2c0549113f40fcc5billm
ec533521f091387e2911769818ae4be26219fca2fr if ((fsync_cnt = (uintptr_t)tsd_get(zfs_fsyncer_key)) != 0) {
ec533521f091387e2911769818ae4be26219fca2fr (void) tsd_set(zfs_fsyncer_key, (void *)(fsync_cnt - 1));
ec533521f091387e2911769818ae4be26219fca2fr }
ec533521f091387e2911769818ae4be26219fca2fr
6ce0521ac291be36119f359237066c4fb8088683perrin while (resid) {
6ce0521ac291be36119f359237066c4fb8088683perrin itx_t *itx;
6ce0521ac291be36119f359237066c4fb8088683perrin lr_write_t *lr;
6ce0521ac291be36119f359237066c4fb8088683perrin ssize_t len;
6ce0521ac291be36119f359237066c4fb8088683perrin
6ce0521ac291be36119f359237066c4fb8088683perrin /*
6ce0521ac291be36119f359237066c4fb8088683perrin * If there are slogs and the write would overflow the largest
6ce0521ac291be36119f359237066c4fb8088683perrin * block, then because we don't want to use the main pool
6ce0521ac291be36119f359237066c4fb8088683perrin * to dmu_sync, we have to split the write.
6ce0521ac291be36119f359237066c4fb8088683perrin */
6ce0521ac291be36119f359237066c4fb8088683perrin if (slogging && resid > ZIL_MAX_LOG_DATA)
6ce0521ac291be36119f359237066c4fb8088683perrin len = SPA_MAXBLOCKSIZE >> 1;
6ce0521ac291be36119f359237066c4fb8088683perrin else
6ce0521ac291be36119f359237066c4fb8088683perrin len = resid;
6ce0521ac291be36119f359237066c4fb8088683perrin
6ce0521ac291be36119f359237066c4fb8088683perrin itx = zil_itx_create(txtype, sizeof (*lr) +
6ce0521ac291be36119f359237066c4fb8088683perrin (write_state == WR_COPIED ? len : 0));
6ce0521ac291be36119f359237066c4fb8088683perrin lr = (lr_write_t *)&itx->itx_lr;
6ce0521ac291be36119f359237066c4fb8088683perrin if (write_state == WR_COPIED && dmu_read(zp->z_zfsvfs->z_os,
6ce0521ac291be36119f359237066c4fb8088683perrin zp->z_id, off, len, lr + 1) != 0) {
feb08c6bb47ceffa5bb7a70f2c0549113f40fcc5billm kmem_free(itx, offsetof(itx_t, itx_lr) +
feb08c6bb47ceffa5bb7a70f2c0549113f40fcc5billm itx->itx_lr.lrc_reclen);
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin itx = zil_itx_create(txtype, sizeof (*lr));
feb08c6bb47ceffa5bb7a70f2c0549113f40fcc5billm lr = (lr_write_t *)&itx->itx_lr;
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin write_state = WR_NEED_COPY;
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin }
feb08c6bb47ceffa5bb7a70f2c0549113f40fcc5billm
6ce0521ac291be36119f359237066c4fb8088683perrin itx->itx_wr_state = write_state;
abf76b6e4d85aa239adaaf63d27232cc4d65d9f0perrin if (write_state == WR_NEED_COPY)
abf76b6e4d85aa239adaaf63d27232cc4d65d9f0perrin itx->itx_sod += len;
6ce0521ac291be36119f359237066c4fb8088683perrin lr->lr_foid = zp->z_id;
6ce0521ac291be36119f359237066c4fb8088683perrin lr->lr_offset = off;
6ce0521ac291be36119f359237066c4fb8088683perrin lr->lr_length = len;
6ce0521ac291be36119f359237066c4fb8088683perrin lr->lr_blkoff = 0;
6ce0521ac291be36119f359237066c4fb8088683perrin BP_ZERO(&lr->lr_blkptr);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
6ce0521ac291be36119f359237066c4fb8088683perrin itx->itx_private = zp->z_zfsvfs;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
f70bbcca912017a3c39932a2cf2972f660b31aedperrin if ((zp->z_sync_cnt != 0) || (fsync_cnt != 0) ||
f70bbcca912017a3c39932a2cf2972f660b31aedperrin (ioflag & (FSYNC | FDSYNC)))
ec533521f091387e2911769818ae4be26219fca2fr itx->itx_sync = B_TRUE;
ec533521f091387e2911769818ae4be26219fca2fr else
ec533521f091387e2911769818ae4be26219fca2fr itx->itx_sync = B_FALSE;
ec533521f091387e2911769818ae4be26219fca2fr
6ce0521ac291be36119f359237066c4fb8088683perrin zp->z_last_itx = zil_itx_assign(zilog, itx, tx);
6ce0521ac291be36119f359237066c4fb8088683perrin
6ce0521ac291be36119f359237066c4fb8088683perrin off += len;
6ce0521ac291be36119f359237066c4fb8088683perrin resid -= len;
6ce0521ac291be36119f359237066c4fb8088683perrin }
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * zfs_log_truncate() handles TX_TRUNCATE transactions.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrinvoid
fa9e4066f08beec538e775443c5be79dd423fcabahrenszfs_log_truncate(zilog_t *zilog, dmu_tx_t *tx, int txtype,
fa9e4066f08beec538e775443c5be79dd423fcabahrens znode_t *zp, uint64_t off, uint64_t len)
fa9e4066f08beec538e775443c5be79dd423fcabahrens{
fa9e4066f08beec538e775443c5be79dd423fcabahrens itx_t *itx;
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr_truncate_t *lr;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
893a6d32980d24be1349478f44169009d4801c25ahrens if (zilog == NULL || zp->z_unlinked)
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrin return;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens itx = zil_itx_create(txtype, sizeof (*lr));
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr = (lr_truncate_t *)&itx->itx_lr;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_foid = zp->z_id;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_offset = off;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_length = len;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
67bd71c6cc629bab3aa0d595c624a667f1574254perrin itx->itx_sync = (zp->z_sync_cnt != 0);
fa9e4066f08beec538e775443c5be79dd423fcabahrens seq = zil_itx_assign(zilog, itx, tx);
fa9e4066f08beec538e775443c5be79dd423fcabahrens zp->z_last_itx = seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * zfs_log_setattr() handles TX_SETATTR transactions.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrinvoid
fa9e4066f08beec538e775443c5be79dd423fcabahrenszfs_log_setattr(zilog_t *zilog, dmu_tx_t *tx, int txtype,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw znode_t *zp, vattr_t *vap, uint_t mask_applied, zfs_fuid_info_t *fuidp)
fa9e4066f08beec538e775443c5be79dd423fcabahrens{
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw itx_t *itx;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint64_t seq;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr_setattr_t *lr;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw xvattr_t *xvap = (xvattr_t *)vap;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw size_t recsize = sizeof (lr_setattr_t);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw void *start;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
fa9e4066f08beec538e775443c5be79dd423fcabahrens
893a6d32980d24be1349478f44169009d4801c25ahrens if (zilog == NULL || zp->z_unlinked)
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrin return;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If XVATTR set, then log record size needs to allow
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * for lr_attr_t + xvattr mask, mapsize and create time
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * plus actual attribute values
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (vap->va_mask & AT_XVATTR)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw recsize = sizeof (*lr) + ZIL_XVAT_SIZE(xvap->xva_mapsize);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (fuidp)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw recsize += fuidp->z_domain_str_sz;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw itx = zil_itx_create(txtype, recsize);
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr = (lr_setattr_t *)&itx->itx_lr;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_foid = zp->z_id;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_mask = (uint64_t)mask_applied;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_mode = (uint64_t)vap->va_mode;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if ((mask_applied & AT_UID) && IS_EPHEMERAL(vap->va_uid))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr->lr_uid = fuidp->z_fuid_owner;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw else
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr->lr_uid = (uint64_t)vap->va_uid;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if ((mask_applied & AT_GID) && IS_EPHEMERAL(vap->va_gid))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr->lr_gid = fuidp->z_fuid_group;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw else
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr->lr_gid = (uint64_t)vap->va_gid;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_size = (uint64_t)vap->va_size;
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_TIME_ENCODE(&vap->va_atime, lr->lr_atime);
fa9e4066f08beec538e775443c5be79dd423fcabahrens ZFS_TIME_ENCODE(&vap->va_mtime, lr->lr_mtime);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw start = (lr_setattr_t *)(lr + 1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (vap->va_mask & AT_XVATTR) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw zfs_log_xvattr((lr_attr_t *)start, xvap);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw start = (caddr_t)start + ZIL_XVAT_SIZE(xvap->xva_mapsize);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Now stick on domain information if any on end
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (fuidp)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw (void) zfs_log_fuid_domains(fuidp, start);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
67bd71c6cc629bab3aa0d595c624a667f1574254perrin itx->itx_sync = (zp->z_sync_cnt != 0);
fa9e4066f08beec538e775443c5be79dd423fcabahrens seq = zil_itx_assign(zilog, itx, tx);
fa9e4066f08beec538e775443c5be79dd423fcabahrens zp->z_last_itx = seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * zfs_log_acl() handles TX_ACL transactions.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrinvoid
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwzfs_log_acl(zilog_t *zilog, dmu_tx_t *tx, znode_t *zp,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw vsecattr_t *vsecp, zfs_fuid_info_t *fuidp)
fa9e4066f08beec538e775443c5be79dd423fcabahrens{
fa9e4066f08beec538e775443c5be79dd423fcabahrens itx_t *itx;
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t seq;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr_acl_v0_t *lrv0;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr_acl_t *lr;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw int txtype;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw int lrsize;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw size_t txsize;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw size_t aclbytes = vsecp->vsa_aclentsz;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw txtype = (zp->z_zfsvfs->z_version == ZPL_VERSION_INITIAL) ?
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw TX_ACL_V0 : TX_ACL;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (txtype == TX_ACL)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lrsize = sizeof (*lr);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw else
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lrsize = sizeof (*lrv0);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
893a6d32980d24be1349478f44169009d4801c25ahrens if (zilog == NULL || zp->z_unlinked)
b19a79ec1a527828a60c4d325ccd8dcbeb2b2e8bperrin return;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
569e6c63191416b7413c148fd5a6194a0b820b2cmarks txsize = lrsize +
569e6c63191416b7413c148fd5a6194a0b820b2cmarks ((txtype == TX_ACL) ? ZIL_ACE_LENGTH(aclbytes) : aclbytes) +
569e6c63191416b7413c148fd5a6194a0b820b2cmarks (fuidp ? fuidp->z_domain_str_sz : 0) +
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw sizeof (uint64) * (fuidp ? fuidp->z_fuid_cnt : 0);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw itx = zil_itx_create(txtype, txsize);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr = (lr_acl_t *)&itx->itx_lr;
fa9e4066f08beec538e775443c5be79dd423fcabahrens lr->lr_foid = zp->z_id;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (txtype == TX_ACL) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr->lr_acl_bytes = aclbytes;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr->lr_domcnt = fuidp ? fuidp->z_domain_cnt : 0;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr->lr_fuidcnt = fuidp ? fuidp->z_fuid_cnt : 0;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (vsecp->vsa_mask & VSA_ACE_ACLFLAGS)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr->lr_acl_flags = (uint64_t)vsecp->vsa_aclflags;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw else
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr->lr_acl_flags = 0;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lr->lr_aclcnt = (uint64_t)vsecp->vsa_aclcnt;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (txtype == TX_ACL_V0) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw lrv0 = (lr_acl_v0_t *)lr;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw bcopy(vsecp->vsa_aclentp, (ace_t *)(lrv0 + 1), aclbytes);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw } else {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw void *start = (ace_t *)(lr + 1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw bcopy(vsecp->vsa_aclentp, start, aclbytes);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
569e6c63191416b7413c148fd5a6194a0b820b2cmarks start = (caddr_t)start + ZIL_ACE_LENGTH(aclbytes);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (fuidp) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw start = zfs_log_fuid_ids(fuidp, start);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw (void) zfs_log_fuid_domains(fuidp, start);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
fa9e4066f08beec538e775443c5be79dd423fcabahrens
67bd71c6cc629bab3aa0d595c624a667f1574254perrin itx->itx_sync = (zp->z_sync_cnt != 0);
fa9e4066f08beec538e775443c5be79dd423fcabahrens seq = zil_itx_assign(zilog, itx, tx);
fa9e4066f08beec538e775443c5be79dd423fcabahrens zp->z_last_itx = seq;
fa9e4066f08beec538e775443c5be79dd423fcabahrens}