/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2015 by Delphix. All rights reserved.
* Copyright (c) 2014 Integros [integros.com]
*/
#include <sys/sysmacros.h>
#include <sys/zfs_znode.h>
#include <sys/zil_impl.h>
#include <sys/byteorder.h>
#include <sys/zfs_fuid.h>
#include <sys/dsl_dataset.h>
/*
* 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.
*/
int
{
switch (type) {
case Z_FILE:
return (TX_CREATE);
return (TX_CREATE_ACL_ATTR);
if (vsecp)
return (TX_CREATE_ACL);
else
return (TX_CREATE_ATTR);
/*NOTREACHED*/
case Z_DIR:
return (TX_MKDIR);
return (TX_MKDIR_ACL_ATTR);
if (vsecp)
return (TX_MKDIR_ACL);
else
return (TX_MKDIR_ATTR);
case Z_XATTRDIR:
return (TX_MKXATTR);
}
ASSERT(0);
return (TX_MAX_TYPE);
}
/*
* 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.
*/
static void
{
void *scanstamp;
int i;
}
/* Now pack the attributes up in a single uint64_t */
*attrs = 0;
}
static void *
{
/* First copy in the ACE FUIDs */
}
return (fuidloc);
}
static void *
{
/* now copy in the domain info, if any */
if (fuidp->z_domain_str_sz != 0) {
}
}
return (start);
}
/*
* Handles TX_CREATE, TX_CREATE_ATTR, TX_MKDIR, TX_MKDIR_ATTR and
* TK_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
*
* 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
*
* There may be an optional xvattr attribute information similar
* to zfs_log_setattr.
*
* Also, after the file name "domain" strings may be appended.
*/
void
{
void *end;
return;
/*
* If we have FUIDs present then add in space for
* domains and ACE fuid's if any.
*/
if (fuidp) {
}
(int)txtype == TX_MKXATTR) {
} else {
txsize =
lrsize = sizeof (lr_acl_create_t);
}
} else {
}
} else {
}
sizeof (uint64_t));
/*
* Fill in xvattr info if any
*/
} else {
}
/* Now fill in any ACL info */
if (vsecp) {
else
lracl->lr_acl_flags = 0;
}
/* drop in FUID info */
if (fuidp) {
}
/*
* Now place file name in log record
*/
}
/*
* Handles both TX_REMOVE and TX_RMDIR transactions.
*/
void
{
return;
}
/*
* Handles TX_LINK transactions.
*/
void
{
return;
}
/*
* Handles TX_SYMLINK transactions.
*/
void
{
return;
sizeof (uint64_t));
}
/*
* Handles TX_RENAME transactions.
*/
void
{
return;
}
/*
* Handles TX_WRITE transactions.
*/
void
{
return;
? 0 : zfs_immediate_write_sz;
else
}
while (resid) {
/*
* If the write would overflow the largest block then split it.
*/
else
}
if (write_state == WR_NEED_COPY)
(fsync_cnt == 0))
}
}
/*
* Handles TX_TRUNCATE transactions.
*/
void
{
return;
}
/*
* Handles TX_SETATTR transactions.
*/
void
{
void *start;
return;
/*
* If XVATTR set, then log record size needs to allow
* for lr_attr_t + xvattr mask, mapsize and create time
* plus actual attribute values
*/
if (fuidp)
else
else
}
/*
* Now stick on domain information if any on end
*/
if (fuidp)
}
/*
* Handles TX_ACL transactions.
*/
void
{
int txtype;
int lrsize;
return;
else
else
lr->lr_acl_flags = 0;
}
} else {
if (fuidp) {
}
}
}