[COMMIT] [viostor] complete flush requests synchronously

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From cf6f4ecb43db044d4f3028af0a23ec574289b285 Mon Sep 17 00:00:00 2001
From: Vadim Rozenfeld <vrozenfe@xxxxxxxxxx>
Date: Mon, 2 May 2011 16:03:44 +0300
Subject: [COMMIT] [viostor] complete flush requests synchronously

---
 viostor/virtio_stor.c           |    8 +++++++-
 viostor/virtio_stor_hw_helper.c |   15 +++++++++------
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/viostor/virtio_stor.c b/viostor/virtio_stor.c
index 14bbfb2..c0c6fbc 100644
--- a/viostor/virtio_stor.c
+++ b/viostor/virtio_stor.c
@@ -948,7 +948,13 @@ VirtIoMSInterruptRoutine (
             Srb->SrbStatus = SRB_STATUS_ERROR;
             break;
        }
-       CompleteDPC(DeviceExtension, vbr, MessageID);
+       if (vbr->out_hdr.type == VIRTIO_BLK_T_FLUSH) {
+            adaptExt->flush_done = TRUE;
+       }
+       else
+       {
+            CompleteDPC(DeviceExtension, vbr, MessageID);
+       }
     }
 
     return TRUE;
diff --git a/viostor/virtio_stor_hw_helper.c
b/viostor/virtio_stor_hw_helper.c
index 8eb4324..1785066 100644
--- a/viostor/virtio_stor_hw_helper.c
+++ b/viostor/virtio_stor_hw_helper.c
@@ -57,16 +57,19 @@ RhelDoFlush(
 {
     PADAPTER_EXTENSION  adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
     ULONG i;
-    ULONG Wait = 100000;
+    ULONG Wait = 10000;
 
     ASSERT(adaptExt->flush_done != TRUE);
     if(StorPortSynchronizeAccess(DeviceExtension,
SynchronizedFlushRoutine, (PVOID)Srb)) {
         for (i = 0; i < Wait; i++) {
-           StorPortStallExecution(1000);
            if (adaptExt->flush_done == TRUE) {
               adaptExt->flush_done = FALSE;
               return Srb->SrbStatus;
            }
+           StorPortStallExecution(500);
+           if (adaptExt->dump_mode) {
+              VirtIoInterrupt(DeviceExtension);
+           }
         }
     }
     return SRB_STATUS_ERROR;
@@ -83,7 +86,7 @@ RhelDoFlush(
     ULONG               fragLen;
     int                 num_free;
     ULONG               i;
-    ULONG               Wait   = 100000;
+    ULONG               Wait   = 10000;
     ULONG               status = SRB_STATUS_ERROR;
 
     srbExt->vbr.out_hdr.sector = 0;
@@ -98,6 +101,7 @@ RhelDoFlush(
     srbExt->vbr.sg[1].physAddr =
ScsiPortGetPhysicalAddress(DeviceExtension, NULL, &srbExt->vbr.status,
&fragLen);
     srbExt->vbr.sg[1].ulSize   = sizeof(srbExt->vbr.status);
 
+ 
     num_free =
adaptExt->pci_vq_info.vq->vq_ops->add_buf(adaptExt->pci_vq_info.vq,
                                       &srbExt->vbr.sg[0],
                                       srbExt->out, srbExt->in,
@@ -110,7 +114,7 @@ RhelDoFlush(
               status = Srb->SrbStatus;
               break;
            }
-           ScsiPortStallExecution(1000);
+           ScsiPortStallExecution(500);
            VirtIoInterrupt(DeviceExtension);
         }
     }
@@ -140,6 +144,7 @@ SynchronizedReadWriteRoutine(
     PADAPTER_EXTENSION  adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
     PSCSI_REQUEST_BLOCK Srb      = (PSCSI_REQUEST_BLOCK) Context;
     PRHEL_SRB_EXTENSION srbExt   =
(PRHEL_SRB_EXTENSION)Srb->SrbExtension;
+
     if
(adaptExt->pci_vq_info.vq->vq_ops->add_buf(adaptExt->pci_vq_info.vq,
                      &srbExt->vbr.sg[0],
                      srbExt->out, srbExt->in,
@@ -148,7 +153,6 @@ SynchronizedReadWriteRoutine(

adaptExt->pci_vq_info.vq->vq_ops->kick(adaptExt->pci_vq_info.vq);
         return TRUE;
     }
-
     StorPortBusy(DeviceExtension, 5);
     return FALSE;
 }
@@ -289,6 +293,5 @@ RhelGetLba(
             return (ULONGLONG)-1;
         }
     }
-
     return (lba.AsULongLong * (adaptExt->info.blk_size / SECTOR_SIZE));
 }
-- 
1.7.0.2.msysgit.0



--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM Development]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Walks]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux