On Wed, Feb 13, 2013 at 02:22:07PM +0100, Kevin Wolf wrote: > +static bool qcow2_drain(BlockDriverState *bs)
I don't like this function name. This function is a bool query but normal drain() means flush requests (i.e. do something that modified state). > +{ > + BDRVQcowState *s = bs->opaque; > + > + return !QLIST_EMPTY(&s->cluster_allocs); > +} > + > +static inline coroutine_fn void stop_l2meta(BlockDriverState *bs) > +{ > + BDRVQcowState *s = bs->opaque; > + > + qemu_co_rwlock_wrlock(&s->l2meta_flush); > +} > + > +static inline coroutine_fn void resume_l2meta(BlockDriverState *bs) > +{ > + BDRVQcowState *s = bs->opaque; > + > + qemu_co_rwlock_unlock(&s->l2meta_flush); > +} Maybe later patches will add more behavior here. I don't like wrapper locks - it just obfuscates the locking protocol. If nothing else gets added to these functions then it's cleaner to remove them and let code directly lock/unlock.