Re: [PATCH v2 1/1] nfsiostat: Handle both readahead counts for statsver >= 1.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 10/9/21 8:27 AM, Dave Wysochanski wrote:
Subject:
[PATCH v2 1/1] nfsiostat: Handle both readahead counts for statsver >= 1.2
From:
Dave Wysochanski <dwysocha@xxxxxxxxxx>
Date:
10/9/21, 8:27 AM

To:
chuck.lever@xxxxxxxxxx, steved@xxxxxxxxxx
CC:
linux-nfs@xxxxxxxxxxxxxxx


Later kernel versions convert NFS readpages to readahead so update
the counts accordingly.

Signed-off-by: Dave Wysochanski<dwysocha@xxxxxxxxxx>
Committed...

steved
---
  tools/nfs-iostat/nfs-iostat.py | 15 +++++++++------
  1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
index 1df74ba822b5..85294fb9448c 100755
--- a/tools/nfs-iostat/nfs-iostat.py
+++ b/tools/nfs-iostat/nfs-iostat.py
@@ -43,7 +43,7 @@ NfsEventCounters = [
      'vfspermission',
      'vfsupdatepage',
      'vfsreadpage',
-    'vfsreadpages',
+    'vfsreadpages', # or vfsreadahead in statvers=1.2 or above
      'vfswritepage',
      'vfswritepages',
      'vfsreaddir',
@@ -86,14 +86,14 @@ class DeviceData:
              self.__nfs_data['export'] = words[1]
              self.__nfs_data['mountpoint'] = words[4]
              self.__nfs_data['fstype'] = words[7]
-            if words[7] == 'nfs':
-                self.__nfs_data['statvers'] = words[8]
+            if words[7] == 'nfs' or words[7] == 'nfs4':
+                self.__nfs_data['statvers'] = float(words[8].split('=',1)[1])
          elif 'nfs' in words or 'nfs4' in words:
              self.__nfs_data['export'] = words[0]
              self.__nfs_data['mountpoint'] = words[3]
              self.__nfs_data['fstype'] = words[6]
              if words[6] == 'nfs':
-                self.__nfs_data['statvers'] = words[7]
+                self.__nfs_data['statvers'] = float(words[7].split('=',1)[1])
          elif words[0] == 'age:':
              self.__nfs_data['age'] = int(words[1])
          elif words[0] == 'opts:':
@@ -294,8 +294,11 @@ class DeviceData:
          print()
          print('%d nfs_readpage() calls read %d pages' % \
              (vfsreadpage, vfsreadpage))
-        print('%d nfs_readpages() calls read %d pages' % \
-            (vfsreadpages, pages_read - vfsreadpage))
+        multipageread = "readpages"
+        if self.__nfs_data['statvers'] >= 1.2:
+            multipageread = "readahead"
+        print('%d nfs_%s() calls read %d pages' % \
+            (vfsreadpages, multipageread, pages_read - vfsreadpage))
          if vfsreadpages != 0:
              print('(%.1f pages per call)' % \
                  (float(pages_read - vfsreadpage) / vfsreadpages))
-- 1.8.3.1





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux