[sheepdog] [PATCH v1, RFC] sheep: writeback cache semantics in backend store

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Aug 30 16:57:10 CEST 2012


At Thu, 30 Aug 2012 20:15:14 +0800,
Liu Yuan wrote:
> 
> On 08/29/2012 12:10 PM, MORITA Kazutaka wrote:
> > At Wed, 29 Aug 2012 11:36:35 +0800,
> > Liu Yuan wrote:
> >>>
> >>> Adding a 'writeback' option is a bit confusing.  Should we extend a
> >>> '-w' option so that we can specify types of caches we want to enable?
> >>>
> >>
> >> Basically this is a sync operation, as we don't want to confuse users by
> >> yet another writeback semantic, I'd suggest term it as sync operation.
> >> Then how about -w {wrtiethrough,writeback},{nosync}? First two used for
> >> object cache, and nosync used for backend. nosync means don't use D_SYNC
> >> flag for backend write. For e.g
> >>  -w writeback,nosync means use object cache and no D_SYNC flag for backend
> >>  -w nosync means no D_SYNC flag for backend
> >>  -w writethough means use object cache but still use D_SYNC flag for
> >> backend write
> > 
> > I guess what sheep should do is only to specify what kinds of cache to
> > be turned on.  Whether using writeback or writethrough should be
> > specified by a qemu command line, no?
> >
> 
> I think QEMU flag to control cache is really human-unfriendly, I guess most users will
> get confused at 'cache=' options.

Yes, but I think we should recommend only using cache=writeback and
cache=writethrough for Sheepdog.

>  
> > 'nosync' sounds dangerous though this patch provides right block
> > device semantics.  I vote for adding this patch as another write cache
> > because we can say that this patch uses a local disk cache on each
> > storage node as a Sheepdog disk cache.  In addition, we can consider
> > yet another write cache implementation in future (e.g. use page cache
> > on storage nodes (not gateway) as a Sheepdog disk cache).
> > 
> 
> If you find 'nosync' kind of dangerous, how about 'buffered' which means we use buffered write
> for backend. Then the new look will be:
> 
> -w writeback,buffered means use object cache and buffered write for backend
> -w buffered means buffered write only for backend
> -w writethrough means use object cache writethrough mode
> -w writethrough,buffered, means use object cache writethrough mode and buffered write for backend.

Well, to be honest, I disagree with it.  It is because I thing this
patch is yet another implementation of Sheepdog disk cache (write data
with O_DIRECT in writeback mode, and with (O_DIRECT|O_DSYNC) in
writethrough mode).  In that sense, "-w writethrough,buffered" is
confusing to me.

> 
> The benefit:
>  1) we don't need to modify QEMU at all.

With my series, we don't need to modify QEMU too.

>  2) we can control cache mode at our own side and write it more
> human friendly and easy to use.

I agree with qemu cache option is not human friendly, but specifying
whether which caches (object, disk, etc) are enabled with a sheep
option and specifying whether writeback or writethrough with a qemu
option looks better than introducing a complex '-w' option (at least
for now).

Thanks,

Kazutaka



More information about the sheepdog mailing list