[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v12 12/14] copy-on-read: skip non-guest reads if no copy needed
From: |
Andrey Shinkevich |
Subject: |
[PATCH v12 12/14] copy-on-read: skip non-guest reads if no copy needed |
Date: |
Thu, 22 Oct 2020 21:13:41 +0300 |
If the flag BDRV_REQ_PREFETCH was set, skip idling read/write
operations in COR-driver. It can be taken into account for the
COR-algorithms optimization. That check is being made during the
block stream job by the moment.
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
---
block/copy-on-read.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/block/copy-on-read.c b/block/copy-on-read.c
index a2b180a..081e661 100644
--- a/block/copy-on-read.c
+++ b/block/copy-on-read.c
@@ -153,10 +153,14 @@ static int coroutine_fn
cor_co_preadv_part(BlockDriverState *bs,
}
}
- ret = bdrv_co_preadv_part(bs->file, offset, n, qiov, qiov_offset,
- local_flags);
- if (ret < 0) {
- return ret;
+ /* Skip if neither read nor write are needed */
+ if ((local_flags & (BDRV_REQ_PREFETCH | BDRV_REQ_COPY_ON_READ)) !=
+ BDRV_REQ_PREFETCH) {
+ ret = bdrv_co_preadv_part(bs->file, offset, n, qiov, qiov_offset,
+ local_flags);
+ if (ret < 0) {
+ return ret;
+ }
}
offset += n;
--
1.8.3.1
- [PATCH v12 10/14] block: include supported_read_flags into BDS structure, (continued)
[PATCH v12 12/14] copy-on-read: skip non-guest reads if no copy needed,
Andrey Shinkevich <=
[PATCH v12 08/14] iotests: add #310 to test bottom node in COR driver, Andrey Shinkevich, 2020/10/22
[PATCH v12 05/14] qapi: create BlockdevOptionsCor structure for COR driver, Andrey Shinkevich, 2020/10/22