From nobody Sat Sep 17 15:42:38 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MVFZ65vJmz2kqxQ; Sat, 17 Sep 2022 15:42:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MVFZ65RZbz3QRF; Sat, 17 Sep 2022 15:42:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663429358; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zf9WEDPU38fdrH5EnoiTmYy1h4CWYRCWgo8elr7GFYw=; b=gB+KBZ1vXhFfp1qCDbWgQbzeLDinJ5wr2tEaPHF3LOeXYD7/jdkOahI7Cnb6G3jF9cDfY3 WO36mUKDEh5DX89JVxuLMwsY5SJjszQpfAeeYrcWMdO1UtDCB7pk1g5zCTAvoqWKHWa2Y9 BYH0jQuZHpw/RfVTyHlgJkJbuIGPRPuWoIbWv+xELOmLVzTvoPGLpRWAT67jm8LfGxdV0m a8PIqNgqKpUUPtxaUDO3kXvgTVMne9s/MgvcDuFmUSNhP7QHnz5h2Uq2eWUTfC8/4rKig2 P2A4qOCIZaM1KFMJxmHeWBUn4flKUKnyHW+ac0SknBbJUQeAmNGLNsTa/BBDqA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MVFZ64V9hzlK7; Sat, 17 Sep 2022 15:42:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 28HFgceD076520; Sat, 17 Sep 2022 15:42:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28HFgcWG076519; Sat, 17 Sep 2022 15:42:38 GMT (envelope-from git) Date: Sat, 17 Sep 2022 15:42:38 GMT Message-Id: <202209171542.28HFgcWG076519@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 9e4f35ac2553 - main - vfs: deperl msleep flag calculation in vn_start_*write List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e4f35ac25538fb426c459400f0c36e085546ffa Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663429358; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zf9WEDPU38fdrH5EnoiTmYy1h4CWYRCWgo8elr7GFYw=; b=iN8f5W5RAYzS7zA1in1GviXuNP8eW5tfwohWTBpymb2oIsaKXnnXoAJ/IsNzo73W4825Df JhXyJQxdkEaMMAJPDNiFPtWSRvJYXItwr86TjqtJYHu6d+yWaI+fuon50HnVcwBGkvzki3 iYeuYwfYkOxI5jXlQNiNUwtvm39yNArHnzix2gDoWRpLHvUbO3JIrwteO6L0MV6X+dvvZU cAguSl6f1PzYhBUwNy0M2Z2dKBod6TLihyisTTelRxeATGN5C00TGjK0wnkxTscxjlkNah at3qY/BSI7b+Lh1d/XpctAFyTALdFVPA+sRFFrOwIkFDG+L8B6wk85PvKlT9Mw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663429358; a=rsa-sha256; cv=none; b=ebCp2RWRNw1xUiZZQxmKeoVlU/QZfcPpZoEFKQJ2bivdpsLAEgg2WOyv0xydWK9ZBHmuMC WQHrDx9n419qY7OXuE4ZWeqd2GyQ55lMtq0M+FjCnxMwmA5bc5qrmXclJz8PDOQlzlSoTr t51egou7Gd+pzWm83C1jDB9d1kifH5KlWmctR2cifxWdFfbo2vxQ4o7tbraLHXA56CB873 9LyWLaJNCZ01k0RHSaCWd2xAUmEyb2OqT2Q0UxOiX6PDiPSw/3KZHLqHNTajwbUD4cR1Dw 6UXO85R5VGVB6C5kwRhpTN4T0iTmXoPDyAHMD9VwA/raWcOfIT7I8Ay9C2mmfA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=9e4f35ac25538fb426c459400f0c36e085546ffa commit 9e4f35ac25538fb426c459400f0c36e085546ffa Author: Mateusz Guzik AuthorDate: 2022-09-17 15:17:20 +0000 Commit: Mateusz Guzik CommitDate: 2022-09-17 15:17:20 +0000 vfs: deperl msleep flag calculation in vn_start_*write --- sys/kern/vfs_vnops.c | 20 ++++++++++++++------ 1 file 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;