From: Hitoshi Mitake <mitake.hito...@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.kazut...@lab.ntt.co.jp> Tested-by: Valerio Pachera <siri...@gmail.com> Cc: Alessandro Bolgia <alessan...@extensys.it> Signed-off-by: Hitoshi Mitake <mitake.hito...@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 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog