cache: drop the force flag from purgevfs
The optional scan is wasteful, thus it is removed altogether from unmount. Callers which always want it anyway remain unaffected.
This commit is contained in:
parent
a952fefff2
commit
a3d9bf49b5
@ -1532,7 +1532,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
|
||||
* 'z_parent' is self referential for non-snapshots.
|
||||
*/
|
||||
#ifdef FREEBSD_NAMECACHE
|
||||
cache_purgevfs(zfsvfs->z_parent->z_vfs, true);
|
||||
cache_purgevfs(zfsvfs->z_parent->z_vfs);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -295,9 +295,6 @@ static u_long __exclusive_cache_line numcache;/* number of cache entries allocat
|
||||
u_int ncsizefactor = 2;
|
||||
SYSCTL_UINT(_vfs, OID_AUTO, ncsizefactor, CTLFLAG_RW, &ncsizefactor, 0,
|
||||
"Size factor for namecache");
|
||||
static u_int __read_mostly ncpurgeminvnodes;
|
||||
SYSCTL_UINT(_vfs, OID_AUTO, ncpurgeminvnodes, CTLFLAG_RW, &ncpurgeminvnodes, 0,
|
||||
"Number of vnodes below which purgevfs ignores the request");
|
||||
static u_int __read_mostly ncsize; /* the size as computed on creation or resizing */
|
||||
|
||||
struct nchstats nchstats; /* cache effectiveness statistics */
|
||||
@ -2142,7 +2139,6 @@ nchinit(void *dummy __unused)
|
||||
M_WAITOK | M_ZERO);
|
||||
for (i = 0; i < numvnodelocks; i++)
|
||||
mtx_init(&vnodelocks[i], "ncvn", NULL, MTX_DUPOK | MTX_RECURSE);
|
||||
ncpurgeminvnodes = numbucketlocks * 2;
|
||||
|
||||
neglists = malloc(sizeof(*neglists) * numneglists, M_VFSCACHE,
|
||||
M_WAITOK | M_ZERO);
|
||||
@ -2369,14 +2365,11 @@ cache_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp,
|
||||
* Flush all entries referencing a particular filesystem.
|
||||
*/
|
||||
void
|
||||
cache_purgevfs(struct mount *mp, bool force)
|
||||
cache_purgevfs(struct mount *mp)
|
||||
{
|
||||
struct vnode *vp, *mvp;
|
||||
|
||||
SDT_PROBE1(vfs, namecache, purgevfs, done, mp);
|
||||
if (!force && mp->mnt_nvnodelistsize <= ncpurgeminvnodes)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Somewhat wasteful iteration over all vnodes. Would be better to
|
||||
* support filtering and avoid the interlock to begin with.
|
||||
|
@ -1808,7 +1808,6 @@ dounmount(struct mount *mp, int flags, struct thread *td)
|
||||
mp->mnt_flag &= ~MNT_ASYNC;
|
||||
mp->mnt_kern_flag &= ~MNTK_ASYNC;
|
||||
MNT_IUNLOCK(mp);
|
||||
cache_purgevfs(mp, false); /* remove cache entries for this file sys */
|
||||
vfs_deallocate_syncvnode(mp);
|
||||
error = VFS_UNMOUNT(mp, flags);
|
||||
vn_finished_write(mp);
|
||||
|
@ -326,9 +326,9 @@ vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs)
|
||||
TAILQ_INSERT_TAIL(&mountlist, mpdevfs, mnt_list);
|
||||
mtx_unlock(&mountlist_mtx);
|
||||
|
||||
cache_purgevfs(mporoot, true);
|
||||
cache_purgevfs(mporoot);
|
||||
if (mporoot != mpdevfs)
|
||||
cache_purgevfs(mpdevfs, true);
|
||||
cache_purgevfs(mpdevfs);
|
||||
|
||||
if (VFS_ROOT(mporoot, LK_EXCLUSIVE, &vporoot))
|
||||
panic("vfs_mountroot_shuffle: Cannot find root vnode");
|
||||
@ -344,7 +344,7 @@ vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs)
|
||||
/* Set up the new rootvnode, and purge the cache */
|
||||
mpnroot->mnt_vnodecovered = NULL;
|
||||
set_rootvnode();
|
||||
cache_purgevfs(rootvnode->v_mount, true);
|
||||
cache_purgevfs(rootvnode->v_mount);
|
||||
|
||||
if (mporoot != mpdevfs) {
|
||||
/* Remount old root under /.mount or /mnt */
|
||||
|
@ -643,7 +643,7 @@ 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);
|
||||
void cache_purgevfs(struct mount *mp);
|
||||
int change_dir(struct vnode *vp, struct thread *td);
|
||||
void cvtstat(struct stat *st, struct ostat *ost);
|
||||
void freebsd11_cvtnstat(struct stat *sb, struct nstat *nsb);
|
||||
|
Loading…
x
Reference in New Issue
Block a user