Skip to contentSkip to conversation

master - cache: Add DM interface for retrieving a cache's status

PATCH Jonathan Brassow 1 participant 1 message Jan 27, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=df181cc51e32fb54dac6652574e303e93b51b8bd
Commit:        df181cc51e32fb54dac6652574e303e93b51b8bd
Parent:        1ff7e214e0cf0e7ef0280b71ab128e029172a1d9
Author:        Jonathan Brassow <[email protected]>
AuthorDate:    Mon Jan 27 05:30:10 2014 -0600
Committer:     Jonathan Brassow <[email protected]>
CommitterDate: Mon Jan 27 05:30:42 2014 -0600

cache: Add DM interface for retrieving a cache's status

This patch defines a structure for holding all of the device-mapper cache target's status information. The associated function provides an easy way for higher levels (LVM) to consume the information.

This patch finishes the device-mapper interface for the cache and cachepool segment types (i.e. the cache target).

---
 libdm/libdevmapper.h  |   35 ++++++++++++-
 libdm/libdm-deptree.c |  137 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 171 insertions(+), 1 deletions(-)
libdm/libdevmapper.h +34 -1
index ae9a91a..670c5e09 100644
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2013 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved.
  *
  * This file is part of the device-mapper userspace tools.
  *
@@ -294,6 +294,39 @@ struct dm_status_raid {
 int dm_get_status_raid(struct dm_pool *mem, const char *params,
 		       struct dm_status_raid **status);
 
+struct dm_status_cache {
+	uint64_t version;  /* zero for now */
+
+	uint32_t metadata_block_size;   /* in 512B sectors */
+	uint32_t block_size;            /* AKA 'chunk_size' */
+
+	uint64_t metadata_used_blocks;
+	uint64_t metadata_total_blocks;
+
+	uint64_t used_blocks;
+	uint64_t dirty_blocks;
+	uint64_t total_blocks;
+
+	uint64_t read_hits;
+	uint64_t read_misses;
+	uint64_t write_hits;
+	uint64_t write_misses;
+
+	uint64_t demotions;
+	uint64_t promotions;
+
+	uint32_t feature_flags;
+
+	int core_argc;
+	char **core_argv;
+
+	char *policy_name;
+	int   policy_argc;
+	char **policy_argv;
+};
+
+int dm_get_status_cache(struct dm_pool *mem, const char *params,
+			struct dm_status_cache **status);
 
 /*
  * Snapshot target's format:
libdm/libdm-deptree.c +137 -0

143 lines not on this page · raw message