[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 41/61] qed: Add return value to qed_aio_write_l1_upda
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 41/61] qed: Add return value to qed_aio_write_l1_update() |
Date: |
Fri, 23 Jun 2017 18:21:39 +0200 |
Don't recurse into qed_aio_next_io() and qed_aio_complete() here, but
just return an error code and let the caller handle it.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
---
block/qed.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/block/qed.c b/block/qed.c
index 5462faa..e43827f 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -958,18 +958,12 @@ static void qed_aio_complete(QEDAIOCB *acb, int ret)
/**
* Update L1 table with new L2 table offset and write it out
*/
-static void qed_aio_write_l1_update(void *opaque, int ret)
+static int qed_aio_write_l1_update(QEDAIOCB *acb)
{
- QEDAIOCB *acb = opaque;
BDRVQEDState *s = acb_to_s(acb);
CachedL2Table *l2_table = acb->request.l2_table;
uint64_t l2_offset = l2_table->offset;
- int index;
-
- if (ret) {
- qed_aio_complete(acb, ret);
- return;
- }
+ int index, ret;
index = qed_l1_index(s, acb->cur_pos);
s->l1_table->offsets[index] = l2_table->offset;
@@ -985,7 +979,7 @@ static void qed_aio_write_l1_update(void *opaque, int ret)
acb->request.l2_table = qed_find_l2_cache_entry(&s->l2_cache, l2_offset);
assert(acb->request.l2_table != NULL);
- qed_aio_next_io(acb, ret);
+ return ret;
}
@@ -1014,7 +1008,12 @@ static void qed_aio_write_l2_update(QEDAIOCB *acb, int
ret, uint64_t offset)
if (need_alloc) {
/* Write out the whole new L2 table */
ret = qed_write_l2_table(s, &acb->request, 0, s->table_nelems, true);
- qed_aio_write_l1_update(acb, ret);
+ if (ret) {
+ goto err;
+ }
+ ret = qed_aio_write_l1_update(acb);
+ qed_aio_next_io(acb, ret);
+
} else {
/* Write out only the updated part of the L2 table */
ret = qed_write_l2_table(s, &acb->request, index, acb->cur_nclusters,
--
1.8.3.1
- [Qemu-block] [PULL 33/61] qed: Make qed_write_header() synchronous, (continued)
- [Qemu-block] [PULL 33/61] qed: Make qed_write_header() synchronous, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 32/61] qed: Remove callback from qed_copy_from_backing_file(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 34/61] qed: Remove callback from qed_write_header(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 37/61] qed: Remove callback from qed_write_table(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 38/61] qed: Make qed_aio_read_data() synchronous, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 40/61] qed: Inline qed_commit_l2_update(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 39/61] qed: Make qed_aio_write_main() synchronous, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 35/61] qed: Make qed_write_table() synchronous, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 36/61] qed: Remove GenericCB, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 42/61] qed: Add return value to qed_aio_write_l2_update(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 41/61] qed: Add return value to qed_aio_write_l1_update(),
Kevin Wolf <=
- [Qemu-block] [PULL 47/61] qed: Remove ret argument from qed_aio_next_io(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 44/61] qed: Add return value to qed_aio_write_cow(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 50/61] qed: Use CoQueue for serialising allocations, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 43/61] qed: Add return value to qed_aio_write_main(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 51/61] qed: Simplify request handling, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 45/61] qed: Add return value to qed_aio_write_inplace/alloc(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 46/61] qed: Add return value to qed_aio_read/write_data(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 48/61] qed: Remove recursion in qed_aio_next_io(), Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 49/61] qed: Implement .bdrv_co_readv/writev, Kevin Wolf, 2017/06/23
- [Qemu-block] [PULL 53/61] qed: Add coroutine_fn to I/O path functions, Kevin Wolf, 2017/06/23