summaryrefslogtreecommitdiff
path: root/bcache-super-show.c
diff options
context:
space:
mode:
authorGabriel <g2p.code@gmail.com>2013-05-01 17:12:57 +0200
committerGabriel <g2p.code@gmail.com>2013-05-08 09:40:46 +0200
commit19d17f5b918a7ad388c65323688b15bf65b6aa84 (patch)
tree1185bc2614f3f2ce4e37e1734ad30e38bcc2fa8c /bcache-super-show.c
parent9cbe774be28192963f2e02ecf9443d725e854f41 (diff)
super-show: show more cache-related information
Only show nbuckets and nr_this_dev on cache devices; explain nbuckets' relation to device size by printing both total_sectors (superblock included) and cache_sectors (superblock excluded).
Diffstat (limited to 'bcache-super-show.c')
-rw-r--r--bcache-super-show.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/bcache-super-show.c b/bcache-super-show.c
index 7ebb395..d5cfb4b 100644
--- a/bcache-super-show.c
+++ b/bcache-super-show.c
@@ -121,21 +121,22 @@ int main(int argc, char **argv)
printf("dev.uuid\t\t%s\n", uuid);
printf("dev.sectors_per_block\t%u\n"
- "dev.sectors_per_bucket\t%u\n"
- "dev.bucket_count\t%ju\n"
- "dev.cache_count\t\t%u\n", // expect SB_IS_BDEV(&sb) ? 0 : 1
+ "dev.sectors_per_bucket\t%u\n",
sb.block_size,
- sb.bucket_size,
- sb.nbuckets,
- sb.nr_this_dev);
+ sb.bucket_size);
if (!SB_IS_BDEV(&sb)) {
- printf("dev.cache.first_bucket\t%u\n"
- "dev.cache.first_sector\t%u\n"
- "dev.cache.discard\t%s\n",
- sb.first_bucket,
+ // total_sectors includes the superblock;
+ printf("dev.cache.first_sector\t%u\n"
+ "dev.cache.cache_sectors\t%ju\n"
+ "dev.cache.total_sectors\t%ju\n"
+ "dev.cache.discard\t%s\n"
+ "dev.cache.pos\t\t%u\n",
sb.bucket_size * sb.first_bucket,
- CACHE_DISCARD(&sb) ? "yes" : "no");
+ sb.bucket_size * (sb.nbuckets - sb.first_bucket),
+ sb.bucket_size * sb.nbuckets,
+ CACHE_DISCARD(&sb) ? "yes" : "no",
+ sb.nr_this_dev);
} else if (sb.version == BCACHE_SB_VERSION_BDEV) {
printf("dev.data.first_sector\t%u\n"
"dev.data.writeback\t%s\n",