/* This flush is necessary when a backing file is in use. A crash during an allocating write could result in empty clusters in the image. If the write only touched a subregion of the cluster, then backing image sectors have been lost in the untouched region. The solution is to flush after writing a new data cluster and before updating the L2 table.  */
static void qed_aio_write_flush_before_l2_update(void *opaque, int ret)
/* This flush is necessary when a backing file is in use. A crash during an allocating write could result in empty clusters in the image. If the write only touched a subregion of the cluster, then backing image sectors have been lost in the untouched region. The solution is to flush after writing a new data cluster and before updating the L2 table.  */
static void qed_aio_write_flush_before_l2_update(void *opaque, int ret)
{
    QEDAIOCB *acb = opaque;
    BDRVQEDState *s = acb_to_s(acb);
    if (!bdrv_aio_flush(s->bs->file, qed_aio_write_l2_update_cb, opaque)) {
        qed_aio_complete(acb, -EIO);
    }
}