From: Sebastien Godard Date: Thu, 5 May 2011 11:47:46 +0000 (+0200) Subject: cifsiostat didn't count open files from the "Posix Open" column in X-Git-Tag: v10.0.1~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=23feafdd0be1ad389abfc420fbbc52de869e0163;p=sysstat cifsiostat didn't count open files from the "Posix Open" column in /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 --- diff --git a/CHANGES b/CHANGES index 85326a3..8345058 100644 --- a/CHANGES +++ b/CHANGES @@ -1,12 +1,15 @@ Changes: xxxx/xx/xx: Version 10.0.1 - Sebastien Godard (sysstat 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 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. diff --git a/cifsiostat.c b/cifsiostat.c index e03e839..3cf8cc0 100644 --- a/cifsiostat.c +++ b/cifsiostat.c @@ -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); }