Whamcloud - gitweb
LU-6215 lprocfs: handle seq_printf api change
[fs/lustre-release.git] / libcfs / libcfs / hash.c
index 559fc06..5027359 100644 (file)
@@ -2039,13 +2039,10 @@ void cfs_hash_rehash_key(struct cfs_hash *hs, const void *old_key,
 }
 EXPORT_SYMBOL(cfs_hash_rehash_key);
 
-int cfs_hash_debug_header(struct seq_file *m)
+void cfs_hash_debug_header(struct seq_file *m)
 {
-       return seq_printf(m, "%-*s%6s%6s%6s%6s%6s%6s%6s%7s%8s%8s%8s%s\n",
-                       CFS_HASH_BIGNAME_LEN,
-                       "name", "cur", "min", "max", "theta", "t-min", "t-max",
-                       "flags", "rehash", "count", "maxdep", "maxdepb",
-                       " distribution");
+       seq_printf(m, "%-*s   cur   min   max theta t-min t-max flags rehash   count  maxdep maxdepb distribution\n",
+                  CFS_HASH_BIGNAME_LEN, "name");
 }
 EXPORT_SYMBOL(cfs_hash_debug_header);
 
@@ -2073,31 +2070,28 @@ cfs_hash_full_nbkt(struct cfs_hash *hs)
                CFS_HASH_RH_NBKT(hs) : CFS_HASH_NBKT(hs);
 }
 
-int cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m)
+void cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m)
 {
-       int     dist[8] = { 0, };
-       int     maxdep  = -1;
-       int     maxdepb = -1;
-       int     total   = 0;
-       int     c       = 0;
-       int     theta;
-       int     i;
+       int dist[8] = { 0, };
+       int maxdep = -1;
+       int maxdepb = -1;
+       int total = 0;
+       int theta;
+       int i;
 
        cfs_hash_lock(hs, 0);
        theta = __cfs_hash_theta(hs);
 
-       c += seq_printf(m, "%-*s ", CFS_HASH_BIGNAME_LEN, hs->hs_name);
-       c += seq_printf(m, "%5d ",  1 << hs->hs_cur_bits);
-       c += seq_printf(m, "%5d ",  1 << hs->hs_min_bits);
-       c += seq_printf(m, "%5d ",  1 << hs->hs_max_bits);
-       c += seq_printf(m, "%d.%03d ", __cfs_hash_theta_int(theta),
-                       __cfs_hash_theta_frac(theta));
-       c += seq_printf(m, "%d.%03d ", __cfs_hash_theta_int(hs->hs_min_theta),
-                       __cfs_hash_theta_frac(hs->hs_min_theta));
-       c += seq_printf(m, "%d.%03d ", __cfs_hash_theta_int(hs->hs_max_theta),
-                       __cfs_hash_theta_frac(hs->hs_max_theta));
-       c += seq_printf(m, " 0x%02x ", hs->hs_flags);
-       c += seq_printf(m, "%6d ", hs->hs_rehash_count);
+       seq_printf(m, "%-*s %5d %5d %5d %d.%03d %d.%03d %d.%03d  0x%02x %6d ",
+                  CFS_HASH_BIGNAME_LEN, hs->hs_name,
+                  1 << hs->hs_cur_bits, 1 << hs->hs_min_bits,
+                  1 << hs->hs_max_bits,
+                  __cfs_hash_theta_int(theta), __cfs_hash_theta_frac(theta),
+                  __cfs_hash_theta_int(hs->hs_min_theta),
+                  __cfs_hash_theta_frac(hs->hs_min_theta),
+                  __cfs_hash_theta_int(hs->hs_max_theta),
+                  __cfs_hash_theta_frac(hs->hs_max_theta),
+                  hs->hs_flags, hs->hs_rehash_count);
 
        /*
         * The distribution is a summary of the chained hash depth in
@@ -2122,17 +2116,14 @@ int cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m)
                        maxdepb = ffz(~maxdep);
                }
                total += bd.bd_bucket->hsb_count;
-               dist[min(fls(bd.bd_bucket->hsb_count/max(theta,1)),7)]++;
+               dist[min(fls(bd.bd_bucket->hsb_count / max(theta, 1)), 7)]++;
                cfs_hash_bd_unlock(hs, &bd, 0);
        }
 
-       c += seq_printf(m, "%7d ", total);
-       c += seq_printf(m, "%7d ", maxdep);
-       c += seq_printf(m, "%7d ", maxdepb);
+       seq_printf(m, "%7d %7d %7d ", total, maxdep, maxdepb);
        for (i = 0; i < 8; i++)
-               c += seq_printf(m, "%d%c",  dist[i], (i == 7) ? '\n' : '/');
+               seq_printf(m, "%d%c",  dist[i], (i == 7) ? '\n' : '/');
 
        cfs_hash_unlock(hs, 0);
-       return c;
 }
 EXPORT_SYMBOL(cfs_hash_debug_str);