From nobody Tue May 21 18:16:46 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 4VkN1V6XD5z5Lxnr; Tue, 21 May 2024 18:16:46 +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 4VkN1V5xKdz3wxy; Tue, 21 May 2024 18:16:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716315406; 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=7a+fpdMunyNo66jIvY3F9ubxJ8fdJjAekhugFGz0yeI=; b=WOK1oEYo1jAEFciA/JqrLhcYLromBrYMBHcpAk8mZJykeXWfqFvBFLGSZM1iPEMXYnNSIW gMCIQ2nHDbrbFhNhXkjm9I7+93o+RW2AT6sSu1tdKV3pvO2mkSHI0lXr0kKdUuoxxsK2A1 mkWF4MLnSLDh4QwK/CATrhoEiDrYftn4/N5bagpcdMfbEzxSnfD541qlsAZelo6gTUl2Y0 9lr12OGicfsWwCCdZbbk0DbnVRGkTkOwQALNhflc2X88blsZ1PkTpy9cmfSiXCbz98fAId dburWI1FZmDTOCtBJzsr79TDpGkz5ET+dYg2tlsfbG2X8GCwksHLiyGYE11kQg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716315406; a=rsa-sha256; cv=none; b=lOdIk0ba+BeyJCWV9g+oaxv+1zcFDPQgp52gZ4LyTStONeGMjs/VdelMGPqCtbV9SuP9rj ygvhwfFF8pnTPbqoTycWnw5MXE0zXmI4RhFhjTLCbfnlZanPj24t7jSj3nMDPhc6NOJ5OU l2W9Mz0030f70/X0/EgfV4RUJNgVLGVtpyo5SB846hKolGUTTSeAccjnjCXpKZ+aLCNKiU RIQTLB9Nn3WrvkbX/VY2K/6h04z4X1B4dJrVcSOxXWM5noGR5K1JecelbjGShRMLAM046/ S8mp+tEpSAadXKFmwENOfH7C752OGpBie12SQO8DWf15pC6s6bckwoxrEJIDXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716315406; 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=7a+fpdMunyNo66jIvY3F9ubxJ8fdJjAekhugFGz0yeI=; b=rUZ1UN+LE9Guoamwu9Yd3IQcvgCq1ejbFZQBeT6xXMt2LETWU2LGWg4NcNV1p0OyjTbWbI QVvBOA862Mn5zYaHmZO8Ds6FQFvT1wj8hYkfOcfUOLuc1M1/aKr1Tb4YkT+FYr/Bbwmcy2 bKGwvEUs5DzPSKD2NRT7FHmXsT5dSfgI7ns8aZ6AhccJ7agz5YBztj1dRMAkzBkCMv8Bc6 ce19vTdRXBw1NgOsio4mdYX3Un1PmYmghraPJTMncKyc7KnDeHHeCTtZ9f7H5BOqV0RyDr CaZAttkVne2HiBT3wJ6hGDxu6M1iYjF1PsgjlcallV8hKbeSJ6Ib31kLlX8mGQ== 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 4VkN1V5XpDzYMP; Tue, 21 May 2024 18:16:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44LIGkis056200; Tue, 21 May 2024 18:16:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44LIGkNt056197; Tue, 21 May 2024 18:16:46 GMT (envelope-from git) Date: Tue, 21 May 2024 18:16:46 GMT Message-Id: <202405211816.44LIGkNt056197@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Libby Subject: git: bd56aad33c25 - main - buf: define and use BUF_DISOWNED 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: rlibby X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd56aad33c2533615f76c17795f0aa70b7686309 Auto-Submitted: auto-generated The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=bd56aad33c2533615f76c17795f0aa70b7686309 commit bd56aad33c2533615f76c17795f0aa70b7686309 Author: Ryan Libby AuthorDate: 2024-05-21 17:21:50 +0000 Commit: Ryan Libby CommitDate: 2024-05-21 17:21:50 +0000 buf: define and use BUF_DISOWNED Implement an API where previously code was directly reaching into the buf's internal lock. Reviewed by: mckusick, imp, kib, markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D45249 --- sys/geom/geom_vfs.c | 4 ++-- sys/sys/buf.h | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/geom/geom_vfs.c b/sys/geom/geom_vfs.c index 893c8dfffa6f..87b2fea21baa 100644 --- a/sys/geom/geom_vfs.c +++ b/sys/geom/geom_vfs.c @@ -124,12 +124,12 @@ g_vfs_done(struct bio *bip) mp = cdevp->si_mountpt; if (mp != NULL) { if (bp->b_iocmd == BIO_READ) { - if (LK_HOLDER(bp->b_lock.lk_lock) == LK_KERNPROC) + if (BUF_DISOWNED(bp)) mp->mnt_stat.f_asyncreads++; else mp->mnt_stat.f_syncreads++; } else if (bp->b_iocmd == BIO_WRITE) { - if (LK_HOLDER(bp->b_lock.lk_lock) == LK_KERNPROC) + if (BUF_DISOWNED(bp)) mp->mnt_stat.f_asyncwrites++; else mp->mnt_stat.f_syncwrites++; diff --git a/sys/sys/buf.h b/sys/sys/buf.h index 70fb2812c3ba..cee9547912a6 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -341,6 +341,13 @@ struct buf { */ #define BUF_ISLOCKED(bp) \ lockstatus(&(bp)->b_lock) + +/* + * Check if a buffer lock is currently held by LK_KERNPROC. + */ +#define BUF_DISOWNED(bp) \ + lockmgr_disowned(&(bp)->b_lock) + /* * Free a buffer lock. */