]> granicus.if.org Git - sysstat/commitdiff
cifsiostat didn't count open files from the "Posix Open" column in
authorSebastien Godard <sysstat@orange.fr>
Thu, 5 May 2011 11:47:46 +0000 (13:47 +0200)
committerSebastien Godard <sysstat@orange.fr>
Thu, 5 May 2011 11:47:46 +0000 (13:47 +0200)
/proc/fs/cifs/Stats file. This is now fixed.

Mail from Ivana Varekova (varekova@redhat.com) 02/05/2011
Subject: feature request: Resizing device column in iostat to size of larges lvm device name

Hello,
I'm sending three patches against sysstat-10.0.0:
[...]
* sysstat_3.patch
  fixes cifsiostat tool which in open files does not count files which are in /proc/fs/cifs/Stats output in column "Posix Open"

If you need a clarification to arbitrary of them please sent me an e-mail.
Ivana

CHANGES
cifsiostat.c

diff --git a/CHANGES b/CHANGES
index 85326a3e3f4674eaa932fb901f37c9ff5dc0ce77..8345058a11752057049b650b42132e2d8ec3fb11 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,12 +1,15 @@
 Changes:
 
 xxxx/xx/xx: Version 10.0.1 - Sebastien Godard (sysstat <at> orange.fr)
+       * [Ivana Varekova]: cifsiostat didn't count open files from the
+         "Posix Open" column in /proc/fs/cifs/Stats file. This is now
+         fixed.
        * [Ivana Varekova]: Close file descriptor in read_uptime()
          function (file rd_stats.c).
        * NLS updated. Esperanto translation added.
 
 2011/03/15: Version 10.0.0 - Sebastien Godard (sysstat <at> orange.fr)
-       * [Ivana Varekova]: Fix a problem with long NFS and CIFS share
+       * [Ivana Varekova]: Fixed a problem with long NFS and CIFS share
          names in cifsiostat and nfsiostat.
        * [Ivana Varekova]: Added the possibility to extend the number
          of slots for NFS and CIFS mount points on the fly.
index e03e839563a78a187976a42c96cd9d21b8a7fa6c..3cf8cc015a3fd4b7df49af3a3becd15bd1460724 100644 (file)
@@ -319,6 +319,8 @@ void read_cifs_stat(int curr)
        char line[256];
        char aux[32];
        int start = 0;
+       long long unsigned aux_open;
+       long long unsigned all_open = 0;
        char cifs_name[MAX_NAME_LEN];
        char name_tmp[MAX_NAME_LEN];
        struct cifs_stats scifs;
@@ -337,7 +339,9 @@ void read_cifs_stat(int curr)
                /* Read CIFS directory name */
                if (isdigit((unsigned char) line[0]) && sscanf(line, aux , name_tmp) == 1) {
                        if (start) {
+                               scifs.fopens = all_open;
                                save_stats(cifs_name, curr, &scifs);
+                               all_open = 0;
                        }
                        else {
                                start = 1;
@@ -353,12 +357,18 @@ void read_cifs_stat(int curr)
                        }
                        if (!strncmp(line, "Opens:", 6)) {
                                sscanf(line, "Opens: %llu Closes:%llu Deletes: %llu",
-                                      &scifs.fopens, &scifs.fcloses, &scifs.fdeletes);
+                                      &aux_open, &scifs.fcloses, &scifs.fdeletes);
+                               all_open += aux_open;
+                       }
+                       if (!strncmp(line, "Posix Opens:", 12)) {
+                               sscanf(line, "Posix Opens: %llu", &aux_open);
+                               all_open += aux_open;
                        }
                }
        }
        
        if (start) {
+               scifs.fopens = all_open;
                save_stats(cifs_name, curr, &scifs);
        }