aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_replay.c
diff options
context:
space:
mode:
authorMatthew Macy <[email protected]>2019-12-11 11:53:57 -0800
committerBrian Behlendorf <[email protected]>2019-12-11 11:53:57 -0800
commit657ce253575295ef680eb33cf4ef698548212a46 (patch)
tree18d03f0887e857b1cbfdb9c1c8b4cac4e06985ed /module/zfs/zfs_replay.c
parentf0bf4351767ab95b1b5e9baa5445db20ffacd00d (diff)
Eliminate Linux specific inode usage from common code
Change many of the znops routines to take a znode rather than an inode so that zfs_replay code can be largely shared and in the future the much of the znops code may be shared. Reviewed-by: Jorgen Lundman <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Matt Macy <[email protected]> Closes #9708
Diffstat (limited to 'module/zfs/zfs_replay.c')
-rw-r--r--module/zfs/zfs_replay.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/module/zfs/zfs_replay.c b/module/zfs/zfs_replay.c
index 59b3f3af1..b94c946dd 100644
--- a/module/zfs/zfs_replay.c
+++ b/module/zfs/zfs_replay.c
@@ -280,7 +280,7 @@ zfs_replay_create_acl(void *arg1, void *arg2, boolean_t byteswap)
char *name = NULL; /* location determined later */
lr_create_t *lr = (lr_create_t *)lracl;
znode_t *dzp;
- struct inode *ip = NULL;
+ znode_t *zp;
xvattr_t xva;
int vflg = 0;
vsecattr_t vsec = { 0 };
@@ -371,8 +371,8 @@ zfs_replay_create_acl(void *arg1, void *arg2, boolean_t byteswap)
lr->lr_uid, lr->lr_gid);
}
- error = zfs_create(ZTOI(dzp), name, &xva.xva_vattr,
- 0, 0, &ip, kcred, vflg, &vsec);
+ error = zfs_create(dzp, name, &xva.xva_vattr,
+ 0, 0, &zp, kcred, vflg, &vsec);
break;
case TX_MKDIR_ACL:
aclstart = (caddr_t)(lracl + 1);
@@ -401,18 +401,18 @@ zfs_replay_create_acl(void *arg1, void *arg2, boolean_t byteswap)
(void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
lr->lr_uid, lr->lr_gid);
}
- error = zfs_mkdir(ZTOI(dzp), name, &xva.xva_vattr,
- &ip, kcred, vflg, &vsec);
+ error = zfs_mkdir(dzp, name, &xva.xva_vattr,
+ &zp, kcred, vflg, &vsec);
break;
default:
error = SET_ERROR(ENOTSUP);
}
bail:
- if (error == 0 && ip != NULL)
- iput(ip);
+ if (error == 0 && zp != NULL)
+ zrele(zp);
- iput(ZTOI(dzp));
+ zrele(dzp);
if (zfsvfs->z_fuid_replay)
zfs_fuid_info_free(zfsvfs->z_fuid_replay);
@@ -429,7 +429,7 @@ zfs_replay_create(void *arg1, void *arg2, boolean_t byteswap)
char *name = NULL; /* location determined later */
char *link; /* symlink content follows name */
znode_t *dzp;
- struct inode *ip = NULL;
+ znode_t *zp = NULL;
xvattr_t xva;
int vflg = 0;
size_t lrsize = sizeof (lr_create_t);
@@ -509,8 +509,8 @@ zfs_replay_create(void *arg1, void *arg2, boolean_t byteswap)
if (name == NULL)
name = (char *)start;
- error = zfs_create(ZTOI(dzp), name, &xva.xva_vattr,
- 0, 0, &ip, kcred, vflg, NULL);
+ error = zfs_create(dzp, name, &xva.xva_vattr,
+ 0, 0, &zp, kcred, vflg, NULL);
break;
case TX_MKDIR_ATTR:
lrattr = (lr_attr_t *)(caddr_t)(lr + 1);
@@ -527,27 +527,27 @@ zfs_replay_create(void *arg1, void *arg2, boolean_t byteswap)
if (name == NULL)
name = (char *)(lr + 1);
- error = zfs_mkdir(ZTOI(dzp), name, &xva.xva_vattr,
- &ip, kcred, vflg, NULL);
+ error = zfs_mkdir(dzp, name, &xva.xva_vattr,
+ &zp, kcred, vflg, NULL);
break;
case TX_MKXATTR:
- error = zfs_make_xattrdir(dzp, &xva.xva_vattr, &ip, kcred);
+ error = zfs_make_xattrdir(dzp, &xva.xva_vattr, &zp, kcred);
break;
case TX_SYMLINK:
name = (char *)(lr + 1);
link = name + strlen(name) + 1;
- error = zfs_symlink(ZTOI(dzp), name, &xva.xva_vattr,
- link, &ip, kcred, vflg);
+ error = zfs_symlink(dzp, name, &xva.xva_vattr,
+ link, &zp, kcred, vflg);
break;
default:
error = SET_ERROR(ENOTSUP);
}
out:
- if (error == 0 && ip != NULL)
- iput(ip);
+ if (error == 0 && zp != NULL)
+ zrele(zp);
- iput(ZTOI(dzp));
+ zrele(dzp);
if (zfsvfs->z_fuid_replay)
zfs_fuid_info_free(zfsvfs->z_fuid_replay);
@@ -576,16 +576,16 @@ zfs_replay_remove(void *arg1, void *arg2, boolean_t byteswap)
switch ((int)lr->lr_common.lrc_txtype) {
case TX_REMOVE:
- error = zfs_remove(ZTOI(dzp), name, kcred, vflg);
+ error = zfs_remove(dzp, name, kcred, vflg);
break;
case TX_RMDIR:
- error = zfs_rmdir(ZTOI(dzp), name, NULL, kcred, vflg);
+ error = zfs_rmdir(dzp, name, NULL, kcred, vflg);
break;
default:
error = SET_ERROR(ENOTSUP);
}
- iput(ZTOI(dzp));
+ zrele(dzp);
return (error);
}
@@ -607,17 +607,17 @@ zfs_replay_link(void *arg1, void *arg2, boolean_t byteswap)
return (error);
if ((error = zfs_zget(zfsvfs, lr->lr_link_obj, &zp)) != 0) {
- iput(ZTOI(dzp));
+ zrele(dzp);
return (error);
}
if (lr->lr_common.lrc_txtype & TX_CI)
vflg |= FIGNORECASE;
- error = zfs_link(ZTOI(dzp), ZTOI(zp), name, kcred, vflg);
+ error = zfs_link(dzp, zp, name, kcred, vflg);
- iput(ZTOI(zp));
- iput(ZTOI(dzp));
+ zrele(zp);
+ zrele(dzp);
return (error);
}
@@ -640,17 +640,17 @@ zfs_replay_rename(void *arg1, void *arg2, boolean_t byteswap)
return (error);
if ((error = zfs_zget(zfsvfs, lr->lr_tdoid, &tdzp)) != 0) {
- iput(ZTOI(sdzp));
+ zrele(sdzp);
return (error);
}
if (lr->lr_common.lrc_txtype & TX_CI)
vflg |= FIGNORECASE;
- error = zfs_rename(ZTOI(sdzp), sname, ZTOI(tdzp), tname, kcred, vflg);
+ error = zfs_rename(sdzp, sname, tdzp, tname, kcred, vflg);
- iput(ZTOI(tdzp));
- iput(ZTOI(sdzp));
+ zrele(tdzp);
+ zrele(sdzp);
return (error);
}
@@ -714,7 +714,7 @@ zfs_replay_write(void *arg1, void *arg2, boolean_t byteswap)
else if (written < length)
error = SET_ERROR(EIO); /* short write */
- iput(ZTOI(zp));
+ zrele(zp);
zfsvfs->z_replay_eof = 0; /* safety */
return (error);
@@ -750,7 +750,7 @@ top:
dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE);
error = dmu_tx_assign(tx, TXG_WAIT);
if (error) {
- iput(ZTOI(zp));
+ zrele(zp);
if (error == ERESTART) {
dmu_tx_wait(tx);
dmu_tx_abort(tx);
@@ -768,7 +768,7 @@ top:
dmu_tx_commit(tx);
}
- iput(ZTOI(zp));
+ zrele(zp);
return (error);
}
@@ -794,10 +794,10 @@ zfs_replay_truncate(void *arg1, void *arg2, boolean_t byteswap)
fl.l_start = lr->lr_offset;
fl.l_len = lr->lr_length;
- error = zfs_space(ZTOI(zp), F_FREESP, &fl, O_RDWR | O_LARGEFILE,
+ error = zfs_space(zp, F_FREESP, &fl, O_RDWR | O_LARGEFILE,
lr->lr_offset, kcred);
- iput(ZTOI(zp));
+ zrele(zp);
return (error);
}
@@ -849,11 +849,11 @@ zfs_replay_setattr(void *arg1, void *arg2, boolean_t byteswap)
zfsvfs->z_fuid_replay = zfs_replay_fuid_domain(start, &start,
lr->lr_uid, lr->lr_gid);
- error = zfs_setattr(ZTOI(zp), vap, 0, kcred);
+ error = zfs_setattr(zp, vap, 0, kcred);
zfs_fuid_info_free(zfsvfs->z_fuid_replay);
zfsvfs->z_fuid_replay = NULL;
- iput(ZTOI(zp));
+ zrele(zp);
return (error);
}
@@ -883,9 +883,9 @@ zfs_replay_acl_v0(void *arg1, void *arg2, boolean_t byteswap)
vsa.vsa_aclflags = 0;
vsa.vsa_aclentp = ace;
- error = zfs_setsecattr(ZTOI(zp), &vsa, 0, kcred);
+ error = zfs_setsecattr(zp, &vsa, 0, kcred);
- iput(ZTOI(zp));
+ zrele(zp);
return (error);
}
@@ -943,13 +943,13 @@ zfs_replay_acl(void *arg1, void *arg2, boolean_t byteswap)
lr->lr_fuidcnt, lr->lr_domcnt, 0, 0);
}
- error = zfs_setsecattr(ZTOI(zp), &vsa, 0, kcred);
+ error = zfs_setsecattr(zp, &vsa, 0, kcred);
if (zfsvfs->z_fuid_replay)
zfs_fuid_info_free(zfsvfs->z_fuid_replay);
zfsvfs->z_fuid_replay = NULL;
- iput(ZTOI(zp));
+ zrele(zp);
return (error);
}