1 /* 2 * User-space visible declarations for NFS client per-mount 3 * point statistics 4 * 5 * Copyright (C) 2005, 2006 Chuck Lever <cel@netapp.com> 6 * 7 * NFS client per-mount statistics provide information about the 8 * health of the NFS client and the health of each NFS mount point. 9 * Generally these are not for detailed problem diagnosis, but 10 * simply to indicate that there is a problem. 11 * 12 * These counters are not meant to be human-readable, but are meant 13 * to be integrated into system monitoring tools such as "sar" and 14 * "iostat". As such, the counters are sampled by the tools over 15 * time, and are never zeroed after a file system is mounted. 16 * Moving averages can be computed by the tools by taking the 17 * difference between two instantaneous samples and dividing that 18 * by the time between the samples. 19 */ 20 21 #ifndef _LINUX_NFS_IOSTAT 22 #define _LINUX_NFS_IOSTAT 23 24 #define NFS_IOSTAT_VERS "1.1" 25 26 /* 27 * NFS byte counters 28 * 29 * 1. SERVER - the number of payload bytes read from or written 30 * to the server by the NFS client via an NFS READ or WRITE 31 * request. 32 * 33 * 2. NORMAL - the number of bytes read or written by applications 34 * via the read(2) and write(2) system call interfaces. 35 * 36 * 3. DIRECT - the number of bytes read or written from files 37 * opened with the O_DIRECT flag. 38 * 39 * These counters give a view of the data throughput into and out 40 * of the NFS client. Comparing the number of bytes requested by 41 * an application with the number of bytes the client requests from 42 * the server can provide an indication of client efficiency 43 * (per-op, cache hits, etc). 44 * 45 * These counters can also help characterize which access methods 46 * are in use. DIRECT by itself shows whether there is any O_DIRECT 47 * traffic. NORMAL + DIRECT shows how much data is going through 48 * the system call interface. A large amount of SERVER traffic 49 * without much NORMAL or DIRECT traffic shows that applications 50 * are using mapped files. 51 * 52 * NFS page counters 53 * 54 * These count the number of pages read or written via nfs_readpage(), 55 * nfs_readpages(), or their write equivalents. 56 * 57 * NB: When adding new byte counters, please include the measured 58 * units in the name of each byte counter to help users of this 59 * interface determine what exactly is being counted. 60 */ 61 enum nfs_stat_bytecounters { 62 NFSIOS_NORMALREADBYTES = 0, 63 NFSIOS_NORMALWRITTENBYTES, 64 NFSIOS_DIRECTREADBYTES, 65 NFSIOS_DIRECTWRITTENBYTES, 66 NFSIOS_SERVERREADBYTES, 67 NFSIOS_SERVERWRITTENBYTES, 68 NFSIOS_READPAGES, 69 NFSIOS_WRITEPAGES, 70 __NFSIOS_BYTESMAX, 71 }; 72 73 /* 74 * NFS event counters 75 * 76 * These counters provide a low-overhead way of monitoring client 77 * activity without enabling NFS trace debugging. The counters 78 * show the rate at which VFS requests are made, and how often the 79 * client invalidates its data and attribute caches. This allows 80 * system administrators to monitor such things as how close-to-open 81 * is working, and answer questions such as "why are there so many 82 * GETATTR requests on the wire?" 83 * 84 * They also count anamolous events such as short reads and writes, 85 * silly renames due to close-after-delete, and operations that 86 * change the size of a file (such operations can often be the 87 * source of data corruption if applications aren't using file 88 * locking properly). 89 */ 90 enum nfs_stat_eventcounters { 91 NFSIOS_INODEREVALIDATE = 0, 92 NFSIOS_DENTRYREVALIDATE, 93 NFSIOS_DATAINVALIDATE, 94 NFSIOS_ATTRINVALIDATE, 95 NFSIOS_VFSOPEN, 96 NFSIOS_VFSLOOKUP, 97 NFSIOS_VFSACCESS, 98 NFSIOS_VFSUPDATEPAGE, 99 NFSIOS_VFSREADPAGE, 100 NFSIOS_VFSREADPAGES, 101 NFSIOS_VFSWRITEPAGE, 102 NFSIOS_VFSWRITEPAGES, 103 NFSIOS_VFSGETDENTS, 104 NFSIOS_VFSSETATTR, 105 NFSIOS_VFSFLUSH, 106 NFSIOS_VFSFSYNC, 107 NFSIOS_VFSLOCK, 108 NFSIOS_VFSRELEASE, 109 NFSIOS_CONGESTIONWAIT, 110 NFSIOS_SETATTRTRUNC, 111 NFSIOS_EXTENDWRITE, 112 NFSIOS_SILLYRENAME, 113 NFSIOS_SHORTREAD, 114 NFSIOS_SHORTWRITE, 115 NFSIOS_DELAY, 116 NFSIOS_PNFS_READ, 117 NFSIOS_PNFS_WRITE, 118 __NFSIOS_COUNTSMAX, 119 }; 120 121 /* 122 * NFS local caching servicing counters 123 */ 124 enum nfs_stat_fscachecounters { 125 NFSIOS_FSCACHE_PAGES_READ_OK, 126 NFSIOS_FSCACHE_PAGES_READ_FAIL, 127 NFSIOS_FSCACHE_PAGES_WRITTEN_OK, 128 NFSIOS_FSCACHE_PAGES_WRITTEN_FAIL, 129 NFSIOS_FSCACHE_PAGES_UNCACHED, 130 __NFSIOS_FSCACHEMAX, 131 }; 132 133 #endif /* _LINUX_NFS_IOSTAT */ 134