|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 1/2] Correct reporting of unmap granularity
blkif.h specifies discard-alignment and discard-granularity as being in
byte unit. These values must be converted to LBA unit in the
corresponding inquiry outputs.
Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
src/xenvbd/target.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/xenvbd/target.c b/src/xenvbd/target.c
index e4a9c03..102e8b8 100644
--- a/src/xenvbd/target.c
+++ b/src/xenvbd/target.c
@@ -842,6 +842,7 @@ TargetInquiryB0(
)
{
PXENVBD_FEATURES Features = FrontendGetFeatures(Target->Frontend);
+ PXENVBD_DISKINFO DiskInfo = FrontendGetDiskInfo(Target->Frontend);
PVPD_BLOCK_LIMITS_PAGE Data = Srb->DataBuffer;
ULONG Length = Srb->DataTransferLength;
@@ -867,8 +868,10 @@ TargetInquiryB0(
* default.
*/
*(PULONG)Data->MaximumUnmapBlockDescriptorCount = _byteswap_ulong(8);
- *(PULONG)Data->OptimalUnmapGranularity =
_byteswap_ulong(Features->DiscardGranularity);
- *(PULONG)Data->UnmapGranularityAlignment =
_byteswap_ulong(Features->DiscardAlignment);
+ *(PULONG)Data->OptimalUnmapGranularity =
+ _byteswap_ulong(Features->DiscardGranularity / DiskInfo->SectorSize);
+ *(PULONG)Data->UnmapGranularityAlignment =
+ _byteswap_ulong(Features->DiscardAlignment / DiskInfo->SectorSize);
// alignment is only valid if a granularity has been set
Data->UGAValid = (Features->DiscardGranularity != 0) ? 1 : 0;
--
2.53.0.windows.2
--
Ngoc Tu Dinh | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |