[sheepdog] [PATCH v9 12/19] dog: print status of generational reference of inodes in dump-inode

Hitoshi Mitake mitake.hitoshi at gmail.com
Thu May 22 16:30:30 CEST 2014


From: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>

This patch lets "dog vdi object dump-inode" print status of
generational reference.

Example of output:
name: test
tag:
create_time: 53704f51349aa108
snap_ctime: 0
vm_clock_nsec: 0
copy_policy: 0
store_policy: 0
nr_copies: 3
block_size_shift: 22
snap_id: 2
vdi_id: 7c2b26
parent_vdi_id: 7c2b25
btree_counter: 0
data_vdi_id:
0: 8137509
gref:
1: 0

Cc: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
Cc: Alessandro Bolgia <alessandro at extensys.it>
Tested-by: Valerio Pachera <sirio81 at gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 dog/vdi.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/dog/vdi.c b/dog/vdi.c
index ce16839..0256d08 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -2371,7 +2371,7 @@ static int vdi_object_dump_inode(int argc, char **argv)
 	printf("parent_vdi_id: %"PRIx32"\n", inode->parent_vdi_id);
 	printf("btree_counter: %"PRIu32"\n", inode->btree_counter);
 
-	printf("data_vdi_id:");
+	printf("data_vdi_id:\n");
 	for (int i = 0; i < SD_INODE_DATA_INDEX; i++) {
 		if (!inode->data_vdi_id[i])
 			continue;
@@ -2379,6 +2379,22 @@ static int vdi_object_dump_inode(int argc, char **argv)
 		printf("%d: %"PRIu32"\n", i, inode->data_vdi_id[i]);
 	}
 
+	printf("gref:\n");
+	for (int i = 0; i < SD_INODE_DATA_INDEX; i++) {
+		if (!inode->data_vdi_id[i]) {
+			if (inode->gref[i].generation || inode->gref[i].count)
+				printf("WARNING: index %d doesn't have data vdi"
+				       " ID but its generation and count is not"
+				       " zero(%d, %d)", i,
+				       inode->gref[i].generation,
+				       inode->gref[i].count);
+			continue;
+		}
+
+		printf("%d: %"PRIx32", %d, %d\n", i, inode->data_vdi_id[i],
+		       inode->gref[i].generation, inode->gref[i].count);
+	}
+
 	close(fd);
 	return EXIT_SUCCESS;
 }
-- 
1.9.1




More information about the sheepdog mailing list