From 6826cb092ab73124c777c6cdf13b2cc1d81a7d18 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Tue, 6 Aug 2019 13:51:14 -0500 Subject: [PATCH] Fix man unmap len reporting commit 117e84c Author: Yaowei Bai baiyaowei@cmss.chinamobile.com Date: Tue Sep 18 18:29:44 2018 +0800 libtcmu: move SCSI helpers out of libtcmu added a regression where we always return the default max unmap len instead of the handler specific one. This adds back the code to return the handler specified value. --- scsi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scsi.c b/scsi.c index 6f86328d..7d94bf62 100644 --- a/scsi.c +++ b/scsi.c @@ -317,7 +317,6 @@ int tcmu_emulate_evpd_inquiry( { char data[64]; uint32_t max_xfer_length; - uint32_t opt_unmap_gran; uint32_t unmap_gran_align; uint16_t val16; uint32_t val32; @@ -363,7 +362,7 @@ int tcmu_emulate_evpd_inquiry( if (tcmu_dev_get_unmap_enabled(dev)) { /* MAXIMUM UNMAP LBA COUNT */ - val32 = htobe32(VPD_MAX_UNMAP_LBA_COUNT); + val32 = htobe32(tcmu_dev_get_max_unmap_len(dev)); memcpy(&data[20], &val32, 4); /* MAXIMUM UNMAP BLOCK DESCRIPTOR COUNT */ @@ -371,8 +370,7 @@ int tcmu_emulate_evpd_inquiry( memcpy(&data[24], &val32, 4); /* OPTIMAL UNMAP GRANULARITY */ - opt_unmap_gran = tcmu_dev_get_opt_unmap_gran(dev); - val32 = htobe32(opt_unmap_gran); + val32 = htobe32(tcmu_dev_get_opt_unmap_gran(dev)); memcpy(&data[28], &val32, 4); /* UNMAP GRANULARITY ALIGNMENT */