Re: [PATCH, RFC] virtio_blk: add cache flush command

Anthony Liguori
2009-05-11T14:51:42Z

Christoph Hellwig wrote:
> Currently virtio-blk does support barriers for ordering requests which
> is enough to guarantee filesystem metadata integrity with write back
> caches, but it does not support any way to flush that writeback cache,
> to guarantee that data is stable on disk on a fsync.
>
> This patch implements a new VIRTIO_BLK_T_FLUSH command to flush the
> cache and exposes the functionality to the block layer by implementing
> a prepare_flush method.
>

What typically triggers a flush operation?

I would assume an fsync would, but would a flush happen after every
O_DIRECT write?

If the backend implementation of T_FLUSH is fsync, I would think that
this would result in rather poor performance for O_DIRECT operations in
the guest.

Regards,

Anthony Liguori