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

Re: [win-pv-devel] [PATCH 3/3] Send BLKIF_OP_FLUSH_DISKCACHE



> -----Original Message-----
> From: win-pv-devel [mailto:win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx] On
> Behalf Of owen.smith@xxxxxxxxxx
> Sent: 21 November 2016 15:28
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Owen Smith <owen.smith@xxxxxxxxxx>
> Subject: [win-pv-devel] [PATCH 3/3] Send BLKIF_OP_FLUSH_DISKCACHE
> 
> From: Owen Smith <owen.smith@xxxxxxxxxx>
> 
> If the backend supports flush, send BLKIF_OP_FLUSH_DISKCACHE in
> response to SCSIOP_SYNCHRONIZE_CACHE, and advertise the cache
> to Windows. Also tracks count of cache operations. If the backend
> does not support flush, but supports barrier, send
> BLKIF_OP_WRITE_BARRIER instead, but do not advertise the cache to
> Windows, as its assumed the backend will guarantee writes are
> flushed if the storage requires flushing.
> 
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>

Acked-by: Paul Durrant <paul.durrant@xxxxxxxxxx>

> ---
>  src/xenvbd/blockring.c |  1 +
>  src/xenvbd/pdo.c       | 25 ++++++++++++++++++-------
>  2 files changed, 19 insertions(+), 7 deletions(-)
> 
> diff --git a/src/xenvbd/blockring.c b/src/xenvbd/blockring.c
> index e0275af..7cf5c84 100644
> --- a/src/xenvbd/blockring.c
> +++ b/src/xenvbd/blockring.c
> @@ -211,6 +211,7 @@ __BlockRingInsert(
>          break;
> 
>      case BLKIF_OP_WRITE_BARRIER:
> +    case BLKIF_OP_FLUSH_DISKCACHE:
>          req->operation                  = Request->Operation;
>          req->nr_segments                = 0;
>          req->handle                     = (USHORT)BlockRing->DeviceId;
> diff --git a/src/xenvbd/pdo.c b/src/xenvbd/pdo.c
> index 7e78ce4..3efe711 100644
> --- a/src/xenvbd/pdo.c
> +++ b/src/xenvbd/pdo.c
> @@ -113,6 +113,7 @@ struct _XENVBD_PDO {
>      ULONG                       BlkOpIndirectWrite;
>      ULONG                       BlkOpBarrier;
>      ULONG                       BlkOpDiscard;
> +    ULONG                       BlkOpFlush;
>      // Stats - Failures
>      ULONG                       FailedMaps;
>      ULONG                       FailedBounces;
> @@ -294,8 +295,8 @@ PdoDebugCallback(
>                   "PDO: BLKIF_OPs: INDIRECT_READ=%u INDIRECT_WRITE=%u\n",
>                   Pdo->BlkOpIndirectRead, Pdo->BlkOpIndirectWrite);
>      XENBUS_DEBUG(Printf, DebugInterface,
> -                 "PDO: BLKIF_OPs: BARRIER=%u DISCARD=%u\n",
> -                 Pdo->BlkOpBarrier, Pdo->BlkOpDiscard);
> +                 "PDO: BLKIF_OPs: BARRIER=%u DISCARD=%u FLUSH=%u\n",
> +                 Pdo->BlkOpBarrier, Pdo->BlkOpDiscard, Pdo->BlkOpFlush);
>      XENBUS_DEBUG(Printf, DebugInterface,
>                   "PDO: Failed: Maps=%u Bounces=%u Grants=%u\n",
>                   Pdo->FailedMaps, Pdo->FailedBounces, Pdo->FailedGrants);
> @@ -316,7 +317,7 @@ PdoDebugCallback(
> 
>      Pdo->BlkOpRead = Pdo->BlkOpWrite = 0;
>      Pdo->BlkOpIndirectRead = Pdo->BlkOpIndirectWrite = 0;
> -    Pdo->BlkOpBarrier = Pdo->BlkOpDiscard = 0;
> +    Pdo->BlkOpBarrier = Pdo->BlkOpDiscard = Pdo->BlkOpFlush = 0;
>      Pdo->FailedMaps = Pdo->FailedBounces = Pdo->FailedGrants = 0;
>      Pdo->SegsGranted = Pdo->SegsBounced = 0;
>  }
> @@ -755,6 +756,9 @@ __PdoIncBlkifOpCount(
>      case BLKIF_OP_DISCARD:
>          ++Pdo->BlkOpDiscard;
>          break;
> +    case BLKIF_OP_FLUSH_DISKCACHE:
> +        ++Pdo->BlkOpFlush;
> +        break;
>      default:
>          ASSERT(FALSE);
>          break;
> @@ -1222,7 +1226,13 @@ PrepareSyncCache(
>      PXENVBD_SRBEXT      SrbExt = GetSrbExt(Srb);
>      PXENVBD_REQUEST     Request;
>      LIST_ENTRY          List;
> +    UCHAR               Operation;
> 
> +    if (FrontendGetDiskInfo(Pdo->Frontend)->FlushCache)
> +        Operation = BLKIF_OP_FLUSH_DISKCACHE;
> +    else
> +        Operation = BLKIF_OP_WRITE_BARRIER;
> +
>      InitializeListHead(&List);
>      SrbExt->Count = 0;
>      Srb->SrbStatus = SRB_STATUS_PENDING;
> @@ -1233,7 +1243,7 @@ PrepareSyncCache(
>      InsertTailList(&List, &Request->Entry);
> 
>      Request->Srb        = Srb;
> -    Request->Operation  = BLKIF_OP_WRITE_BARRIER;
> +    Request->Operation  = Operation;
>      Request->FirstSector = Cdb_LogicalBlock(Srb);
> 
>      SrbExt->Count = PdoQueueRequestList(Pdo, &List);
> @@ -1722,8 +1732,9 @@ PdoSyncCache(
>          return TRUE;
>      }
> 
> -    if (FrontendGetDiskInfo(Pdo->Frontend)->Barrier == FALSE) {
> -        Trace("Target[%d] : BARRIER not supported, suppressing\n",
> PdoGetTargetId(Pdo));
> +    if (FrontendGetDiskInfo(Pdo->Frontend)->FlushCache == FALSE &&
> +        FrontendGetDiskInfo(Pdo->Frontend)->Barrier == FALSE) {
> +        Trace("Target[%d] : FLUSH and BARRIER not supported, suppressing\n",
> PdoGetTargetId(Pdo));
>          Srb->ScsiStatus = 0x00; // SCSI_GOOD
>          Srb->SrbStatus = SRB_STATUS_SUCCESS;
>          return TRUE;
> @@ -1826,7 +1837,7 @@ PdoModeSense(
>          Caching->PageLength                 = MODE_CACHING_PAGE_LENGTH;
>          Caching->ReadDisableCache           = 0;
>          Caching->MultiplicationFactor       = 0;
> -        Caching->WriteCacheEnable           = 0;
> +        Caching->WriteCacheEnable           = FrontendGetDiskInfo(Pdo-
> >Frontend)->FlushCache ? 1 : 0;
>          Caching->WriteRetensionPriority     = 0;
>          Caching->ReadRetensionPriority      = 0;
>          Caching->DisablePrefetchTransfer[0] = 0;
> --
> 2.8.3
> 
> 
> _______________________________________________
> win-pv-devel mailing list
> win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.