diff options
author | Mateusz Guzik <mjg@FreeBSD.org> | 2022-09-17 15:17:20 +0000 |
---|---|---|
committer | Mateusz Guzik <mjg@FreeBSD.org> | 2022-09-17 15:17:20 +0000 |
commit | 9e4f35ac25538fb426c459400f0c36e085546ffa (patch) | |
tree | a3e86ff2290a25ebd4bf25ca480c06187ff3bac5 /sys/kern/vfs_vnops.c | |
parent | 1c7084fe5612f179517994becb24a4d8f7a23cbe (diff) | |
download | src-9e4f35ac25538fb426c459400f0c36e085546ffa.tar.gz src-9e4f35ac25538fb426c459400f0c36e085546ffa.zip |
vfs: deperl msleep flag calculation in vn_start_*write
Diffstat (limited to 'sys/kern/vfs_vnops.c')
-rw-r--r-- | sys/kern/vfs_vnops.c | 20 |
1 files changed, 14 insertions, 6 deletions
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; |