From nobody Mon May 01 08:12:10 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 4Q8wt30284z48DhV; Mon, 1 May 2023 08:12:11 +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 4Q8wt26jjcz45MF; Mon, 1 May 2023 08:12:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682928730; 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=TkJPZglKCcFC8vJj4H2y4vFCNnSrIOILJOdhrgxHTlA=; b=QfyQ9x5yneMghKPH9OkNNSFhghBsqSvTRPLR5rwrfjvugMHQtI/nM0irpeeo5vyvEGnzwL IKPWJMdQNcmbaokBwprJnE6j+DS8MJ7vCWzEAjV71+R8mOZ190vdERMe5rmy+iuUo7DU+o tegg1cjeZbibBarn9j9ElKEy/S2erSF7z28j2L+0Z9onoxw4LLWSjSfKqE9U1KNPx983lM SZTHKizH0Iw8vj7YAI6cp4RaZGo+Fh1+hVF3K1hdBtB3faeefMp3CCZ5cPAJLPTJtYLrIh 7U8E3cv1IQVx4ngkf79+UjYXhmTU/3G/VzB75EFmntR0mmsZdciQvxITujLeMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682928730; 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=TkJPZglKCcFC8vJj4H2y4vFCNnSrIOILJOdhrgxHTlA=; b=Ij4wKImjpsL2eai55b9hdh89+ImcZPNnqQCD9Nd4W6T7ElV86rlGjVz+zoKBzZ6j4o7KSv DATPjBgAPb4P8E1U5CCTt4Qu1hGq6n4XN2/6Z84wWKYDG/hd5dh8+rY+WFtbXVad0KEFVF NAYvWn/PXW3Jt/0XEbWfCWdeadb0jgf6fDzU/PPo3kOyjYD0uI4lqbBX3nqv7UuAW1AhiA BhvLHI2Zw4ka6b2KosaWp+sF1jDA9GmOtkiQY+uWYLgRWMx6XOUXvTzOa9LwF4eyrq5OyA Du+2JNZHJaLToRsnyUclvCXB6rJNxhHQz1YAyK/vieh9LBzfcZpJAirEjD4gCA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682928730; a=rsa-sha256; cv=none; b=tpapIuy7DdTQeLuNzP9N+21q3hJvRuXQxAHUZHZruBDz2rorA4GtQkLdtJ5z0AAymBo/H4 jpkYgEbjBGnB546fcOBF+EYm1VeChzc7fTBXbI30RAB/VPyZ+6bGjY8KQUXvUwt4q39iNM QI/FqC5Vg1MTi4eXjHoT/43rdGQV8yAIZSTP8pvME72NDrR84w0L0eUmXv1H8ThlFKY1yc zTN66f0uPgrznO47O+QOjyOCZF7fgk/RT55XJwwGfRVsQf/x9udbia+DmdI8Ume71eJi4o FVc/xwUoBHSB2ufptTaX3GUEmtcyS5gLCTiDiqEC7mxIjeUYKAUI1AhUHjyhDA== 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 4Q8wt25pckzyNK; Mon, 1 May 2023 08:12:10 +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 3418CAFC078521; Mon, 1 May 2023 08:12:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 3418CAVt078520; Mon, 1 May 2023 08:12:10 GMT (envelope-from git) Date: Mon, 1 May 2023 08:12:10 GMT Message-Id: <202305010812.3418CAVt078520@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Stefan=20E=C3=9Fer?= Subject: git: 3270f21597fb - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3270f21597fb35f7cdbc39f0f09eaf4f84e79fe6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=3270f21597fb35f7cdbc39f0f09eaf4f84e79fe6 commit 3270f21597fb35f7cdbc39f0f09eaf4f84e79fe6 Author: Stefan Eßer AuthorDate: 2023-04-25 07:40:05 +0000 Commit: Stefan Eßer CommitDate: 2023-05-01 08:11:44 +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 (cherry picked from commit 88a795e80c03ff1d960d830ee273589664ab06cc) --- 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 44473a926182..3c82021a8148 100644 --- a/sys/fs/pseudofs/pseudofs.c +++ b/sys/fs/pseudofs/pseudofs.c @@ -377,10 +377,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);