]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Trivial change to allow cache debugging options to be more easily enabled.
authorNathan Scott <nathans@sgi.com>
Sat, 17 Jun 2006 06:13:53 +0000 (06:13 +0000)
committerNathan Scott <nathans@sgi.com>
Sat, 17 Jun 2006 06:13:53 +0000 (06:13 +0000)
Merge of master-melb:xfs-cmds:26271a by kenmcd.

libxfs/cache.c

index 72d8d50f91b260b32b05e087ad64919a8454d4b2..81e1cb27694a017be3e7a696ad6153dbd020eeb8 100644 (file)
 #include <xfs/cache.h>
 
 #define CACHE_DEBUG 1
+#undef CACHE_DEBUG
+#define CACHE_DEBUG 1
+#undef CACHE_ABORT
+/* #define CACHE_ABORT 1 */
 #define        HASH_CACHE_RATIO        8
 
 static unsigned int cache_generic_bulkrelse(struct cache *, struct list_head *);
@@ -90,6 +94,12 @@ cache_walk(
        }
 }
 
+#ifdef CACHE_ABORT
+#define cache_abort()  abort()
+#else
+#define cache_abort()  do { } while (0)
+#endif
+
 #ifdef CACHE_DEBUG
 static void
 cache_zero_check(
@@ -98,7 +108,7 @@ cache_zero_check(
        if (node->cn_count > 0) {
                fprintf(stderr, "%s: refcount is %u, not zero (node=%p)\n",
                        __FUNCTION__, node->cn_count, node);
-               /* abort(); */
+               cache_abort();
        }
 }
 #define cache_destroy_check(c) cache_walk((c), cache_zero_check)
@@ -354,7 +364,7 @@ cache_node_put(
        if (node->cn_count < 1) {
                fprintf(stderr, "%s: node put on refcount %u (node=%p)\n",
                                __FUNCTION__, node->cn_count, node);
-               /* abort(); */
+               cache_abort();
        }
 #endif
        node->cn_count--;
@@ -382,12 +392,12 @@ cache_node_purge(
        if (refcount >= 1) {
                fprintf(stderr, "%s: refcount was %u, not zero (node=%p)\n",
                                __FUNCTION__, refcount, node);
-               /* abort(); */
+               cache_abort();
        }
        if (refcount == -1) {
                fprintf(stderr, "%s: purge node not found! (node=%p)\n",
                        __FUNCTION__, node);
-               /* abort(); */
+               cache_abort();
        }
 #endif
        return (refcount == 0);
@@ -409,7 +419,7 @@ cache_purge(
        if (cache->c_count != 0) {
                fprintf(stderr, "%s: shake on cache %p left %u nodes!?\n",
                                __FUNCTION__, cache, cache->c_count);
-               /* abort(); */
+               cache_abort();
        }
 #endif
 }