From nobody Tue Apr 25 08:00:37 2023 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 4Q5DvT4J7Wz46pp2; Tue, 25 Apr 2023 08:00:37 +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 4Q5DvT3rNzz3kWZ; Tue, 25 Apr 2023 08:00:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682409637; 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=r9ofs+Eu+2gi12ZjW7hXECQfKY1cgWqG6QTszk0IS9s=; b=g0gxuNjl4vnsgA6fIVYUuy4Pbzc28FssIB+FsDlctO6Oz3PPnRvK5upjjb5eBiinK4+juH 4DiDbxramglFYewTLceA47lEZjvIZ05OL4unnxPHfz4TIcfm2zkNq5hm1WzmPmIqv0AmmE 0/rBAIRoI7Vcb3uAx9qVV4Vk6ufDkIr0iS/lYKTEok7whCDNFPzvFNUn3fzkFxCNcCDkMz 0y2ne7KSE1yeHgj3kWAbtypmGcTX4W7JtcoJw2q7PpVXIH2m8V4c+O9XawQsvJJlMjzMd7 1JMXLiBhfZNO7Q8gm74u7QguBXRY1zr38jDIhoiuVRC8xwV0RiM1rB2QbnPtJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682409637; 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=r9ofs+Eu+2gi12ZjW7hXECQfKY1cgWqG6QTszk0IS9s=; b=jTqmZ/K1S81vSZN4lgk83byhw6nnwRmQpyuQYuH9B3gt1wLd4wTbWCvedVamudTg/noVrM YqxmGunH4bs31vvbLAa5EwZTEN1N6XORi+fpPNsi+WT9RIrJIBkzInAO/xMIOYOpkIWQgi xgoytVfke+/mARqXJhQahPeppXwZqA03//JHj9FL3UwCmOPvhHGDmD8Pe3EOZhZIknsVcd tLfrQ1gk7o0WI60JsnKZKSoqTUfO/OCt5SWMCPgqKwcXn75SYarI60QVcEGtJcU2qAUUCE kV55CFnHTIIOqaseem4C3AF1eLCMzR6STBuFtaXf/W6DnVS0NyAT2pizj3COOA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682409637; a=rsa-sha256; cv=none; b=wD0RqJLmt2BZij9PxV/wvDiO7/XZYK1Eq8qCIa/yWJPg3OAx2aBbo8kEjV7ELKrICymb8H 0h5tzH9MM5zCnuqnVGWvcsfF5U+fuD113vdazxmDlzWrjgulVeVEiMCFS0JfhdW80Vzk3V uJifZSmxQeVfwQJyBC3lgBRCvskgZ11Hq6CGONtAaeafL8Lg1Ei2KX9yHk4XMmIGzmk5q5 mFw4gh6YcHV2xWgF2vjpvuYwQC1ctlvVX2+5TXXurk+7qBDO6DdnYogQqNBk5DorS/1dqC Vi4pttXnKs7/UqvIbJDCshZDtvH4oqrX+7V+TUKmZLBdypBenW/9IGrNXr3l9w== 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 4Q5DvT2VQbz107v; Tue, 25 Apr 2023 08:00:37 +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 33P80bRY091550; Tue, 25 Apr 2023 08:00:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33P80b44091549; Tue, 25 Apr 2023 08:00:37 GMT (envelope-from git) Date: Tue, 25 Apr 2023 08:00:37 GMT Message-Id: <202304250800.33P80b44091549@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Stefan=20E=C3=9Fer?= Subject: git: 88a795e80c03 - main - sys/fs: do not report blocks allocated for synthetic file systems 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: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88a795e80c03ff1d960d830ee273589664ab06cc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=88a795e80c03ff1d960d830ee273589664ab06cc commit 88a795e80c03ff1d960d830ee273589664ab06cc Author: Stefan Eßer AuthorDate: 2023-04-25 07:40:05 +0000 Commit: Stefan Eßer CommitDate: 2023-04-25 07:59:15 +0000 sys/fs: do not report blocks allocated for synthetic file systems The pseudo file systems (devfs, fdescfs, procfs, etc.) report total and available blocks and inodes despite being synthetic with no underlying storage device to which those values could be applied. The current code of these file systems tends to report a fixed number of total blocks but no free blocks, and in the case of procfs, libprocfs, linsysfs also no free inodes. This can be irritating in e.g. the "df" output, since 100% of the resources seem to be in use, but it can also create warnings in monitoring tools used for capacity management. This patch makes these file systems return the same value for the total and free parameters, leading to 0% in use being displayed by "df". Since there is no resource that can be exhausted, this appears to be a sensible result. Reviewed by: mckusick Differential Revision: https://reviews.freebsd.org/D39442 --- sys/fs/devfs/devfs_vfsops.c | 4 ++-- sys/fs/fdescfs/fdesc_vfsops.c | 4 ++-- sys/fs/pseudofs/pseudofs.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/fs/devfs/devfs_vfsops.c b/sys/fs/devfs/devfs_vfsops.c index 56297578ec2a..0fac2b68e2e1 100644 --- a/sys/fs/devfs/devfs_vfsops.c +++ b/sys/fs/devfs/devfs_vfsops.c @@ -230,8 +230,8 @@ devfs_statfs(struct mount *mp, struct statfs *sbp) sbp->f_bsize = DEV_BSIZE; sbp->f_iosize = DEV_BSIZE; sbp->f_blocks = 2; /* 1K to keep df happy */ - sbp->f_bfree = 0; - sbp->f_bavail = 0; + sbp->f_bfree = 2; + sbp->f_bavail = 2; sbp->f_files = 0; sbp->f_ffree = 0; return (0); diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c index edc2cdd61847..2961c3bf6224 100644 --- a/sys/fs/fdescfs/fdesc_vfsops.c +++ b/sys/fs/fdescfs/fdesc_vfsops.c @@ -223,8 +223,8 @@ fdesc_statfs(struct mount *mp, struct statfs *sbp) sbp->f_bsize = DEV_BSIZE; sbp->f_iosize = DEV_BSIZE; sbp->f_blocks = 2; /* 1K to keep df happy */ - sbp->f_bfree = 0; - sbp->f_bavail = 0; + sbp->f_bfree = 2; + sbp->f_bavail = 2; sbp->f_files = lim + 1; /* Allow for "." */ sbp->f_ffree = freefd; /* See comments above */ return (0); diff --git a/sys/fs/pseudofs/pseudofs.c b/sys/fs/pseudofs/pseudofs.c index 29071b34bd06..15a714e23bc6 100644 --- a/sys/fs/pseudofs/pseudofs.c +++ b/sys/fs/pseudofs/pseudofs.c @@ -379,10 +379,10 @@ pfs_mount(struct pfs_info *pi, struct mount *mp) vfs_mountedfrom(mp, pi->pi_name); sbp->f_bsize = PAGE_SIZE; sbp->f_iosize = PAGE_SIZE; - sbp->f_blocks = 1; - sbp->f_bfree = 0; - sbp->f_bavail = 0; - sbp->f_files = 1; + sbp->f_blocks = 2; + sbp->f_bfree = 2; + sbp->f_bavail = 2; + sbp->f_files = 0; sbp->f_ffree = 0; return (0);