162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * User-space visible declarations for NFS client per-mount 462306a36Sopenharmony_ci * point statistics 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * Copyright (C) 2005, 2006 Chuck Lever <cel@netapp.com> 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * NFS client per-mount statistics provide information about the 962306a36Sopenharmony_ci * health of the NFS client and the health of each NFS mount point. 1062306a36Sopenharmony_ci * Generally these are not for detailed problem diagnosis, but 1162306a36Sopenharmony_ci * simply to indicate that there is a problem. 1262306a36Sopenharmony_ci * 1362306a36Sopenharmony_ci * These counters are not meant to be human-readable, but are meant 1462306a36Sopenharmony_ci * to be integrated into system monitoring tools such as "sar" and 1562306a36Sopenharmony_ci * "iostat". As such, the counters are sampled by the tools over 1662306a36Sopenharmony_ci * time, and are never zeroed after a file system is mounted. 1762306a36Sopenharmony_ci * Moving averages can be computed by the tools by taking the 1862306a36Sopenharmony_ci * difference between two instantaneous samples and dividing that 1962306a36Sopenharmony_ci * by the time between the samples. 2062306a36Sopenharmony_ci */ 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci#ifndef _LINUX_NFS_IOSTAT 2362306a36Sopenharmony_ci#define _LINUX_NFS_IOSTAT 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci#define NFS_IOSTAT_VERS "1.1" 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci/* 2862306a36Sopenharmony_ci * NFS byte counters 2962306a36Sopenharmony_ci * 3062306a36Sopenharmony_ci * 1. SERVER - the number of payload bytes read from or written 3162306a36Sopenharmony_ci * to the server by the NFS client via an NFS READ or WRITE 3262306a36Sopenharmony_ci * request. 3362306a36Sopenharmony_ci * 3462306a36Sopenharmony_ci * 2. NORMAL - the number of bytes read or written by applications 3562306a36Sopenharmony_ci * via the read(2) and write(2) system call interfaces. 3662306a36Sopenharmony_ci * 3762306a36Sopenharmony_ci * 3. DIRECT - the number of bytes read or written from files 3862306a36Sopenharmony_ci * opened with the O_DIRECT flag. 3962306a36Sopenharmony_ci * 4062306a36Sopenharmony_ci * These counters give a view of the data throughput into and out 4162306a36Sopenharmony_ci * of the NFS client. Comparing the number of bytes requested by 4262306a36Sopenharmony_ci * an application with the number of bytes the client requests from 4362306a36Sopenharmony_ci * the server can provide an indication of client efficiency 4462306a36Sopenharmony_ci * (per-op, cache hits, etc). 4562306a36Sopenharmony_ci * 4662306a36Sopenharmony_ci * These counters can also help characterize which access methods 4762306a36Sopenharmony_ci * are in use. DIRECT by itself shows whether there is any O_DIRECT 4862306a36Sopenharmony_ci * traffic. NORMAL + DIRECT shows how much data is going through 4962306a36Sopenharmony_ci * the system call interface. A large amount of SERVER traffic 5062306a36Sopenharmony_ci * without much NORMAL or DIRECT traffic shows that applications 5162306a36Sopenharmony_ci * are using mapped files. 5262306a36Sopenharmony_ci * 5362306a36Sopenharmony_ci * NFS page counters 5462306a36Sopenharmony_ci * 5562306a36Sopenharmony_ci * These count the number of pages read or written via nfs_readpage(), 5662306a36Sopenharmony_ci * nfs_readpages(), or their write equivalents. 5762306a36Sopenharmony_ci * 5862306a36Sopenharmony_ci * NB: When adding new byte counters, please include the measured 5962306a36Sopenharmony_ci * units in the name of each byte counter to help users of this 6062306a36Sopenharmony_ci * interface determine what exactly is being counted. 6162306a36Sopenharmony_ci */ 6262306a36Sopenharmony_cienum nfs_stat_bytecounters { 6362306a36Sopenharmony_ci NFSIOS_NORMALREADBYTES = 0, 6462306a36Sopenharmony_ci NFSIOS_NORMALWRITTENBYTES, 6562306a36Sopenharmony_ci NFSIOS_DIRECTREADBYTES, 6662306a36Sopenharmony_ci NFSIOS_DIRECTWRITTENBYTES, 6762306a36Sopenharmony_ci NFSIOS_SERVERREADBYTES, 6862306a36Sopenharmony_ci NFSIOS_SERVERWRITTENBYTES, 6962306a36Sopenharmony_ci NFSIOS_READPAGES, 7062306a36Sopenharmony_ci NFSIOS_WRITEPAGES, 7162306a36Sopenharmony_ci __NFSIOS_BYTESMAX, 7262306a36Sopenharmony_ci}; 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci/* 7562306a36Sopenharmony_ci * NFS event counters 7662306a36Sopenharmony_ci * 7762306a36Sopenharmony_ci * These counters provide a low-overhead way of monitoring client 7862306a36Sopenharmony_ci * activity without enabling NFS trace debugging. The counters 7962306a36Sopenharmony_ci * show the rate at which VFS requests are made, and how often the 8062306a36Sopenharmony_ci * client invalidates its data and attribute caches. This allows 8162306a36Sopenharmony_ci * system administrators to monitor such things as how close-to-open 8262306a36Sopenharmony_ci * is working, and answer questions such as "why are there so many 8362306a36Sopenharmony_ci * GETATTR requests on the wire?" 8462306a36Sopenharmony_ci * 8562306a36Sopenharmony_ci * They also count anamolous events such as short reads and writes, 8662306a36Sopenharmony_ci * silly renames due to close-after-delete, and operations that 8762306a36Sopenharmony_ci * change the size of a file (such operations can often be the 8862306a36Sopenharmony_ci * source of data corruption if applications aren't using file 8962306a36Sopenharmony_ci * locking properly). 9062306a36Sopenharmony_ci */ 9162306a36Sopenharmony_cienum nfs_stat_eventcounters { 9262306a36Sopenharmony_ci NFSIOS_INODEREVALIDATE = 0, 9362306a36Sopenharmony_ci NFSIOS_DENTRYREVALIDATE, 9462306a36Sopenharmony_ci NFSIOS_DATAINVALIDATE, 9562306a36Sopenharmony_ci NFSIOS_ATTRINVALIDATE, 9662306a36Sopenharmony_ci NFSIOS_VFSOPEN, 9762306a36Sopenharmony_ci NFSIOS_VFSLOOKUP, 9862306a36Sopenharmony_ci NFSIOS_VFSACCESS, 9962306a36Sopenharmony_ci NFSIOS_VFSUPDATEPAGE, 10062306a36Sopenharmony_ci NFSIOS_VFSREADPAGE, 10162306a36Sopenharmony_ci NFSIOS_VFSREADPAGES, 10262306a36Sopenharmony_ci NFSIOS_VFSWRITEPAGE, 10362306a36Sopenharmony_ci NFSIOS_VFSWRITEPAGES, 10462306a36Sopenharmony_ci NFSIOS_VFSGETDENTS, 10562306a36Sopenharmony_ci NFSIOS_VFSSETATTR, 10662306a36Sopenharmony_ci NFSIOS_VFSFLUSH, 10762306a36Sopenharmony_ci NFSIOS_VFSFSYNC, 10862306a36Sopenharmony_ci NFSIOS_VFSLOCK, 10962306a36Sopenharmony_ci NFSIOS_VFSRELEASE, 11062306a36Sopenharmony_ci NFSIOS_CONGESTIONWAIT, 11162306a36Sopenharmony_ci NFSIOS_SETATTRTRUNC, 11262306a36Sopenharmony_ci NFSIOS_EXTENDWRITE, 11362306a36Sopenharmony_ci NFSIOS_SILLYRENAME, 11462306a36Sopenharmony_ci NFSIOS_SHORTREAD, 11562306a36Sopenharmony_ci NFSIOS_SHORTWRITE, 11662306a36Sopenharmony_ci NFSIOS_DELAY, 11762306a36Sopenharmony_ci NFSIOS_PNFS_READ, 11862306a36Sopenharmony_ci NFSIOS_PNFS_WRITE, 11962306a36Sopenharmony_ci __NFSIOS_COUNTSMAX, 12062306a36Sopenharmony_ci}; 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci#endif /* _LINUX_NFS_IOSTAT */ 123