cache: add cache_rename, a dedicated helper to use for renames
While here make both tmpfs and ufs use it. No fuctional changes.
This commit is contained in:
parent
16be9f9956
commit
39f8815070
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364419
@ -1144,10 +1144,7 @@ tmpfs_rename(struct vop_rename_args *v)
|
||||
tmpfs_dir_attach(tdvp, de);
|
||||
|
||||
if (tmpfs_use_nc(fvp)) {
|
||||
cache_purge(fvp);
|
||||
if (tvp != NULL)
|
||||
cache_purge(tvp);
|
||||
cache_purge_negative(tdvp);
|
||||
cache_rename(fdvp, fvp, tdvp, tvp, fcnp, tcnp);
|
||||
}
|
||||
|
||||
error = 0;
|
||||
|
@ -2339,6 +2339,23 @@ 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)
|
||||
{
|
||||
|
||||
ASSERT_VOP_IN_SEQC(fdvp);
|
||||
ASSERT_VOP_IN_SEQC(fvp);
|
||||
ASSERT_VOP_IN_SEQC(tdvp);
|
||||
if (tvp != NULL)
|
||||
ASSERT_VOP_IN_SEQC(tvp);
|
||||
|
||||
cache_purge(fvp);
|
||||
if (tvp != NULL)
|
||||
cache_purge(tvp);
|
||||
cache_purge_negative(tdvp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Flush all entries referencing a particular filesystem.
|
||||
*/
|
||||
|
@ -642,6 +642,8 @@ 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, bool force);
|
||||
int change_dir(struct vnode *vp, struct thread *td);
|
||||
void cvtstat(struct stat *st, struct ostat *ost);
|
||||
|
@ -1629,10 +1629,7 @@ ufs_rename(ap)
|
||||
* name that references the old i-node if it has other links
|
||||
* or open file descriptors.
|
||||
*/
|
||||
cache_purge(fvp);
|
||||
if (tvp)
|
||||
cache_purge(tvp);
|
||||
cache_purge_negative(tdvp);
|
||||
cache_rename(fdvp, fvp, tdvp, tvp, fcnp, tcnp);
|
||||
|
||||
unlockout:
|
||||
if (want_seqc_end) {
|
||||
|
Loading…
Reference in New Issue
Block a user