nfs_iostat.h 4.2 KB

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