[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH 5/8] Refactor - move more functions
Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx> --- src/xenvbd/pdo.c | 120 +++++++++++++++++++++++++++---------------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/xenvbd/pdo.c b/src/xenvbd/pdo.c index 172fa67..4e88302 100644 --- a/src/xenvbd/pdo.c +++ b/src/xenvbd/pdo.c @@ -2077,66 +2077,6 @@ __PdoReset( return TRUE; } -static FORCEINLINE VOID -__PdoCleanupSubmittedReqs( - IN PXENVBD_PDO Pdo - ) -{ - // Fail PreparedReqs - for (;;) { - PXENVBD_SRBEXT SrbExt; - PXENVBD_REQUEST Request; - PLIST_ENTRY Entry = QueuePop(&Pdo->SubmittedReqs); - if (Entry == NULL) - break; - Request = CONTAINING_RECORD(Entry, XENVBD_REQUEST, Entry); - SrbExt = GetSrbExt(Request->Srb); - - Verbose("Target[%d] : SubmittedReq 0x%p -> FAILED\n", PdoGetTargetId(Pdo), Request); - - RequestCleanup(Pdo, Request); - __LookasideFree(&Pdo->RequestList, Request); - - if (InterlockedDecrement(&SrbExt->Count) == 0) { - SrbExt->Srb->SrbStatus = SRB_STATUS_ABORTED; - SrbExt->Srb->ScsiStatus = 0x40; // SCSI_ABORTED - FdoCompleteSrb(PdoGetFdo(Pdo), SrbExt->Srb); - } - } -} - -VOID -PdoReset( - __in PXENVBD_PDO Pdo - ) -{ - NTSTATUS Status; - - Trace("Target[%d] ====> (Irql=%d)\n", PdoGetTargetId(Pdo), KeGetCurrentIrql()); - - __PdoPauseDataPath(Pdo, TRUE); - - if (QueueCount(&Pdo->SubmittedReqs)) { - Error("Target[%d] : backend has %u outstanding requests after a PdoReset\n", - PdoGetTargetId(Pdo), QueueCount(&Pdo->SubmittedReqs)); - } - - Status = FrontendSetState(Pdo->Frontend, XENVBD_CLOSING); - ASSERT(NT_SUCCESS(Status)); - - __PdoCleanupSubmittedReqs(Pdo); - - Status = FrontendSetState(Pdo->Frontend, XENVBD_CLOSED); - ASSERT(NT_SUCCESS(Status)); - - Status = FrontendSetState(Pdo->Frontend, XENVBD_ENABLED); - ASSERT(NT_SUCCESS(Status)); - - __PdoUnpauseDataPath(Pdo); - - Trace("Target[%d] <==== (Irql=%d)\n", PdoGetTargetId(Pdo), KeGetCurrentIrql()); -} - __checkReturn static FORCEINLINE BOOLEAN __ValidateSrbForPdo( @@ -2210,6 +2150,66 @@ PdoStartIo( } } +static FORCEINLINE VOID +__PdoCleanupSubmittedReqs( + IN PXENVBD_PDO Pdo + ) +{ + // Fail PreparedReqs + for (;;) { + PXENVBD_SRBEXT SrbExt; + PXENVBD_REQUEST Request; + PLIST_ENTRY Entry = QueuePop(&Pdo->SubmittedReqs); + if (Entry == NULL) + break; + Request = CONTAINING_RECORD(Entry, XENVBD_REQUEST, Entry); + SrbExt = GetSrbExt(Request->Srb); + + Verbose("Target[%d] : SubmittedReq 0x%p -> FAILED\n", PdoGetTargetId(Pdo), Request); + + RequestCleanup(Pdo, Request); + __LookasideFree(&Pdo->RequestList, Request); + + if (InterlockedDecrement(&SrbExt->Count) == 0) { + SrbExt->Srb->SrbStatus = SRB_STATUS_ABORTED; + SrbExt->Srb->ScsiStatus = 0x40; // SCSI_ABORTED + FdoCompleteSrb(PdoGetFdo(Pdo), SrbExt->Srb); + } + } +} + +VOID +PdoReset( + __in PXENVBD_PDO Pdo + ) +{ + NTSTATUS Status; + + Trace("Target[%d] ====> (Irql=%d)\n", PdoGetTargetId(Pdo), KeGetCurrentIrql()); + + __PdoPauseDataPath(Pdo, TRUE); + + if (QueueCount(&Pdo->SubmittedReqs)) { + Error("Target[%d] : backend has %u outstanding requests after a PdoReset\n", + PdoGetTargetId(Pdo), QueueCount(&Pdo->SubmittedReqs)); + } + + Status = FrontendSetState(Pdo->Frontend, XENVBD_CLOSING); + ASSERT(NT_SUCCESS(Status)); + + __PdoCleanupSubmittedReqs(Pdo); + + Status = FrontendSetState(Pdo->Frontend, XENVBD_CLOSED); + ASSERT(NT_SUCCESS(Status)); + + Status = FrontendSetState(Pdo->Frontend, XENVBD_ENABLED); + ASSERT(NT_SUCCESS(Status)); + + __PdoUnpauseDataPath(Pdo); + + Trace("Target[%d] <==== (Irql=%d)\n", PdoGetTargetId(Pdo), KeGetCurrentIrql()); +} + //============================================================================= // PnP Handler static FORCEINLINE VOID -- 1.9.4.msysgit.1 _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |