summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/mem-pool.h
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/mem-pool.h')
-rw-r--r--libglusterfs/src/mem-pool.h30
1 files changed, 19 insertions, 11 deletions
diff --git a/libglusterfs/src/mem-pool.h b/libglusterfs/src/mem-pool.h
index 81fb579a0ab..5115cef9f93 100644
--- a/libglusterfs/src/mem-pool.h
+++ b/libglusterfs/src/mem-pool.h
@@ -36,11 +36,6 @@
#define GF_MEM_TRAILER_MAGIC 0xBAADF00D
#define GF_MEM_INVALID_MAGIC 0xDEADC0DE
-struct mem_acct {
- uint32_t num_types;
- struct mem_acct_rec *rec;
-};
-
struct mem_acct_rec {
const char *typestr;
size_t size;
@@ -51,12 +46,25 @@ struct mem_acct_rec {
gf_lock_t lock;
};
+struct mem_acct {
+ uint32_t num_types;
+ /*
+ * The lock is only used on ancient platforms (e.g. RHEL5) to keep
+ * refcnt increment/decrement atomic. We could even make its existence
+ * conditional on the right set of version/feature checks, but it's so
+ * lightweight that it's not worth the obfuscation.
+ */
+ gf_lock_t lock;
+ unsigned int refcnt;
+ struct mem_acct_rec rec[0];
+};
+
struct mem_header {
- uint32_t type;
- size_t size;
- void *xlator;
- uint32_t magic;
- int padding[8];
+ uint32_t type;
+ size_t size;
+ struct mem_acct *mem_acct;
+ uint32_t magic;
+ int padding[8];
};
#define GF_MEM_HEADER_SIZE (sizeof (struct mem_header))
@@ -64,7 +72,7 @@ struct mem_header {
#ifdef DEBUG
struct mem_invalid {
uint32_t magic;
- void *xlator;
+ void *mem_acct;
uint32_t type;
size_t size;
void *baseaddr;