diff mbox

[3/4] bcache-tools: print more super block information in bcache-super-show

Message ID 20180315104240.24647-4-colyli@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Coly Li March 15, 2018, 10:42 a.m. UTC
This patch prints out more super block information. The more
detailed and exact information is helpful to analyse and debug
cache device and backing device states.

Signed-off-by: Coly Li <colyli@suse.de>
---
 bcache-super-show.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff mbox

Patch

diff --git a/bcache-super-show.c b/bcache-super-show.c
index 515c596..2d46cac 100644
--- a/bcache-super-show.c
+++ b/bcache-super-show.c
@@ -131,12 +131,18 @@  int main(int argc, char **argv)
 		case BCACHE_SB_VERSION_CDEV:
 		case BCACHE_SB_VERSION_CDEV_WITH_UUID:
 			printf(" [cache device]\n");
+			printf("sb.nbuckets\t\t%" PRIu64 "\n", sb.nbuckets);
+			printf("sb.bucket_size\t\t%d\n", sb.bucket_size);
+			printf("sb.nr_in_set\t\t%d\n", sb.nr_in_set);
+			printf("sb.nr_this_dev\t\t%d\n", sb.nr_this_dev);
 			break;
 
 		// The second adds data offset support
 		case BCACHE_SB_VERSION_BDEV:
 		case BCACHE_SB_VERSION_BDEV_WITH_OFFSET:
 			printf(" [backing device]\n");
+			printf("sb.data_offset\t\t%" PRIu64 "\n",
+			       sb.data_offset);
 			break;
 
 		default:
@@ -145,6 +151,14 @@  int main(int argc, char **argv)
 			return 0;
 	}
 
+	printf("sb.block_size\t\t%d\n", sb.block_size);
+	printf("sb.offset\t\t%" PRIu64 "\n", sb.offset);
+	printf("sb.flags\t\t%" PRIx64 "\n", sb.flags);
+	printf("sb.seq\t\t\t%" PRIu64 "\n", sb.seq);
+	printf("sb.last_mount\t\t%" PRIu32 "\n", sb.last_mount);
+	printf("sb.first_bucket\t\t%d\n", sb.first_bucket);
+	printf("sb.keys\t\t\t%d\n", sb.keys);
+
 	putchar('\n');
 
 	char label[SB_LABEL_SIZE + 1];