[sheepdog] [PATCH RESEND 1/6] farm: do cluster-wide snapshot by work queue

MORITA Kazutaka morita.kazutaka at gmail.com
Fri Jun 7 01:14:51 CEST 2013


At Fri, 07 Jun 2013 08:00:52 +0900,
MORITA Kazutaka wrote:
> 
> At Wed,  5 Jun 2013 18:35:09 +0800,
> Kai Zhang wrote:
> > 
> > +static void do_save_object(struct work *work)
> > +{
> > +	void *sha1_buf, *data_buf;
> > +	size_t sha1_size, data_size;
> > +	struct snapshot_work *sw;
> > +	struct sha1_file_hdr *hdr;
> > +
> > +	if (uatomic_is_true(&work_error))
> > +		return;
> > +
> > +	sw = container_of(work, struct snapshot_work, work);
> > +	data_size = get_objsize(sw->entry.oid);
> > +	sha1_size = data_size + sizeof(struct sha1_file_hdr);
> > +	hdr = sha1_buf = xmalloc(sha1_size);
> > +	data_buf = (char *)sha1_buf + sizeof(struct sha1_file_hdr);
> 
> It looks cleaner to introduce a structure for sha1_file.  For example,
> 
> struct sha1_file {
>        struct sha1_file_hdr hdr;
>        uint8_t data[SD_DATA_OBJ_SIZE];
> };

Seems that the next patch removes sha1_hdr.  Please ignore the above
comment.

Thanks,

Kazutaka



More information about the sheepdog mailing list