sys/fs: do not report blocks allocated for synthetic file systems
authorStefan Eßer <se@FreeBSD.org>
Tue, 25 Apr 2023 07:40:05 +0000 (09:40 +0200)
committerStefan Eßer <se@FreeBSD.org>
Tue, 25 Apr 2023 07:59:15 +0000 (09:59 +0200)
commit88a795e80c03ff1d960d830ee273589664ab06cc
tree28d0832ed7e3dc6ff007ecc5a4c98e0cf91300ef
parent0728695c63efda298feccefb3615c23cb6682929
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
sys/fs/fdescfs/fdesc_vfsops.c
sys/fs/pseudofs/pseudofs.c