]> git.proxmox.com Git - mirror_spl.git/blobdiff - module/splat/splat-kmem.c
Add KMC_SLAB cache type
[mirror_spl.git] / module / splat / splat-kmem.c
index 25a52b43dfd75a8e482ce7e78765343329aa7c78..4d060c138bb0b276b2445770360d75ed07cf87c0 100644 (file)
@@ -394,18 +394,25 @@ splat_kmem_cache_test_debug(struct file *file, char *name,
 {
        int j;
 
-       splat_vprint(file, name,
-                    "%s cache objects %d, slabs %u/%u objs %u/%u mags ",
-                    kcp->kcp_cache->skc_name, kcp->kcp_count,
+       splat_vprint(file, name, "%s cache objects %d",
+            kcp->kcp_cache->skc_name, kcp->kcp_count);
+
+       if (kcp->kcp_cache->skc_flags & (KMC_KMEM | KMC_VMEM)) {
+               splat_vprint(file, name, ", slabs %u/%u objs %u/%u",
                     (unsigned)kcp->kcp_cache->skc_slab_alloc,
                     (unsigned)kcp->kcp_cache->skc_slab_total,
                     (unsigned)kcp->kcp_cache->skc_obj_alloc,
                     (unsigned)kcp->kcp_cache->skc_obj_total);
 
-       for_each_online_cpu(j)
-               splat_print(file, "%u/%u ",
-                            kcp->kcp_cache->skc_mag[j]->skm_avail,
-                            kcp->kcp_cache->skc_mag[j]->skm_size);
+               if (!(kcp->kcp_cache->skc_flags & KMC_NOMAGAZINE)) {
+                       splat_vprint(file, name, "%s", "mags");
+
+                       for_each_online_cpu(j)
+                               splat_print(file, "%u/%u ",
+                                    kcp->kcp_cache->skc_mag[j]->skm_avail,
+                                    kcp->kcp_cache->skc_mag[j]->skm_size);
+               }
+       }
 
        splat_print(file, "%s\n", "");
 }
@@ -900,14 +907,14 @@ splat_kmem_test8(struct file *file, void *arg)
                kmem_cache_reap_now(kcp->kcp_cache);
                splat_kmem_cache_test_debug(file, SPLAT_KMEM_TEST8_NAME, kcp);
 
-               if (kcp->kcp_cache->skc_obj_total == 0)
+               if (kcp->kcp_count == 0)
                        break;
 
                set_current_state(TASK_INTERRUPTIBLE);
                schedule_timeout(HZ / 10);
        }
 
-       if (kcp->kcp_cache->skc_obj_total == 0) {
+       if (kcp->kcp_count == 0) {
                splat_vprint(file, SPLAT_KMEM_TEST8_NAME,
                        "Successfully created %d objects "
                        "in cache %s and reclaimed them\n",
@@ -915,7 +922,7 @@ splat_kmem_test8(struct file *file, void *arg)
        } else {
                splat_vprint(file, SPLAT_KMEM_TEST8_NAME,
                        "Failed to reclaim %u/%d objects from cache %s\n",
-                       (unsigned)kcp->kcp_cache->skc_obj_total,
+                       (unsigned)kcp->kcp_count,
                        SPLAT_KMEM_OBJ_COUNT, SPLAT_KMEM_CACHE_NAME);
                rc = -ENOMEM;
        }
@@ -995,14 +1002,14 @@ splat_kmem_test9(struct file *file, void *arg)
        for (i = 0; i < 60; i++) {
                splat_kmem_cache_test_debug(file, SPLAT_KMEM_TEST9_NAME, kcp);
 
-               if (kcp->kcp_cache->skc_obj_total == 0)
+               if (kcp->kcp_count == 0)
                        break;
 
                set_current_state(TASK_INTERRUPTIBLE);
                schedule_timeout(HZ);
        }
 
-       if (kcp->kcp_cache->skc_obj_total == 0) {
+       if (kcp->kcp_count == 0) {
                splat_vprint(file, SPLAT_KMEM_TEST9_NAME,
                        "Successfully created %d objects "
                        "in cache %s and reclaimed them\n",
@@ -1010,7 +1017,7 @@ splat_kmem_test9(struct file *file, void *arg)
        } else {
                splat_vprint(file, SPLAT_KMEM_TEST9_NAME,
                        "Failed to reclaim %u/%d objects from cache %s\n",
-                       (unsigned)kcp->kcp_cache->skc_obj_total, count,
+                       (unsigned)kcp->kcp_count, count,
                        SPLAT_KMEM_CACHE_NAME);
                rc = -ENOMEM;
        }