[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/6] block: mark blocks dirty on coroutine write com
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PATCH 5/6] block: mark blocks dirty on coroutine write completion |
Date: |
Wed, 5 Oct 2011 17:17:06 +0100 |
The aio write operation marks blocks dirty when the write operation
completes. The coroutine write operation marks blocks dirty before
issuing the write operation.
It seems safest to mark the block dirty when the operation completes so
that anything tracking dirty blocks will not act before the change has
been made to the image file.
Make the coroutine write operation dirty blocks on write completion.
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/block.c b/block.c
index b83e911..5d6e17f 100644
--- a/block.c
+++ b/block.c
@@ -1307,6 +1307,7 @@ static int coroutine_fn
bdrv_co_do_writev(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, QEMUIOVector *qiov)
{
BlockDriver *drv = bs->drv;
+ int ret;
if (!bs->drv) {
return -ENOMEDIUM;
@@ -1318,6 +1319,8 @@ static int coroutine_fn
bdrv_co_do_writev(BlockDriverState *bs,
return -EIO;
}
+ ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov);
+
if (bs->dirty_bitmap) {
set_dirty_bitmap(bs, sector_num, nb_sectors, 1);
}
@@ -1326,7 +1329,7 @@ static int coroutine_fn
bdrv_co_do_writev(BlockDriverState *bs,
bs->wr_highest_sector = sector_num + nb_sectors - 1;
}
- return drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov);
+ return ret;
}
int coroutine_fn bdrv_co_writev(BlockDriverState *bs, int64_t sector_num,
--
1.7.6.3
- [Qemu-devel] [PATCH 0/6] block: do request processing in a coroutine, Stefan Hajnoczi, 2011/10/05
- [Qemu-devel] [PATCH 2/6] block: split out bdrv_co_do_readv() and bdrv_co_do_writev(), Stefan Hajnoczi, 2011/10/05
- [Qemu-devel] [PATCH 5/6] block: mark blocks dirty on coroutine write completion,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 6/6] block: switch bdrv_aio_writev() to coroutines, Stefan Hajnoczi, 2011/10/05
- [Qemu-devel] [PATCH 1/6] block: directly invoke .bdrv_aio_*() in bdrv_co_io_em(), Stefan Hajnoczi, 2011/10/05
- Re: [Qemu-devel] [PATCH 0/6] block: do request processing in a coroutine, Zhi Yong Wu, 2011/10/11
- Re: [Qemu-devel] [PATCH 0/6] block: do request processing in a coroutine, Kevin Wolf, 2011/10/12