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

Liu Yuan namei.unix at gmail.com
Mon Nov 26 11:26:39 CET 2012


On 11/26/2012 06:02 PM, MORITA Kazutaka wrote:
> 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);
>                 }
>         }
> 

Ah, yes, it works out. I mistakenly thought that When # of nodes is less
than nr_copies, we couldn't call oid_to_vnodes(). Would you cook a patch
for it?

Thanks,
Yuan



More information about the sheepdog mailing list