Revision eb489bb1

b/block.c
2789 2789

  
2790 2790
int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
2791 2791
{
2792
    int ret;
2793

  
2792 2794
    if (bs->open_flags & BDRV_O_NO_FLUSH) {
2793 2795
        return 0;
2794 2796
    } else if (!bs->drv) {
2795 2797
        return 0;
2796
    } else if (bs->drv->bdrv_co_flush_to_disk) {
2798
    }
2799

  
2800
    if (bs->drv->bdrv_co_flush_to_os) {
2801
        ret = bs->drv->bdrv_co_flush_to_os(bs);
2802
        if (ret < 0) {
2803
            return ret;
2804
        }
2805
    }
2806

  
2807
    if (bs->drv->bdrv_co_flush_to_disk) {
2797 2808
        return bs->drv->bdrv_co_flush_to_disk(bs);
2798 2809
    } else if (bs->drv->bdrv_aio_flush) {
2799 2810
        BlockDriverAIOCB *acb;
b/block/qcow2.c
1105 1105
    return ret;
1106 1106
}
1107 1107

  
1108
static int qcow2_co_flush(BlockDriverState *bs)
1108
static int qcow2_co_flush_to_os(BlockDriverState *bs)
1109 1109
{
1110 1110
    BDRVQcowState *s = bs->opaque;
1111 1111
    int ret;
......
1124 1124
    }
1125 1125
    qemu_co_mutex_unlock(&s->lock);
1126 1126

  
1127
    return 0;
1128
}
1129

  
1130
static int qcow2_co_flush_to_disk(BlockDriverState *bs)
1131
{
1127 1132
    return bdrv_co_flush(bs->file);
1128 1133
}
1129 1134

  
......
1245 1250

  
1246 1251
    .bdrv_co_readv          = qcow2_co_readv,
1247 1252
    .bdrv_co_writev         = qcow2_co_writev,
1248
    .bdrv_co_flush_to_disk  = qcow2_co_flush,
1253
    .bdrv_co_flush_to_os    = qcow2_co_flush_to_os,
1254
    .bdrv_co_flush_to_disk  = qcow2_co_flush_to_disk,
1249 1255

  
1250 1256
    .bdrv_co_discard        = qcow2_co_discard,
1251 1257
    .bdrv_truncate          = qcow2_truncate,
b/block_int.h
93 93
     */
94 94
    int coroutine_fn (*bdrv_co_flush_to_disk)(BlockDriverState *bs);
95 95

  
96
    /*
97
     * Flushes all internal caches to the OS. The data may still sit in a
98
     * writeback cache of the host OS, but it will survive a crash of the qemu
99
     * process.
100
     */
101
    int coroutine_fn (*bdrv_co_flush_to_os)(BlockDriverState *bs);
102

  
96 103
    int (*bdrv_aio_multiwrite)(BlockDriverState *bs, BlockRequest *reqs,
97 104
        int num_reqs);
98 105
    int (*bdrv_merge_requests)(BlockDriverState *bs, BlockRequest* a,

Also available in: Unified diff