Metadata flush writes data from the cache

When doing a flush on a metadata stream we first check if we can fill
the current subbuffer with data from the cache before doing the actual
flush.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>