[Sheepdog] [PATCH v2 5/5] sheep: use SD_STATUS_HALT to stop serving IO

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Oct 17 08:57:55 CEST 2011


At Mon, 17 Oct 2011 14:07:41 +0800,
Liu Yuan wrote:
> 
> On 10/17/2011 01:44 PM, MORITA Kazutaka wrote:
> 
> >> +
> >>  static int cluster_format(int argc, char **argv)
> >>  {
> >>  	int fd, ret;
> >> @@ -36,6 +43,8 @@ static int cluster_format(int argc, char **argv)
> >>  
> >>  	hdr.opcode = SD_OP_MAKE_FS;
> >>  	hdr.copies = cluster_cmd_data.copies;
> >> +	if (cluster_cmd_data.nohalt)
> >> +		set_nohalt(&hdr.copies);
> > 
> > I think we should use hdr.flags to set the nohalt option.
> 
> 
> Okay.
> 
> >>  
> >> +int sys_nohalt()
> >> +{
> >> +	return sys->nr_sobjs & (1 << 31);
> > 
> > sys->nr_sobjs is used everywhere in the main thread, so I think this
> > doesn't work at all.
> > 
> > For example:
> > 
> >   $ sheep /store/0
> >   $ collie cluster format -H
> >   $ qemu-img create sheepdog:test 4G
> >   Formatting 'sheepdog:test', fmt=raw size=4294967296 
> >   qemu-img: Failed to write the requested VDI, test
> >   qemu-img: sheepdog:test: error while creating raw: Input/output error
> > 
> > We should declare another field in struct cluster info for the nohalt
> > option?
> 
> 
> Hmm, I just need one bit for indication. So one more filed is kind of
> wasteful. I am considering to change sys->status into bit operation,
> each bit stand for one status or other flag like nohalt. How do you
> think of it?

Looks good.  Can we replace too many (status == SD_STATUS_OK || status
== SD_STATUS_HALT) with one bit check?  I think the current codes is a
bit difficult to confirm correctness.

Thanks,

Kazutaka



More information about the sheepdog mailing list