[sheepdog] [PATCH v3] recovery: avoid recovering object from node left

Christoph Hellwig hch at infradead.org
Thu May 24 10:56:44 CEST 2012


On Thu, May 24, 2012 at 04:55:05PM +0800, levin li wrote:
> On 05/24/2012 04:51 PM, Christoph Hellwig wrote:
> >> +++ b/include/sheep.h
> >> @@ -155,9 +155,9 @@ struct sd_node {
> >>  };
> >>  
> >>  struct sd_vnode {
> >> -	uint64_t        id;
> >>  	uint8_t         addr[16];
> >>  	uint16_t        port;
> >> +	uint64_t        id;
> >>  	uint16_t	node_idx;
> >>  	uint32_t	zone;
> >>  };
> > 
> > Why do you need to change the sd_vnode layout?  Especially as the new
> > one has a much less efficient layout.
> > 
> 
> We make it has the same layout as sd_node which set addr and port in the
> head, then we can use node_cmp to compare sd_node and sd_vnode.

Bad idea - assuming different types have the same layout just leads to
future bugs.  Please just write different compare functions for the
node and vnode.




More information about the sheepdog mailing list