From 00418cb41f744fdd67bd1ddcb1084d958b1c09af Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Sat, 17 Jun 2006 06:13:53 +0000 Subject: [PATCH] Trivial change to allow cache debugging options to be more easily enabled. Merge of master-melb:xfs-cmds:26271a by kenmcd. --- libxfs/cache.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/libxfs/cache.c b/libxfs/cache.c index 72d8d50f9..81e1cb276 100644 --- a/libxfs/cache.c +++ b/libxfs/cache.c @@ -27,6 +27,10 @@ #include #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 } -- 2.47.2