summaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_log.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2011-02-08 11:33:08 -0800
committerBrian Behlendorf <[email protected]>2011-02-10 09:27:21 -0800
commit633e8030b3582f3579a457a803c1382fc81f56e5 (patch)
tree2e9a2b7aa2d5540a1692f3a53feace2566ee7799 /module/zfs/zfs_log.c
parent3c4988c83e4f278cd6c8076f6cdb8e4858d05840 (diff)
Wrap with HAVE_XVATTR
For the moment exactly how to handle xvattr is not clear. This change largely consists of the code to comment out the offending bits until something reasonable can be done.
Diffstat (limited to 'module/zfs/zfs_log.c')
-rw-r--r--module/zfs/zfs_log.c52
1 files changed, 36 insertions, 16 deletions
diff --git a/module/zfs/zfs_log.c b/module/zfs/zfs_log.c
index 945b734ce..5cdbb6c8d 100644
--- a/module/zfs/zfs_log.c
+++ b/module/zfs/zfs_log.c
@@ -69,7 +69,11 @@
int
zfs_log_create_txtype(zil_create_t type, vsecattr_t *vsecp, vattr_t *vap)
{
+#ifdef HAVE_XVATTR
int isxvattr = (vap->va_mask & AT_XVATTR);
+#else
+ int isxvattr = 0;
+#endif /* HAVE_XVATTR */
switch (type) {
case Z_FILE:
if (vsecp == NULL && !isxvattr)
@@ -97,6 +101,7 @@ zfs_log_create_txtype(zil_create_t type, vsecattr_t *vsecp, vattr_t *vap)
return (TX_MAX_TYPE);
}
+#ifdef HAVE_XVATTR
/*
* build up the log data necessary for logging xvattr_t
* First lr_attr_t is initialized. following the lr_attr_t
@@ -210,6 +215,7 @@ zfs_log_fuid_domains(zfs_fuid_info_t *fuidp, void *start)
}
return (start);
}
+#endif /* HAVE_XVATTR */
/*
* zfs_log_create() is used to handle TX_CREATE, TX_CREATE_ATTR, TX_MKDIR,
@@ -238,11 +244,13 @@ zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
{
itx_t *itx;
lr_create_t *lr;
+#ifdef HAVE_XVATTR
lr_acl_create_t *lracl;
+ xvattr_t *xvap = (xvattr_t *)vap;
+#endif /* HAVE_XVATTR */
size_t aclsize;
size_t xvatsize = 0;
size_t txsize;
- xvattr_t *xvap = (xvattr_t *)vap;
void *end;
size_t lrsize;
size_t namesize = strlen(name) + 1;
@@ -260,8 +268,10 @@ zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
fuidsz += fuidp->z_fuid_cnt * sizeof (uint64_t);
}
+#ifdef HAVE_XVATTR
if (vap->va_mask & AT_XVATTR)
xvatsize = ZIL_XVAT_SIZE(xvap->xva_mapsize);
+#endif /* HAVE_XVATTR */
if ((int)txtype == TX_CREATE_ATTR || (int)txtype == TX_MKDIR_ATTR ||
(int)txtype == TX_CREATE || (int)txtype == TX_MKDIR ||
@@ -292,18 +302,19 @@ zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
} else {
lr->lr_gid = fuidp->z_fuid_group;
}
- (void) sa_lookup(zp->z_sa_hdl, SA_ZPL_GEN(zp->z_zfsvfs), &lr->lr_gen,
+ (void) sa_lookup(zp->z_sa_hdl, SA_ZPL_GEN(ZTOZSB(zp)), &lr->lr_gen,
sizeof (uint64_t));
- (void) sa_lookup(zp->z_sa_hdl, SA_ZPL_CRTIME(zp->z_zfsvfs),
+ (void) sa_lookup(zp->z_sa_hdl, SA_ZPL_CRTIME(ZTOZSB(zp)),
lr->lr_crtime, sizeof (uint64_t) * 2);
- if (sa_lookup(zp->z_sa_hdl, SA_ZPL_RDEV(zp->z_zfsvfs), &lr->lr_rdev,
+ if (sa_lookup(zp->z_sa_hdl, SA_ZPL_RDEV(ZTOZSB(zp)), &lr->lr_rdev,
sizeof (lr->lr_rdev)) != 0)
lr->lr_rdev = 0;
/*
* Fill in xvattr info if any
*/
+#ifdef HAVE_XVATTR
if (vap->va_mask & AT_XVATTR) {
zfs_log_xvattr((lr_attr_t *)((caddr_t)lr + lrsize), xvap);
end = (caddr_t)lr + lrsize + xvatsize;
@@ -333,6 +344,9 @@ zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
end = zfs_log_fuid_ids(fuidp, end);
end = zfs_log_fuid_domains(fuidp, end);
}
+#else
+ end = (caddr_t)lr + lrsize;
+#endif /* HAVE_XVATTR */
/*
* Now place file name in log record
*/
@@ -552,12 +566,14 @@ zfs_log_truncate(zilog_t *zilog, dmu_tx_t *tx, int txtype,
* zfs_log_setattr() handles TX_SETATTR 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)
+zfs_log_setattr(zilog_t *zilog, dmu_tx_t *tx, int txtype, znode_t *zp,
+ struct iattr *attr, uint_t mask_applied, zfs_fuid_info_t *fuidp)
{
itx_t *itx;
lr_setattr_t *lr;
+#ifdef HAVE_XVATTR
xvattr_t *xvap = (xvattr_t *)vap;
+#endif /* HAVEXVATTR */
size_t recsize = sizeof (lr_setattr_t);
void *start;
@@ -569,32 +585,35 @@ zfs_log_setattr(zilog_t *zilog, dmu_tx_t *tx, int txtype,
* for lr_attr_t + xvattr mask, mapsize and create time
* plus actual attribute values
*/
- if (vap->va_mask & AT_XVATTR)
+#ifdef HAVE_XVATTR
+ if (attr->ia_valid & AT_XVATTR)
recsize = sizeof (*lr) + ZIL_XVAT_SIZE(xvap->xva_mapsize);
if (fuidp)
recsize += fuidp->z_domain_str_sz;
+#endif /* HAVE_XVATTR */
itx = zil_itx_create(txtype, recsize);
lr = (lr_setattr_t *)&itx->itx_lr;
lr->lr_foid = zp->z_id;
lr->lr_mask = (uint64_t)mask_applied;
- lr->lr_mode = (uint64_t)vap->va_mode;
- if ((mask_applied & AT_UID) && IS_EPHEMERAL(vap->va_uid))
+ lr->lr_mode = (uint64_t)attr->ia_mode;
+ if ((mask_applied & ATTR_UID) && IS_EPHEMERAL(attr->ia_uid))
lr->lr_uid = fuidp->z_fuid_owner;
else
- lr->lr_uid = (uint64_t)vap->va_uid;
+ lr->lr_uid = (uint64_t)attr->ia_uid;
- if ((mask_applied & AT_GID) && IS_EPHEMERAL(vap->va_gid))
+ if ((mask_applied & ATTR_GID) && IS_EPHEMERAL(attr->ia_gid))
lr->lr_gid = fuidp->z_fuid_group;
else
- lr->lr_gid = (uint64_t)vap->va_gid;
+ lr->lr_gid = (uint64_t)attr->ia_gid;
- lr->lr_size = (uint64_t)vap->va_size;
- ZFS_TIME_ENCODE(&vap->va_atime, lr->lr_atime);
- ZFS_TIME_ENCODE(&vap->va_mtime, lr->lr_mtime);
+ lr->lr_size = (uint64_t)attr->ia_size;
+ ZFS_TIME_ENCODE(&attr->ia_atime, lr->lr_atime);
+ ZFS_TIME_ENCODE(&attr->ia_mtime, lr->lr_mtime);
start = (lr_setattr_t *)(lr + 1);
- if (vap->va_mask & AT_XVATTR) {
+#ifdef HAVE_XVATTR
+ if (attr->ia_valid & ATTR_XVATTR) {
zfs_log_xvattr((lr_attr_t *)start, xvap);
start = (caddr_t)start + ZIL_XVAT_SIZE(xvap->xva_mapsize);
}
@@ -605,6 +624,7 @@ zfs_log_setattr(zilog_t *zilog, dmu_tx_t *tx, int txtype,
if (fuidp)
(void) zfs_log_fuid_domains(fuidp, start);
+#endif /* HAVE_XVATTR */
itx->itx_sync = (zp->z_sync_cnt != 0);
zil_itx_assign(zilog, itx, tx);