Fix the pNFS server's reporting of SpaceUsed (va_bytes).
authorrmacklem <rmacklem@FreeBSD.org>
Fri, 22 Nov 2019 00:22:55 +0000 (00:22 +0000)
committerrmacklem <rmacklem@FreeBSD.org>
Fri, 22 Nov 2019 00:22:55 +0000 (00:22 +0000)
commitfe1e9037da26583bb622e18ec12f2019138fc40e
tree7c4097ada1fa9de47aaf0e9b5b55b99d02255b59
parent63e627ce4f6782a77091c839caa65a2c00c2f35f
Fix the pNFS server's reporting of SpaceUsed (va_bytes).

The pNFS server currently reports SpaceUsed (va_bytes) for the metadata
file. This in not correct, since the metadata file is always empty and,
as such, va_bytes is just the allocation for the empty file.
This patch adds va_bytes to the list of attributes acquired from the
DS for a file, so that it includes the allocated data size and is updated
when the file is written.
For files created on a pNFS server before this patch is applied, the
va_bytes value is estimated by rounding va_size up to a multiple of
BLKDEV_IOSIZE. Once the file is written after this patch has been
applied to the metadata server, the va_bytes returned for the file
will be correct.

This patch only affects a pNFS metadata server.

Found during testing of the NFSv4.2 pNFS server for the Allocate operation.
(Not yet in head/current.)

MFC after: 2 weeks
sys/fs/nfs/nfsrvstate.h
sys/fs/nfsserver/nfs_nfsdport.c