From nobody Wed Nov 13 19:35:44 2024 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 4XpYRN48Czz5cVBW; Wed, 13 Nov 2024 19:35:44 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XpYRN3hN9z48vK; Wed, 13 Nov 2024 19:35:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731526544; 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=s6E9IbaueJQfXMSMPu7/CKRguvSCqgofj+cwUya41+0=; b=ILf3faMWcST0pLmpWJxMc2jsQGHvQiFDI70WBfABl8BjEPOeUOwkkRkZNMJQwzckHy477n 72eKlpwHj6hCxPZK7IGRKIMkeN6tFJDHzky5TWCgFb8Z4Dx7HJbhnufEwWwJAbSEemhkJP nk7q8cBtcgqdDDrUct6CdVJIWMv1VVg4yuTCzEtxoLEnIF6iuHrvGGY74KyVple5oLPqJE 1yfqmQmw1yHET2xjxMyGsNF9crSvKUypnU3gOFKuwZC+5FPFxPdj+bgLsyWwOpWXoIVGx3 F8NlSljmcmyV84xjGBQ7jz63cDDLaIzRlRQBtC8MLuzFeS4ws1GO4RGIwjXg/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731526544; 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=s6E9IbaueJQfXMSMPu7/CKRguvSCqgofj+cwUya41+0=; b=rkKFxw5zDdT8nSKv/ifskay12qT7MeqPssU175K/Gy9lbE61FIa/VwEgxPy3T5l8BhnzZM UMedLqutzqTZnC79ddhGZZjVT4xgsXvzeOZDt9Az+sxeaKTAFeeE1WRoYS2F+N6Ps5GP5P d2lew1DPiIczE4RWYpTmkTi/pfpmtl/cSolDGbhjMJzDNzY0ZhSZvck3d7gLVdmvrLJboJ N0OcGlxSUM49PFD8xPeRHgnbt+HpHVAhOzV7pFHyIKcxdjMBnns1BIsXNf4BE15FMtlqf0 TPzYaM7iEw6QmkgZw74UijsCBvvHsdNWk6BgSK/j9D3rscicekFVeq3ytekxmg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731526544; a=rsa-sha256; cv=none; b=hlFUtLoVsmffiZ8H+Cpo5WVji6S/unqnTs/lcCS5D8TCKF8BqnFD2s4AVIL/uAqACkxHwU zc/Jdph8fQUkYDqqWG18R7BglFvW0iC1ClK3MTW0YdVKmgft4ABS+UgqwD/L9rh/plcaLZ Pc1eeA2hhHKzIR6iU5P1sT1V4+uxF0h40omaXECJZE4wsAeL6ROrg9kXdMe14yHx5nP4nv 4Hk7X/29hAsXM0aNLmiD2aFy1JuG0xLR0uSDmH/uRIr+XaAZT1xoqkm+Dh2HwjoH9Cnj0+ 1DRlVwupXC6rs8gX57c8TjeG9gmuqMU22PALxDqTo1WYvsrey0V4IR/pI/395Q== 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 4XpYRN3JGQz172N; Wed, 13 Nov 2024 19:35:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4ADJZi0R050660; Wed, 13 Nov 2024 19:35:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4ADJZiB8050657; Wed, 13 Nov 2024 19:35:44 GMT (envelope-from git) Date: Wed, 13 Nov 2024 19:35:44 GMT Message-Id: <202411131935.4ADJZiB8050657@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: c1d93f81e49c - main - bufwrite(): style 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c1d93f81e49c5c32262eefcd087b9c5582e0f83c Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c1d93f81e49c5c32262eefcd087b9c5582e0f83c commit c1d93f81e49c5c32262eefcd087b9c5582e0f83c Author: Konstantin Belousov AuthorDate: 2024-11-12 06:22:06 +0000 Commit: Konstantin Belousov CommitDate: 2024-11-13 19:35:02 +0000 bufwrite(): style Use bool for vp_md. Compactify the calculation. Explicitly check for non-zero when testing flags. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/kern/vfs_bio.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 7bcc61c27109..3ef715baebfa 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -2304,10 +2304,10 @@ breadn_flags(struct vnode *vp, daddr_t blkno, daddr_t dblkno, int size, int bufwrite(struct buf *bp) { - int oldflags; struct vnode *vp; long space; - int vp_md; + int oldflags, retval; + bool vp_md; CTR3(KTR_BUF, "bufwrite(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags); if ((bp->b_bufobj->bo_flag & BO_DEAD) != 0) { @@ -2316,24 +2316,21 @@ bufwrite(struct buf *bp) brelse(bp); return (ENXIO); } - if (bp->b_flags & B_INVAL) { + if ((bp->b_flags & B_INVAL) != 0) { brelse(bp); return (0); } - if (bp->b_flags & B_BARRIER) + if ((bp->b_flags & B_BARRIER) != 0) atomic_add_long(&barrierwrites, 1); oldflags = bp->b_flags; - KASSERT(!(bp->b_vflags & BV_BKGRDINPROG), + KASSERT((bp->b_vflags & BV_BKGRDINPROG) == 0, ("FFS background buffer should not get here %p", bp)); vp = bp->b_vp; - if (vp) - vp_md = vp->v_vflag & VV_MD; - else - vp_md = 0; + vp_md = vp != NULL && (vp->v_vflag & VV_MD) != 0; /* * Mark the buffer clean. Increment the bufobj write count @@ -2365,19 +2362,19 @@ bufwrite(struct buf *bp) } #endif /* RACCT */ curthread->td_ru.ru_oublock++; - if (oldflags & B_ASYNC) + if ((oldflags & B_ASYNC) != 0) BUF_KERNPROC(bp); bp->b_iooffset = dbtob(bp->b_blkno); buf_track(bp, __func__); bstrategy(bp); if ((oldflags & B_ASYNC) == 0) { - int rtval = bufwait(bp); + retval = bufwait(bp); brelse(bp); - return (rtval); + return (retval); } else if (space > hirunningspace) { /* - * don't allow the async write to saturate the I/O + * Don't allow the async write to saturate the I/O * system. We will not deadlock here because * we are blocking waiting for I/O that is already in-progress * to complete. We do not block here if it is the update