mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-24 07:40:52 +00:00
vfs: make write suspension mandatory
At the time opt-in was introduced adding yourself as a writer was esrializing across the mount point. Nowadays it is fully per-cpu, the only impact being a small single-threaded hit on top of what's there right now. Vast majority of the overhead stems from the call to VOP_GETWRITEMOUNT which has is done regardless. Should someone want to microoptimize this single-threaded they can coalesce looking the mount up with adding a write to it.
This commit is contained in:
parent
ec0234b4c2
commit
074ad60a4c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357962
@ -88,7 +88,6 @@ static int tmpfs_root(struct mount *, int flags, struct vnode **);
|
||||
static int tmpfs_fhtovp(struct mount *, struct fid *, int,
|
||||
struct vnode **);
|
||||
static int tmpfs_statfs(struct mount *, struct statfs *);
|
||||
static void tmpfs_susp_clean(struct mount *);
|
||||
|
||||
static const char *tmpfs_opts[] = {
|
||||
"from", "size", "maxfilesize", "inodes", "uid", "gid", "mode", "export",
|
||||
@ -646,14 +645,6 @@ tmpfs_sync(struct mount *mp, int waitfor)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* The presence of a susp_clean method tells the VFS to track writes.
|
||||
*/
|
||||
static void
|
||||
tmpfs_susp_clean(struct mount *mp __unused)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
tmpfs_init(struct vfsconf *conf)
|
||||
{
|
||||
@ -679,7 +670,6 @@ struct vfsops tmpfs_vfsops = {
|
||||
.vfs_statfs = tmpfs_statfs,
|
||||
.vfs_fhtovp = tmpfs_fhtovp,
|
||||
.vfs_sync = tmpfs_sync,
|
||||
.vfs_susp_clean = tmpfs_susp_clean,
|
||||
.vfs_init = tmpfs_init,
|
||||
.vfs_uninit = tmpfs_uninit,
|
||||
};
|
||||
|
@ -1643,13 +1643,6 @@ vn_closefile(struct file *fp, struct thread *td)
|
||||
return (error);
|
||||
}
|
||||
|
||||
static bool
|
||||
vn_suspendable(struct mount *mp)
|
||||
{
|
||||
|
||||
return (mp->mnt_op->vfs_susp_clean != NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Preparing to start a filesystem write operation. If the operation is
|
||||
* permitted, then we bump the count of operations in progress and
|
||||
@ -1729,12 +1722,6 @@ vn_start_write(struct vnode *vp, struct mount **mpp, int flags)
|
||||
if ((mp = *mpp) == NULL)
|
||||
return (0);
|
||||
|
||||
if (!vn_suspendable(mp)) {
|
||||
if (vp != NULL || (flags & V_MNTREF) != 0)
|
||||
vfs_rel(mp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* VOP_GETWRITEMOUNT() returns with the mp refcount held through
|
||||
* a vfs_ref().
|
||||
@ -1780,12 +1767,6 @@ vn_start_secondary_write(struct vnode *vp, struct mount **mpp, int flags)
|
||||
if ((mp = *mpp) == NULL)
|
||||
return (0);
|
||||
|
||||
if (!vn_suspendable(mp)) {
|
||||
if (vp != NULL || (flags & V_MNTREF) != 0)
|
||||
vfs_rel(mp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* VOP_GETWRITEMOUNT() returns with the mp refcount held through
|
||||
* a vfs_ref().
|
||||
@ -1829,7 +1810,7 @@ vn_finished_write(struct mount *mp)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (mp == NULL || !vn_suspendable(mp))
|
||||
if (mp == NULL)
|
||||
return;
|
||||
|
||||
if (vfs_op_thread_enter(mp)) {
|
||||
@ -1863,7 +1844,7 @@ vn_finished_write(struct mount *mp)
|
||||
void
|
||||
vn_finished_secondary_write(struct mount *mp)
|
||||
{
|
||||
if (mp == NULL || !vn_suspendable(mp))
|
||||
if (mp == NULL)
|
||||
return;
|
||||
MNT_ILOCK(mp);
|
||||
MNT_REL(mp);
|
||||
@ -1884,8 +1865,6 @@ vfs_write_suspend(struct mount *mp, int flags)
|
||||
{
|
||||
int error;
|
||||
|
||||
MPASS(vn_suspendable(mp));
|
||||
|
||||
vfs_op_enter(mp);
|
||||
|
||||
MNT_ILOCK(mp);
|
||||
@ -1934,8 +1913,6 @@ void
|
||||
vfs_write_resume(struct mount *mp, int flags)
|
||||
{
|
||||
|
||||
MPASS(vn_suspendable(mp));
|
||||
|
||||
MNT_ILOCK(mp);
|
||||
if ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0) {
|
||||
KASSERT(mp->mnt_susp_owner == curthread, ("mnt_susp_owner"));
|
||||
@ -1970,7 +1947,6 @@ vfs_write_suspend_umnt(struct mount *mp)
|
||||
{
|
||||
int error;
|
||||
|
||||
MPASS(vn_suspendable(mp));
|
||||
KASSERT((curthread->td_pflags & TDP_IGNSUSP) == 0,
|
||||
("vfs_write_suspend_umnt: recursed"));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user