From 9e4f35ac25538fb426c459400f0c36e085546ffa Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Sat, 17 Sep 2022 17:17:20 +0200 Subject: vfs: deperl msleep flag calculation in vn_start_*write --- sys/kern/vfs_vnops.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'sys/kern/vfs_vnops.c') diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 2e39d8a9e4d2..a7ca547f571f 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1875,8 +1875,12 @@ vn_start_write_refed(struct mount *mp, int flags, bool mplocked) */ if ((curthread->td_pflags & TDP_IGNSUSP) == 0 || mp->mnt_susp_owner != curthread) { - mflags = ((mp->mnt_vfc->vfc_flags & VFCF_SBDRY) != 0 ? - (flags & PCATCH) : 0) | (PUSER - 1); + mflags = 0; + if ((mp->mnt_vfc->vfc_flags & VFCF_SBDRY) != 0) { + if (flags & PCATCH) + mflags |= PCATCH; + } + mflags |= (PUSER - 1); while ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0) { if (flags & V_NOWAIT) { error = EWOULDBLOCK; @@ -1944,7 +1948,7 @@ int vn_start_secondary_write(struct vnode *vp, struct mount **mpp, int flags) { struct mount *mp; - int error; + int error, mflags; retry: if (vp != NULL) { @@ -1986,9 +1990,13 @@ vn_start_secondary_write(struct vnode *vp, struct mount **mpp, int flags) /* * Wait for the suspension to finish. */ - error = msleep(&mp->mnt_flag, MNT_MTX(mp), (PUSER - 1) | PDROP | - ((mp->mnt_vfc->vfc_flags & VFCF_SBDRY) != 0 ? (flags & PCATCH) : 0), - "suspfs", 0); + mflags = 0; + if ((mp->mnt_vfc->vfc_flags & VFCF_SBDRY) != 0) { + if (flags & PCATCH) + mflags |= PCATCH; + } + mflags |= (PUSER - 1) | PDROP; + error = msleep(&mp->mnt_flag, MNT_MTX(mp), mflags, "suspfs", 0); vfs_rel(mp); if (error == 0) goto retry; -- cgit v1.2.3