[sheepdog] [RFC PATCH 3/3] sheep: introduce journal file to boost IO performance

MORITA Kazutaka morita.kazutaka at gmail.com
Mon Nov 5 09:14:42 CET 2012


At Mon, 05 Nov 2012 16:06:26 +0800,
Liu Yuan wrote:
> >> +static int zero_out_jfile(int fd)
> >> +{
> >> +	char *buf;
> >> +	ssize_t wlen;
> >> +
> >> +	buf = valloc(JOURNAL_FILE_SIZE);
> >> +	memset(buf, 0, JOURNAL_FILE_SIZE);
> >> +	wlen = xpwrite(fd, buf, JOURNAL_FILE_SIZE, 0);
> > 
> > Isn't it efficent to use truncate and fallocate like as follows?
> > 
> >     ftruncate(fd, 0);
> >     prealloc(fd, JOURNAL_FILE_SIZE);
> > 
> > 
> 
> fallocate will allocate physical blocks but the extents of those blocks
> is marked as 'unwritten'. So the some writes will be delayed slightly to
> change those 'unwritten' extents into 'written' ones of meta data.

Okay, makes sense.

Thanks,

Kazutaka



More information about the sheepdog mailing list