[sheepdog] [PATCH] sheep: split create_vdi_obj() into 4 functions

MORITA Kazutaka morita.kazutaka at gmail.com
Thu Aug 22 16:05:14 CEST 2013


At Thu, 22 Aug 2013 17:26:49 +0800,
Liu Yuan wrote:
> 
> On Thu, Aug 22, 2013 at 06:21:17PM +0900, MORITA Kazutaka wrote:
> > At Thu, 22 Aug 2013 16:57:30 +0800,
> > Liu Yuan wrote:
> > > 
> > > sd_{vdi,snapshot}_create share almost the same logic, how about merge them
> > > into one function? Either ask sd_{vdi,snapshot}_create call the shared helper
> > > or use single sd_vdi_create() function
> > 
> > I don't think they share so much the same logic.  Both call
> > vdi_lookup() but how to handle the return value is different.  Both
> > calls notify_vdi_add() but it should be moved to cluster_new_vdi()
> > because we should call it only after we successfully created the vdi
> > (I think of doing this change in the next version).
> > 

I noticed that we cannot move notify_vdi_add() because we have to set
vdi state before calling write_object().  However, the other parts
don't share the logic and I still think these two function shouldn't
be merged.

> 
> Okay, so can we name it as vdi_create and vdi_snapshot_create? Use sd_ prefix
> doesn't help clarify the functions which .c file they reside.

Okay.

Thanks,

Kazutaka



More information about the sheepdog mailing list