]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs-top: fix the rsp/wsp display 47647/head
authorJos Collin <jcollin@redhat.com>
Thu, 14 Jul 2022 11:49:40 +0000 (17:19 +0530)
committerJos Collin <jcollin@redhat.com>
Wed, 17 Aug 2022 08:21:40 +0000 (13:51 +0530)
Fixes: https://tracker.ceph.com/issues/56537
Signed-off-by: Jos Collin <jcollin@redhat.com>
(cherry picked from commit 26c7eb36e2f0c5769f7c9971042e92b25eabc4f2)

src/tools/cephfs/top/cephfs-top

index 9a9161024baf8fb86cea17152d5f3bb8663db792..7175768b9bf7e51040109af854cbe90407e8a361 100755 (executable)
@@ -362,7 +362,6 @@ class FSTop(object):
                 return
 
         cidx = 0
-        client_id = x_coord_map[FS_TOP_MAIN_WINDOW_COL_CLIENT_ID]
         for item in counters:
             coord = x_coord_map[item]
             hlen = coord[1] - len(ITEMS_PAD)
@@ -410,18 +409,21 @@ class FSTop(object):
                         remaining_hlen = 0
                     else:
                         remaining_hlen -= coord[1]
+                    size = 0
                     if key == "READ_IO_SIZES":
-                        global last_read_size
-                        last_size = last_read_size.get(client_id, 0)
-                        size = m[1] - last_size
-                        last_read_size[client_id] = m[1]
+                        if m[1] > 0:
+                            global last_read_size
+                            last_size = last_read_size.get(client_id, 0)
+                            size = m[1] - last_size
+                            last_read_size[client_id] = m[1]
                     if key == "WRITE_IO_SIZES":
-                        global last_write_size
-                        last_size = last_write_size.get(client_id, 0)
-                        size = m[1] - last_size
-                        last_write_size[client_id] = m[1]
+                        if m[1] > 0:
+                            global last_write_size
+                            last_size = last_write_size.get(client_id, 0)
+                            size = m[1] - last_size
+                            last_write_size[client_id] = m[1]
                     self.mainw.addnstr(y_coord, coord[0],
-                                       f'{calc_speed(size, duration)}',
+                                       f'{calc_speed(abs(size), duration)}',
                                        hlen)
                 else:
                     # display 0th element from metric tuple