/* It is not safe to use bdrv_unref() from a callback function when the callers still need the BlockDriverState. In such cases we schedule a BH to release the reference.  */
static void bdrv_put_ref_bh_schedule(BlockDriverState *bs)
/* It is not safe to use bdrv_unref() from a callback function when the callers still need the BlockDriverState. In such cases we schedule a BH to release the reference.  */
static void bdrv_put_ref_bh_schedule(BlockDriverState *bs)
{
    BDRVPutRefBH *s;
    s = g_new(BDRVPutRefBH, 1);
    s->bh = qemu_bh_new(bdrv_put_ref_bh, s);
    s->bs = bs;
    qemu_bh_schedule(s->bh);
}