[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 2/9] block: Track flush requests
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH v3 2/9] block: Track flush requests |
Date: |
Mon, 9 Nov 2015 10:56:41 +0800 |
Both bdrv_flush and bdrv_aio_flush eventually call bdrv_co_flush, add
tracked_request_begin and tracked_request_end pair in that function so
that all flush requests are now tracked.
Signed-off-by: Fam Zheng <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
---
block/io.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/block/io.c b/block/io.c
index 793809a..a9a49e4 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2318,18 +2318,20 @@ static void coroutine_fn bdrv_flush_co_entry(void
*opaque)
int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
{
int ret;
+ BdrvTrackedRequest req;
if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs) ||
bdrv_is_sg(bs)) {
return 0;
}
+ tracked_request_begin(&req, bs, 0, 0, BDRV_TRACKED_FLUSH);
/* Write back cached data to the OS even with cache=unsafe */
BLKDBG_EVENT(bs->file, BLKDBG_FLUSH_TO_OS);
if (bs->drv->bdrv_co_flush_to_os) {
ret = bs->drv->bdrv_co_flush_to_os(bs);
if (ret < 0) {
- return ret;
+ goto out;
}
}
@@ -2369,14 +2371,17 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs)
ret = 0;
}
if (ret < 0) {
- return ret;
+ goto out;
}
/* Now flush the underlying protocol. It will also have BDRV_O_NO_FLUSH
* in the case of cache=unsafe, so there are no useless flushes.
*/
flush_parent:
- return bs->file ? bdrv_co_flush(bs->file->bs) : 0;
+ ret = bs->file ? bdrv_co_flush(bs->file->bs) : 0;
+out:
+ tracked_request_end(&req);
+ return ret;
}
int bdrv_flush(BlockDriverState *bs)
--
2.4.3
- [Qemu-devel] [PATCH v3 0/9] block: Fixes for bdrv_drain, Fam Zheng, 2015/11/08
- [Qemu-devel] [PATCH v3 1/9] block: Add more types for tracked request, Fam Zheng, 2015/11/08
- [Qemu-devel] [PATCH v3 2/9] block: Track flush requests,
Fam Zheng <=
- [Qemu-devel] [PATCH v3 3/9] block: Track discard requests, Fam Zheng, 2015/11/08
- [Qemu-devel] [PATCH v3 4/9] iscsi: Emulate commands in iscsi_aio_ioctl as iscsi_ioctl, Fam Zheng, 2015/11/08
- [Qemu-devel] [PATCH v3 5/9] block: Add ioctl parameter fields to BlockRequest, Fam Zheng, 2015/11/08
- [Qemu-devel] [PATCH v3 6/9] block: Emulate bdrv_ioctl with bdrv_aio_ioctl and track both, Fam Zheng, 2015/11/08
- [Qemu-devel] [PATCH v3 7/9] block: Drop BlockDriver.bdrv_ioctl, Fam Zheng, 2015/11/08
- [Qemu-devel] [PATCH v3 8/9] block: Introduce BlockDriver.bdrv_drain callback, Fam Zheng, 2015/11/08
- [Qemu-devel] [PATCH v3 9/9] qed: Implement .bdrv_drain, Fam Zheng, 2015/11/08
- Re: [Qemu-devel] [PATCH v3 0/9] block: Fixes for bdrv_drain, Stefan Hajnoczi, 2015/11/09