Revision 205ef796 block.c

b/block.c
1453 1453
    return bs->device_name;
1454 1454
}
1455 1455

  
1456
void bdrv_flush(BlockDriverState *bs)
1456
int bdrv_flush(BlockDriverState *bs)
1457 1457
{
1458 1458
    if (bs->open_flags & BDRV_O_NO_FLUSH) {
1459
        return;
1459
        return 0;
1460
    }
1461

  
1462
    if (bs->drv && bs->drv->bdrv_flush) {
1463
        return bs->drv->bdrv_flush(bs);
1460 1464
    }
1461 1465

  
1462
    if (bs->drv && bs->drv->bdrv_flush)
1463
        bs->drv->bdrv_flush(bs);
1466
    /*
1467
     * Some block drivers always operate in either writethrough or unsafe mode
1468
     * and don't support bdrv_flush therefore. Usually qemu doesn't know how
1469
     * the server works (because the behaviour is hardcoded or depends on
1470
     * server-side configuration), so we can't ensure that everything is safe
1471
     * on disk. Returning an error doesn't work because that would break guests
1472
     * even if the server operates in writethrough mode.
1473
     *
1474
     * Let's hope the user knows what he's doing.
1475
     */
1476
    return 0;
1464 1477
}
1465 1478

  
1466 1479
void bdrv_flush_all(void)

Also available in: Unified diff