summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Wysochanski <dwysocha@redhat.com>2022-10-24 13:41:06 -0400
committerSteve Dickson <steved@redhat.com>2022-10-24 13:41:06 -0400
commit66ed48f9a4db3e8dea875dd8a4cc8a2af718a301 (patch)
tree086536564bf8c368bda2a644f8ec09755164791f
parentea536a2e641664c8ea439e5e571e757785f587c9 (diff)
downloadnfs-utils-66ed48f9a4db3e8dea875dd8a4cc8a2af718a301.tar.gz
nfsiostat: Handle both readahead counts for statsver >= 1.2
Later kernel versions convert NFS readpages to readahead so update the counts accordingly. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
-rwxr-xr-xtools/nfs-iostat/nfs-iostat.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
index 1df74ba..85294fb 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))