[sheepdog] [PATCH] collie: clean up and fix 'vdi track'

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Nov 26 11:02:48 CET 2012


At Sun, 25 Nov 2012 21:37:23 +0800,
Liu Yuan wrote:
> 
> On 11/25/2012 02:58 AM, MORITA Kazutaka wrote:
> > Instead of explicitly handling the case where # of nodes is less than
> > nr_copies, printing info from 0 to min(nr_copies,logs[i].nr_copies) is
> > simpler?
> 
> I don't think it work. The problem is, nids are from different places.

Can you explain it in more detail?  The following code looks simpler
and working correct.  What is the counter example where it doesn't
work?

        for (i = nr_logs - 1; i >= 0; i--) {
                printf("\nobj %"PRIx64" locations at epoch %d, copies = %d\n",
                       oid, logs[i].epoch, nr_copies);
                printf("---------------------------------------------------\n");

                vnodes_nr = nodes_to_vnodes(logs[i].nodes,
                                            logs[i].nr_nodes, vnodes);
                oid_to_vnodes(vnodes, vnodes_nr, oid, logs[i].nr_nodes, vnode_buf);
                for (j = 0; j < min((uint32_t)nr_copies, logs[i].nr_nodes); j++) {
                        addr_to_str(host, sizeof(host), vnode_buf[j]->nid.addr,
                                    vnode_buf[j]->nid.port);
                        printf("%s\n", host);
                }
        }



More information about the sheepdog mailing list