|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH] Rework request submission
Make BlkifRingPostRequests return success for submitting 0 or more requests,
or failure when the ring is full. This prevents the loop in BlkifRingSchedule
from preparing the next SRB when the ring is already full.
Also attempt to notify the backend of changes every iteration of the loop in
BlkifRingSchedule, to trigger the backend as soon as possible.
Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
src/xenvbd/ring.c | 41 ++++++++++-------------------------------
1 file changed, 10 insertions(+), 31 deletions(-)
diff --git a/src/xenvbd/ring.c b/src/xenvbd/ring.c
index 45a885d..2b3538e 100644
--- a/src/xenvbd/ring.c
+++ b/src/xenvbd/ring.c
@@ -1089,28 +1089,21 @@ __BlkifRingPostRequests(
IN PXENVBD_BLKIF_RING BlkifRing
)
{
-#define RING_SLOTS_AVAILABLE(_Front, _req_prod, _rsp_cons) \
- (RING_SIZE(_Front) - ((_req_prod) - (_rsp_cons)))
-
PXENVBD_SRB_STATE State;
- RING_IDX req_prod;
- RING_IDX rsp_cons;
- NTSTATUS status;
State = &BlkifRing->State;
- req_prod = BlkifRing->Front.req_prod_pvt;
- rsp_cons = BlkifRing->Front.rsp_cons;
-
- status = STATUS_ALLOTTED_SPACE_EXCEEDED;
- if (RING_SLOTS_AVAILABLE(&BlkifRing->Front, req_prod, rsp_cons) <= 1)
- goto fail1;
-
- while (State->Count != 0) {
+ for (;;) {
blkif_request_t *req;
PXENVBD_REQUEST Request;
PLIST_ENTRY ListEntry;
+ if (State->Count == 0)
+ return STATUS_SUCCESS;
+
+ if (RING_FULL(&BlkifRing->Front))
+ return STATUS_ALLOTTED_SPACE_EXCEEDED;
+
--State->Count;
ListEntry = RemoveHeadList(&State->List);
@@ -1122,8 +1115,8 @@ __BlkifRingPostRequests(
XENVBD_REQUEST,
ListEntry);
- req = RING_GET_REQUEST(&BlkifRing->Front, req_prod);
- req_prod++;
+ req = RING_GET_REQUEST(&BlkifRing->Front,
BlkifRing->Front.req_prod_pvt);
+ BlkifRing->Front.req_prod_pvt++;
BlkifRing->RequestsPosted++;
__BlkifRingInsertRequest(BlkifRing,
@@ -1131,19 +1124,7 @@ __BlkifRingPostRequests(
req);
InsertTailList(&BlkifRing->SubmittedList, ListEntry);
-
- if (RING_SLOTS_AVAILABLE(&BlkifRing->Front, req_prod, rsp_cons) <= 1)
- break;
}
-
- BlkifRing->Front.req_prod_pvt = req_prod;
-
- return STATUS_SUCCESS;
-
-fail1:
- return status;
-
-#undef RING_SLOTS_AVAILABLE
}
static FORCEINLINE PXENVBD_REQUEST
@@ -1424,9 +1405,7 @@ BlkifRingSchedule(
continue;
}
- if (BlkifRing->RequestsPosted - BlkifRing->RequestsPushed >=
- RING_SIZE(&BlkifRing->Front) / 4)
- __BlkifRingPushRequests(BlkifRing);
+ __BlkifRingPushRequests(BlkifRing);
if (IsListEmpty(&BlkifRing->SrbQueue))
break;
--
2.16.2.windows.1
_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |