summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormjg <mjg@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>2020-10-30 10:46:35 +0000
committermjg <mjg@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>2020-10-30 10:46:35 +0000
commitd2eb37e118ed4e2e6305c82f2bf72cf3d9ece353 (patch)
tree20cd898d05ba7642997cab0deb880fab7bd25b96
parent4af46bdc7420aaba4bb7da53f6d91ddbfcecf0c4 (diff)
downloadfreebsd-d2eb37e118ed4e2e6305c82f2bf72cf3d9ece353.tar.gz
freebsd-d2eb37e118ed4e2e6305c82f2bf72cf3d9ece353.tar.bz2
cache: add cache_vop_mkdir and rename cache_rename to cache_vop_rename
git-svn-id: http://svn.freebsd.org/base/head@367162 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c16
-rw-r--r--sys/fs/tmpfs/tmpfs_vnops.c4
-rw-r--r--sys/kern/vfs_cache.c14
-rw-r--r--sys/sys/param.h2
-rw-r--r--sys/sys/vnode.h5
-rw-r--r--sys/ufs/ufs/ufs_vnops.c4
6 files changed, 34 insertions, 11 deletions
diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c
index 5496cb8b448..c7e1fbca28d 100644
--- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c
+++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c
@@ -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);
}
}
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c
index 5c71265e386..9c0eba42d31 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -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
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 2fd6226d2f9..170805b64d6 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -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.
diff --git a/sys/sys/param.h b/sys/sys/param.h
index b3bfe01a6bd..5d83a01a33a 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -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,
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 66ee5d0fb14..735968cbafa 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -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);
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index ad42f8c8082..3034cbd2407 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -1629,7 +1629,7 @@ relock:
* 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)