api: set the UNMAP fields when needed
@@ -211,6 +211,7 @@ void tcmu_zero_iovec(struct iovec *iovec, size_t iov_cnt)
iov_cnt--;
}
}
+
/*
* Copy data into an iovec, and consume the space in the iovec.
*
@@ -621,6 +622,7 @@ finish_page83:
/* Optimal xfer length */
memcpy(&data[12], &val32, 4);
+ if (rhandler->unmap) {
/* MAXIMUM UNMAP LBA COUNT */
val32 = htobe32(max_xfer_length);
memcpy(&data[20], &val32, 4);
@@ -632,6 +634,7 @@ finish_page83:
/* OPTIMAL UNMAP GRANULARITY */
val32 = htobe32(max_xfer_length);
memcpy(&data[28], &val32, 4);
+ }
/* MAXIMUM WRITE SAME LENGTH */
val64 = htobe64(VPD_MAX_WRITE_SAME_LENGTH);
