]> mj.ucw.cz Git - libucw.git/commitdiff
Mempool: Do not count the struct mempool to its stats.used_size.
authorPavel Charvat <pchar@ucw.cz>
Wed, 28 May 2014 11:08:22 +0000 (13:08 +0200)
committerPavel Charvat <pchar@ucw.cz>
Wed, 28 May 2014 11:08:22 +0000 (13:08 +0200)
ucw/mempool.c

index 1048686f6801f98a11773e61dd0a1fadc9568905..a66615ab79a05dd3dca005eac2ca8fc01f3adbf1 100644 (file)
@@ -221,7 +221,8 @@ mp_stats(struct mempool *pool, struct mempool_stats *stats)
   ASSERT(stats->total_size == pool->total_size);
   stats->used_size = stats->chain_size[0] + stats->chain_size[1]
     - MP_CHUNK_TAIL * (stats->chain_count[0] + stats->chain_count[1])
-    - pool->state.free[0] - pool->state.free[1];
+    - pool->state.free[0] - pool->state.free[1] - sizeof(*pool);
+  ASSERT(stats->used_size < stats->total_size);
 }
 
 u64