[sheepdog] [PATCH v10 12/19] dog: print status of generational reference of inodes in dump-inode
Hitoshi Mitake
mitake.hitoshi at gmail.com
Mon Jun 2 17:09:06 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>
Tested-by: Valerio Pachera <sirio81 at gmail.com>
Cc: Alessandro Bolgia <alessandro at extensys.it>
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 5f7a4a8..406844d 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -2380,7 +2380,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;
@@ -2388,6 +2388,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