diff options
author | Matthew Macy <[email protected]> | 2019-12-11 11:53:57 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-12-11 11:53:57 -0800 |
commit | 657ce253575295ef680eb33cf4ef698548212a46 (patch) | |
tree | 18d03f0887e857b1cbfdb9c1c8b4cac4e06985ed /module/zfs | |
parent | f0bf4351767ab95b1b5e9baa5445db20ffacd00d (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')
-rw-r--r-- | module/zfs/dsl_pool.c | 8 | ||||
-rw-r--r-- | module/zfs/zfs_log.c | 7 | ||||
-rw-r--r-- | module/zfs/zfs_replay.c | 82 |
3 files changed, 49 insertions, 48 deletions
diff --git a/module/zfs/dsl_pool.c b/module/zfs/dsl_pool.c index 4083abb7e..fa2c7d695 100644 --- a/module/zfs/dsl_pool.c +++ b/module/zfs/dsl_pool.c @@ -220,7 +220,7 @@ dsl_pool_open_impl(spa_t *spa, uint64_t txg) mutex_init(&dp->dp_lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&dp->dp_spaceavail_cv, NULL, CV_DEFAULT, NULL); - dp->dp_iput_taskq = taskq_create("z_iput", max_ncpus, defclsyspri, + dp->dp_zrele_taskq = taskq_create("z_zrele", max_ncpus, defclsyspri, max_ncpus * 8, INT_MAX, TASKQ_PREPOPULATE | TASKQ_DYNAMIC); dp->dp_unlinked_drain_taskq = taskq_create("z_unlinked_drain", max_ncpus, defclsyspri, max_ncpus, INT_MAX, @@ -416,7 +416,7 @@ dsl_pool_close(dsl_pool_t *dp) mutex_destroy(&dp->dp_lock); cv_destroy(&dp->dp_spaceavail_cv); taskq_destroy(dp->dp_unlinked_drain_taskq); - taskq_destroy(dp->dp_iput_taskq); + taskq_destroy(dp->dp_zrele_taskq); if (dp->dp_blkstats != NULL) { mutex_destroy(&dp->dp_blkstats->zab_lock); vmem_free(dp->dp_blkstats, sizeof (zfs_all_blkstats_t)); @@ -1102,9 +1102,9 @@ dsl_pool_create_origin(dsl_pool_t *dp, dmu_tx_t *tx) } taskq_t * -dsl_pool_iput_taskq(dsl_pool_t *dp) +dsl_pool_zrele_taskq(dsl_pool_t *dp) { - return (dp->dp_iput_taskq); + return (dp->dp_zrele_taskq); } taskq_t * diff --git a/module/zfs/zfs_log.c b/module/zfs/zfs_log.c index 9cf55c29b..21296c76e 100644 --- a/module/zfs/zfs_log.c +++ b/module/zfs/zfs_log.c @@ -231,7 +231,8 @@ zfs_xattr_owner_unlinked(znode_t *zp) { int unlinked = 0; znode_t *dzp; - igrab(ZTOI(zp)); + + zhold(zp); /* * if zp is XATTR node, keep walking up via z_xattr_parent until we * get the owner @@ -242,11 +243,11 @@ zfs_xattr_owner_unlinked(znode_t *zp) unlinked = 1; break; } - iput(ZTOI(zp)); + zrele(zp); zp = dzp; unlinked = zp->z_unlinked; } - iput(ZTOI(zp)); + zrele(zp); return (unlinked); } 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); } |