aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2014-01-09 16:04:12 -0500
committerMike Snitzer <snitzer@redhat.com>2014-01-10 10:24:33 -0500
commit6a388618f120cdc70cd6b6dbcab5f7a4aff500f6 (patch)
tree6d71f28ac277c7dead29f10fc3bf7ada336a0c9d
parentf164e6900f2be2c29f5c11ca52af5bb824f40826 (diff)
dm cache: add block sizes and total cache blocks to status output
Improve cache_status to emit: <metadata block size> <#used metadata blocks>/<#total metadata blocks> <cache block size> <#used cache blocks>/<#total cache blocks> ... Adding the block sizes allows for easier calculation of the overall size of both the metadata and cache devices. Adding <#total cache blocks> provides useful context for how much of the cache is used. Unfortunately these additions to the status will require updates to users' scripts that monitor the cache status. But these changes help provide more comprehensive information about the cache device and will simplify tools that are being developed to manage dm-cache devices -- because they won't need to issue 3 operations to cobble together the information that we can easily provide via a single status ioctl. While updating the status documentation in cache.txt spaces were tabify'd. Requested-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Acked-by: Joe Thornber <ejt@redhat.com>
-rw-r--r--Documentation/device-mapper/cache.txt50
-rw-r--r--drivers/md/dm-cache-target.c16
2 files changed, 38 insertions, 28 deletions
diff --git a/Documentation/device-mapper/cache.txt b/Documentation/device-mapper/cache.txt
index 719320b5ed3f..63fd7cfa4cf1 100644
--- a/Documentation/device-mapper/cache.txt
+++ b/Documentation/device-mapper/cache.txt
@@ -217,36 +217,42 @@ the characteristics of a specific policy, always request it by name.
217Status 217Status
218------ 218------
219 219
220<#used metadata blocks>/<#total metadata blocks> <#read hits> <#read misses> 220<metadata block size> <#used metadata blocks>/<#total metadata blocks>
221<#write hits> <#write misses> <#demotions> <#promotions> <#blocks in cache> 221<cache block size> <#used cache blocks>/<#total cache blocks>
222<#dirty> <#features> <features>* <#core args> <core args>* <#policy args> 222<#read hits> <#read misses> <#write hits> <#write misses>
223<policy args>* 223<#demotions> <#promotions> <#dirty> <#features> <features>*
224 224<#core args> <core args>* <#policy args> <policy args>*
225#used metadata blocks : Number of metadata blocks used 225
226#total metadata blocks : Total number of metadata blocks 226metadata block size : Fixed block size for each metadata block in
227#read hits : Number of times a READ bio has been mapped 227 sectors
228#used metadata blocks : Number of metadata blocks used
229#total metadata blocks : Total number of metadata blocks
230cache block size : Configurable block size for the cache device
231 in sectors
232#used cache blocks : Number of blocks resident in the cache
233#total cache blocks : Total number of cache blocks
234#read hits : Number of times a READ bio has been mapped
228 to the cache 235 to the cache
229#read misses : Number of times a READ bio has been mapped 236#read misses : Number of times a READ bio has been mapped
230 to the origin 237 to the origin
231#write hits : Number of times a WRITE bio has been mapped 238#write hits : Number of times a WRITE bio has been mapped
232 to the cache 239 to the cache
233#write misses : Number of times a WRITE bio has been 240#write misses : Number of times a WRITE bio has been
234 mapped to the origin 241 mapped to the origin
235#demotions : Number of times a block has been removed 242#demotions : Number of times a block has been removed
236 from the cache 243 from the cache
237#promotions : Number of times a block has been moved to 244#promotions : Number of times a block has been moved to
238 the cache 245 the cache
239#blocks in cache : Number of blocks resident in the cache 246#dirty : Number of blocks in the cache that differ
240#dirty : Number of blocks in the cache that differ
241 from the origin 247 from the origin
242#feature args : Number of feature args to follow 248#feature args : Number of feature args to follow
243feature args : 'writethrough' (optional) 249feature args : 'writethrough' (optional)
244#core args : Number of core arguments (must be even) 250#core args : Number of core arguments (must be even)
245core args : Key/value pairs for tuning the core 251core args : Key/value pairs for tuning the core
246 e.g. migration_threshold 252 e.g. migration_threshold
247#policy args : Number of policy arguments to follow (must be even) 253#policy args : Number of policy arguments to follow (must be even)
248policy args : Key/value pairs 254policy args : Key/value pairs
249 e.g. 'sequential_threshold 1024 255 e.g. sequential_threshold
250 256
251Messages 257Messages
252-------- 258--------
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index 1b1469ebe5cb..11ad70540d40 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -2826,9 +2826,10 @@ static void cache_resume(struct dm_target *ti)
2826/* 2826/*
2827 * Status format: 2827 * Status format:
2828 * 2828 *
2829 * <#used metadata blocks>/<#total metadata blocks> 2829 * <metadata block size> <#used metadata blocks>/<#total metadata blocks>
2830 * <cache block size> <#used cache blocks>/<#total cache blocks>
2830 * <#read hits> <#read misses> <#write hits> <#write misses> 2831 * <#read hits> <#read misses> <#write hits> <#write misses>
2831 * <#demotions> <#promotions> <#blocks in cache> <#dirty> 2832 * <#demotions> <#promotions> <#dirty>
2832 * <#features> <features>* 2833 * <#features> <features>*
2833 * <#core args> <core args> 2834 * <#core args> <core args>
2834 * <#policy args> <policy args>* 2835 * <#policy args> <policy args>*
@@ -2869,17 +2870,20 @@ static void cache_status(struct dm_target *ti, status_type_t type,
2869 2870
2870 residency = policy_residency(cache->policy); 2871 residency = policy_residency(cache->policy);
2871 2872
2872 DMEMIT("%llu/%llu %u %u %u %u %u %u %llu %u ", 2873 DMEMIT("%u %llu/%llu %u %llu/%llu %u %u %u %u %u %u %llu ",
2874 (unsigned)(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT),
2873 (unsigned long long)(nr_blocks_metadata - nr_free_blocks_metadata), 2875 (unsigned long long)(nr_blocks_metadata - nr_free_blocks_metadata),
2874 (unsigned long long)nr_blocks_metadata, 2876 (unsigned long long)nr_blocks_metadata,
2877 cache->sectors_per_block,
2878 (unsigned long long) from_cblock(residency),
2879 (unsigned long long) from_cblock(cache->cache_size),
2875 (unsigned) atomic_read(&cache->stats.read_hit), 2880 (unsigned) atomic_read(&cache->stats.read_hit),
2876 (unsigned) atomic_read(&cache->stats.read_miss), 2881 (unsigned) atomic_read(&cache->stats.read_miss),
2877 (unsigned) atomic_read(&cache->stats.write_hit), 2882 (unsigned) atomic_read(&cache->stats.write_hit),
2878 (unsigned) atomic_read(&cache->stats.write_miss), 2883 (unsigned) atomic_read(&cache->stats.write_miss),
2879 (unsigned) atomic_read(&cache->stats.demotion), 2884 (unsigned) atomic_read(&cache->stats.demotion),
2880 (unsigned) atomic_read(&cache->stats.promotion), 2885 (unsigned) atomic_read(&cache->stats.promotion),
2881 (unsigned long long) from_cblock(residency), 2886 (unsigned long long) from_cblock(cache->nr_dirty));
2882 cache->nr_dirty);
2883 2887
2884 if (writethrough_mode(&cache->features)) 2888 if (writethrough_mode(&cache->features))
2885 DMEMIT("1 writethrough "); 2889 DMEMIT("1 writethrough ");
@@ -3129,7 +3133,7 @@ static void cache_io_hints(struct dm_target *ti, struct queue_limits *limits)
3129 3133
3130static struct target_type cache_target = { 3134static struct target_type cache_target = {
3131 .name = "cache", 3135 .name = "cache",
3132 .version = {1, 2, 0}, 3136 .version = {1, 3, 0},
3133 .module = THIS_MODULE, 3137 .module = THIS_MODULE,
3134 .ctr = cache_ctr, 3138 .ctr = cache_ctr,
3135 .dtr = cache_dtr, 3139 .dtr = cache_dtr,