blkreplay.c (fcb7e040f5c69ca1f0678f991ab5354488a9e192) blkreplay.c (c86422c5549c0983b4b4525b8f56a1c69dd67aa1)
1/*
2 * Block protocol for record/replay
3 *
4 * Copyright (c) 2010-2016 Institute for System Programming
5 * of the Russian Academy of Sciences.
6 *
7 * This work is licensed under the terms of the GNU GPL, version 2 or later.
8 * See the COPYING file in the top-level directory.

--- 26 unchanged lines hidden (view full) ---

35 bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED;
36 bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED;
37
38 ret = 0;
39fail:
40 return ret;
41}
42
1/*
2 * Block protocol for record/replay
3 *
4 * Copyright (c) 2010-2016 Institute for System Programming
5 * of the Russian Academy of Sciences.
6 *
7 * This work is licensed under the terms of the GNU GPL, version 2 or later.
8 * See the COPYING file in the top-level directory.

--- 26 unchanged lines hidden (view full) ---

35 bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED;
36 bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED;
37
38 ret = 0;
39fail:
40 return ret;
41}
42
43static int64_t blkreplay_getlength(BlockDriverState *bs)
43static int64_t coroutine_fn blkreplay_co_getlength(BlockDriverState *bs)
44{
44{
45 return bdrv_getlength(bs->file->bs);
45 return bdrv_co_getlength(bs->file->bs);
46}
47
48/* This bh is used for synchronization of return from coroutines.
49 It continues yielded coroutine which then finishes its execution.
50 BH is called adjusted to some replay checkpoint, therefore
51 record and replay will always finish coroutines deterministically.
52*/
53static void blkreplay_bh_cb(void *opaque)

--- 77 unchanged lines hidden (view full) ---

131
132static BlockDriver bdrv_blkreplay = {
133 .format_name = "blkreplay",
134 .instance_size = 0,
135 .is_filter = true,
136
137 .bdrv_open = blkreplay_open,
138 .bdrv_child_perm = bdrv_default_perms,
46}
47
48/* This bh is used for synchronization of return from coroutines.
49 It continues yielded coroutine which then finishes its execution.
50 BH is called adjusted to some replay checkpoint, therefore
51 record and replay will always finish coroutines deterministically.
52*/
53static void blkreplay_bh_cb(void *opaque)

--- 77 unchanged lines hidden (view full) ---

131
132static BlockDriver bdrv_blkreplay = {
133 .format_name = "blkreplay",
134 .instance_size = 0,
135 .is_filter = true,
136
137 .bdrv_open = blkreplay_open,
138 .bdrv_child_perm = bdrv_default_perms,
139 .bdrv_getlength = blkreplay_getlength,
139 .bdrv_co_getlength = blkreplay_co_getlength,
140
141 .bdrv_co_preadv = blkreplay_co_preadv,
142 .bdrv_co_pwritev = blkreplay_co_pwritev,
143
144 .bdrv_co_pwrite_zeroes = blkreplay_co_pwrite_zeroes,
145 .bdrv_co_pdiscard = blkreplay_co_pdiscard,
146 .bdrv_co_flush = blkreplay_co_flush,
147
148 .bdrv_snapshot_goto = blkreplay_snapshot_goto,
149};
150
151static void bdrv_blkreplay_init(void)
152{
153 bdrv_register(&bdrv_blkreplay);
154}
155
156block_init(bdrv_blkreplay_init);
140
141 .bdrv_co_preadv = blkreplay_co_preadv,
142 .bdrv_co_pwritev = blkreplay_co_pwritev,
143
144 .bdrv_co_pwrite_zeroes = blkreplay_co_pwrite_zeroes,
145 .bdrv_co_pdiscard = blkreplay_co_pdiscard,
146 .bdrv_co_flush = blkreplay_co_flush,
147
148 .bdrv_snapshot_goto = blkreplay_snapshot_goto,
149};
150
151static void bdrv_blkreplay_init(void)
152{
153 bdrv_register(&bdrv_blkreplay);
154}
155
156block_init(bdrv_blkreplay_init);