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

Re: [win-pv-devel] [PATCH 2/5] Remove unused code and general tidy up



> -----Original Message-----
> From: win-pv-devel [mailto:win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx] On
> Behalf Of owen.smith@xxxxxxxxxx
> Sent: 18 October 2017 13:43
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Owen Smith <owen.smith@xxxxxxxxxx>
> Subject: [win-pv-devel] [PATCH 2/5] Remove unused code and general tidy
> up
> 
> From: Owen Smith <owen.smith@xxxxxxxxxx>
> 
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>

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

> ---
>  src/xenvbd/ring.c   | 82 
> ++++++++++++++++-------------------------------------
>  src/xenvbd/target.c | 19 +------------
>  2 files changed, 26 insertions(+), 75 deletions(-)
> 
> diff --git a/src/xenvbd/ring.c b/src/xenvbd/ring.c
> index 7008938..b572b07 100644
> --- a/src/xenvbd/ring.c
> +++ b/src/xenvbd/ring.c
> @@ -140,14 +140,6 @@ xen_wmb()
>      _WriteBarrier();
>  }
> 
> -static FORCEINLINE PFN_NUMBER
> -__Pfn(
> -    __in  PVOID                   VirtAddr
> -    )
> -{
> -    return
> (PFN_NUMBER)(ULONG_PTR)(MmGetPhysicalAddress(VirtAddr).QuadPart
> >> PAGE_SHIFT);
> -}
> -
>  static FORCEINLINE VOID
>  __RingInsert(
>      IN  PXENVBD_RING        Ring,
> @@ -761,13 +753,12 @@ RingUseIndirect(
>      return MaxIndirectSegs;
>  }
> 
> -static FORCEINLINE ULONG
> +static FORCEINLINE VOID
>  RingQueueRequestList(
>      IN  PXENVBD_RING    Ring,
>      IN  PLIST_ENTRY     List
>      )
>  {
> -    ULONG               Count = 0;
>      for (;;) {
>          PXENVBD_REQUEST Request;
>          PLIST_ENTRY     ListEntry;
> @@ -776,12 +767,10 @@ RingQueueRequestList(
>          if (ListEntry == List)
>              break;
> 
> -        ++Count;
>          Request = CONTAINING_RECORD(ListEntry, XENVBD_REQUEST,
> ListEntry);
>          __RingIncBlkifOpCount(Ring, Request);
>          QueueAppend(&Ring->PreparedReqs, &Request->ListEntry);
>      }
> -    return Count;
>  }
> 
>  static FORCEINLINE VOID
> @@ -813,7 +802,6 @@ RingPrepareReadWrite(
>      ULONG64                 SectorStart = Cdb_LogicalBlock(Srb);
>      ULONG                   SectorsLeft = Cdb_TransferBlock(Srb);
>      LIST_ENTRY              List;
> -    ULONG                   DebugCount;
> 
>      Srb->SrbStatus = SRB_STATUS_PENDING;
> 
> @@ -852,13 +840,7 @@ RingPrepareReadWrite(
>          SectorStart += SectorsDone;
>      }
> 
> -    DebugCount = RingQueueRequestList(Ring, &List);
> -    if (DebugCount != (ULONG)SrbExt->RequestCount) {
> -        Trace("[%u] %d != %u\n",
> -              FrontendGetTargetId(Ring->Frontend),
> -              SrbExt->RequestCount,
> -              DebugCount);
> -    }
> +    RingQueueRequestList(Ring, &List);
>      return TRUE;
> 
>  fail3:
> @@ -880,7 +862,6 @@ RingPrepareSyncCache(
>      PXENVBD_REQUEST         Request;
>      LIST_ENTRY              List;
>      UCHAR                   Operation;
> -    ULONG                   DebugCount;
> 
>      Srb->SrbStatus = SRB_STATUS_PENDING;
> 
> @@ -902,13 +883,7 @@ RingPrepareSyncCache(
>      Request->Operation  = Operation;
>      Request->FirstSector = Cdb_LogicalBlock(Srb);
> 
> -    DebugCount = RingQueueRequestList(Ring, &List);
> -    if (DebugCount != (ULONG)SrbExt->RequestCount) {
> -        Trace("[%u] %d != %u\n",
> -              FrontendGetTargetId(Ring->Frontend),
> -              SrbExt->RequestCount,
> -              DebugCount);
> -    }
> +    RingQueueRequestList(Ring, &List);
>      return TRUE;
> 
>  fail1:
> @@ -929,7 +904,6 @@ RingPrepareUnmap(
>       ULONG                   Count = _byteswap_ushort(*(PUSHORT)Unmap-
> >BlockDescrDataLength) / sizeof(UNMAP_BLOCK_DESCRIPTOR);
>      ULONG                   Index;
>      LIST_ENTRY              List;
> -    ULONG                   DebugCount;
> 
>      Srb->SrbStatus = SRB_STATUS_PENDING;
> 
> @@ -953,13 +927,7 @@ RingPrepareUnmap(
>          Request->Flags          = 0;
>      }
> 
> -    DebugCount = RingQueueRequestList(Ring, &List);
> -    if (DebugCount != (ULONG)SrbExt->RequestCount) {
> -        Trace("[%u] %d != %u\n",
> -              FrontendGetTargetId(Ring->Frontend),
> -              SrbExt->RequestCount,
> -              DebugCount);
> -    }
> +    RingQueueRequestList(Ring, &List);
>      return TRUE;
> 
>  fail1:
> @@ -1113,23 +1081,6 @@ RingCompleteShutdown(
>      }
>  }
> 
> -static FORCEINLINE PCHAR
> -__BlkifOperationName(
> -    IN  UCHAR   Operation
> -    )
> -{
> -    switch (Operation) {
> -    case BLKIF_OP_READ:             return "READ";
> -    case BLKIF_OP_WRITE:            return "WRITE";
> -    case BLKIF_OP_WRITE_BARRIER:    return "WRITE_BARRIER";
> -    case BLKIF_OP_FLUSH_DISKCACHE:  return "FLUSH_DISKCACHE";
> -    case BLKIF_OP_RESERVED_1:       return "RESERVED_1";
> -    case BLKIF_OP_DISCARD:          return "DISCARD";
> -    case BLKIF_OP_INDIRECT:         return "INDIRECT";
> -    default:                        return "<unknown>";
> -    }
> -}
> -
>  static BOOLEAN
>  RingSubmitRequests(
>      IN  PXENVBD_RING    Ring
> @@ -1162,6 +1113,23 @@ RingSubmitRequests(
>      return Retry;
>  }
> 
> +static FORCEINLINE PCHAR
> +__BlkifOperationName(
> +    IN  UCHAR   Operation
> +    )
> +{
> +    switch (Operation) {
> +    case BLKIF_OP_READ:             return "READ";
> +    case BLKIF_OP_WRITE:            return "WRITE";
> +    case BLKIF_OP_WRITE_BARRIER:    return "WRITE_BARRIER";
> +    case BLKIF_OP_FLUSH_DISKCACHE:  return "FLUSH_DISKCACHE";
> +    case BLKIF_OP_RESERVED_1:       return "RESERVED_1";
> +    case BLKIF_OP_DISCARD:          return "DISCARD";
> +    case BLKIF_OP_INDIRECT:         return "INDIRECT";
> +    default:                        return "<unknown>";
> +    }
> +}
> +
>  static VOID
>  RingCompleteResponse(
>      IN  PXENVBD_RING    Ring,
> @@ -1463,23 +1431,23 @@ RingDebugCallback(
> 
>      XENBUS_DEBUG(Printf,
>                   &Ring->DebugInterface,
> -                 "TARGET: BLKIF_OPs: READ=%u WRITE=%u\n",
> +                 "BLKIF_OPs: READ=%u WRITE=%u\n",
>                   Ring->BlkOpRead,
>                   Ring->BlkOpWrite);
>      XENBUS_DEBUG(Printf,
>                   &Ring->DebugInterface,
> -                 "TARGET: BLKIF_OPs: INDIRECT_READ=%u
> INDIRECT_WRITE=%u\n",
> +                 "BLKIF_OPs: INDIRECT_READ=%u INDIRECT_WRITE=%u\n",
>                   Ring->BlkOpIndirectRead,
>                   Ring->BlkOpIndirectWrite);
>      XENBUS_DEBUG(Printf,
>                   &Ring->DebugInterface,
> -                 "TARGET: BLKIF_OPs: BARRIER=%u DISCARD=%u FLUSH=%u\n",
> +                 "BLKIF_OPs: BARRIER=%u DISCARD=%u FLUSH=%u\n",
>                   Ring->BlkOpBarrier,
>                   Ring->BlkOpDiscard,
>                   Ring->BlkOpFlush);
>      XENBUS_DEBUG(Printf,
>                   &Ring->DebugInterface,
> -                 "TARGET: Segments Granted=%llu Bounced=%llu\n",
> +                 "Segments Granted=%llu Bounced=%llu\n",
>                   Ring->SegsGranted,
>                   Ring->SegsBounced);
> 
> diff --git a/src/xenvbd/target.c b/src/xenvbd/target.c
> index 4407c70..e624979 100644
> --- a/src/xenvbd/target.c
> +++ b/src/xenvbd/target.c
> @@ -53,11 +53,8 @@
>  #include "assert.h"
>  #include "util.h"
> 
> -#define TARGET_SIGNATURE           'odpX'
> -
>  struct _XENVBD_TARGET {
> -    ULONG                       Signature;
> -    PXENVBD_ADAPTER                 Adapter;
> +    PXENVBD_ADAPTER             Adapter;
>      PDEVICE_OBJECT              DeviceObject;
>      DEVICE_PNP_STATE            DevicePnpState;
>      DEVICE_PNP_STATE            PrevPnpState;
> @@ -77,7 +74,6 @@ struct _XENVBD_TARGET {
>      const CHAR*                 Reason;
>  };
> 
> -
> //=========================================================
> ====================
>  #define TARGET_POOL_TAG            'odPX'
> 
>  __checkReturn
> @@ -102,8 +98,6 @@ __TargetFree(
>          __FreePoolWithTag(Buffer, TARGET_POOL_TAG);
>  }
> 
> -
> //=========================================================
> ====================
> -// Debug
>  static FORCEINLINE PCHAR
>  __PnpStateName(
>      __in DEVICE_PNP_STATE        State
> @@ -215,8 +209,6 @@ TargetSetDeviceObject(
>      Target->DeviceObject = DeviceObject;
>  }
> 
> -
> //=========================================================
> ====================
> -// SRBs
>  __checkReturn
>  static FORCEINLINE BOOLEAN
>  __ValidateSectors(
> @@ -766,14 +758,6 @@ __ValidateSrbForTarget(
>  {
>      const UCHAR             Operation = Cdb_OperationEx(Srb);
> 
> -    if (Target == NULL) {
> -        Error("Invalid Target(NULL) (%02x:%s)\n",
> -              Operation,
> -              Cdb_OperationName(Operation));
> -        Srb->SrbStatus = SRB_STATUS_INVALID_TARGET_ID;
> -        return FALSE;
> -    }
> -
>      if (Srb->PathId != 0) {
>          Error("Target[%d] : Invalid PathId(%d) (%02x:%s)\n",
>                TargetGetTargetId(Target),
> @@ -1302,7 +1286,6 @@ TargetCreate(
>          goto fail1;
> 
>      Verbose("Target[%d] : Creating\n", TargetId);
> -    Target->Signature       = TARGET_SIGNATURE;
>      Target->Adapter         = Adapter;
>      Target->DeviceObject    = NULL; // filled in later
>      Target->DevicePnpState  = Present;
> --
> 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®.