cache: add cache_vop_mkdir and rename cache_rename to cache_vop_rename
This commit is contained in:
parent
0f352f4e25
commit
4bfebc8d2c
@ -2273,6 +2273,16 @@ zfs_mkdir(znode_t *dzp, const char *dirname, vattr_t *vap, znode_t **zpp,
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if __FreeBSD_version < 1300124
|
||||
static void
|
||||
cache_vop_rmdir(struct vnode *dvp, struct vnode *vp)
|
||||
{
|
||||
|
||||
cache_purge(dvp);
|
||||
cache_purge(vp);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Remove a directory subdir entry. If the current working
|
||||
* directory is the same as the subdir to be removed, the
|
||||
@ -2342,7 +2352,7 @@ zfs_rmdir_(vnode_t *dvp, vnode_t *vp, const char *name, cred_t *cr)
|
||||
|
||||
dmu_tx_commit(tx);
|
||||
|
||||
cache_purge(vp);
|
||||
cache_vop_rmdir(dvp, vp);
|
||||
out:
|
||||
if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
|
||||
zil_commit(zilog, 0);
|
||||
@ -3901,7 +3911,7 @@ zfs_rename_check(znode_t *szp, znode_t *sdzp, znode_t *tdzp)
|
||||
|
||||
#if __FreeBSD_version < 1300110
|
||||
static void
|
||||
cache_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp,
|
||||
cache_vop_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp,
|
||||
struct vnode *tvp, struct componentname *fcnp, struct componentname *tcnp)
|
||||
{
|
||||
|
||||
@ -4170,7 +4180,7 @@ zfs_rename_(vnode_t *sdvp, vnode_t **svpp, struct componentname *scnp,
|
||||
}
|
||||
}
|
||||
if (error == 0) {
|
||||
cache_rename(sdvp, *svpp, tdvp, *tvpp, scnp, tcnp);
|
||||
cache_vop_rename(sdvp, *svpp, tdvp, *tvpp, scnp, tcnp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1210,7 +1210,7 @@ tmpfs_rename(struct vop_rename_args *v)
|
||||
tmpfs_dir_attach(tdvp, de);
|
||||
|
||||
if (tmpfs_use_nc(fvp)) {
|
||||
cache_rename(fdvp, fvp, tdvp, tvp, fcnp, tcnp);
|
||||
cache_vop_rename(fdvp, fvp, tdvp, tvp, fcnp, tcnp);
|
||||
}
|
||||
|
||||
error = 0;
|
||||
@ -1331,7 +1331,7 @@ tmpfs_rmdir(struct vop_rmdir_args *v)
|
||||
TMPFS_NODE_UNLOCK(dnode);
|
||||
|
||||
if (tmpfs_use_nc(dvp)) {
|
||||
cache_purge(vp);
|
||||
cache_vop_rmdir(dvp, vp);
|
||||
}
|
||||
|
||||
/* Free the directory entry we just deleted. Note that the node
|
||||
|
@ -2659,8 +2659,11 @@ cache_purge_negative(struct vnode *vp)
|
||||
cache_free_batch(&batch);
|
||||
}
|
||||
|
||||
/*
|
||||
* Entry points for modifying VOP operations.
|
||||
*/
|
||||
void
|
||||
cache_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp,
|
||||
cache_vop_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp,
|
||||
struct vnode *tvp, struct componentname *fcnp, struct componentname *tcnp)
|
||||
{
|
||||
|
||||
@ -2680,6 +2683,15 @@ cache_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cache_vop_rmdir(struct vnode *dvp, struct vnode *vp)
|
||||
{
|
||||
|
||||
ASSERT_VOP_IN_SEQC(dvp);
|
||||
ASSERT_VOP_IN_SEQC(vp);
|
||||
cache_purge(vp);
|
||||
}
|
||||
|
||||
#ifdef INVARIANTS
|
||||
/*
|
||||
* Validate that if an entry exists it matches.
|
||||
|
@ -60,7 +60,7 @@
|
||||
* in the range 5 to 9.
|
||||
*/
|
||||
#undef __FreeBSD_version
|
||||
#define __FreeBSD_version 1300123 /* Master, propagated to newvers */
|
||||
#define __FreeBSD_version 1300124 /* Master, propagated to newvers */
|
||||
|
||||
/*
|
||||
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
|
||||
|
@ -641,9 +641,10 @@ void cache_vnode_init(struct vnode *vp);
|
||||
void cache_purge(struct vnode *vp);
|
||||
void cache_purge_vgone(struct vnode *vp);
|
||||
void cache_purge_negative(struct vnode *vp);
|
||||
void cache_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp,
|
||||
struct vnode *tvp, struct componentname *fcnp, struct componentname *tcnp);
|
||||
void cache_purgevfs(struct mount *mp);
|
||||
void cache_vop_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp,
|
||||
struct vnode *tvp, struct componentname *fcnp, struct componentname *tcnp);
|
||||
void cache_vop_rmdir(struct vnode *dvp, struct vnode *vp);
|
||||
#ifdef INVARIANTS
|
||||
void cache_validate(struct vnode *dvp, struct vnode *vp,
|
||||
struct componentname *cnp);
|
||||
|
@ -1629,7 +1629,7 @@ ufs_rename(ap)
|
||||
* name that references the old i-node if it has other links
|
||||
* or open file descriptors.
|
||||
*/
|
||||
cache_rename(fdvp, fvp, tdvp, tvp, fcnp, tcnp);
|
||||
cache_vop_rename(fdvp, fvp, tdvp, tvp, fcnp, tcnp);
|
||||
|
||||
unlockout:
|
||||
if (want_seqc_end) {
|
||||
@ -2220,7 +2220,7 @@ ufs_rmdir(ap)
|
||||
DIP_SET(ip, i_nlink, ip->i_nlink);
|
||||
UFS_INODE_SET_FLAG(ip, IN_CHANGE);
|
||||
}
|
||||
cache_purge(vp);
|
||||
cache_vop_rmdir(dvp, vp);
|
||||
#ifdef UFS_DIRHASH
|
||||
/* Kill any active hash; i_effnlink == 0, so it will not come back. */
|
||||
if (ip->i_dirhash != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user