[stgt] [PATCH] VPD : Update BLOCK LIMITS page with UNMAP and COMPARE_AND_WRITE limits
Ronnie Sahlberg
ronniesahlberg at gmail.com
Sat Apr 21 22:57:17 CEST 2012
---
usr/spc.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/usr/spc.c b/usr/spc.c
index eb435ae..ce6826f 100644
--- a/usr/spc.c
+++ b/usr/spc.c
@@ -157,6 +157,22 @@ static void update_vpd_b2(struct scsi_lu *lu, void *id)
}
}
+static void update_vpd_b0(struct scsi_lu *lu, void *id)
+{
+ struct vpd *vpd_pg = lu->attrs.lu_vpd[PCODE_OFFSET(0xb0)];
+
+ /* maximum compare and write length : 64kb */
+ vpd_pg->data[1] = 128;
+
+ if (lu->attrs.thinprovisioning) {
+ /* maximum unmap lba count : maximum*/
+ put_unaligned_be32(0xffffffff, vpd_pg->data + 16);
+
+ /* maximum unmap block descriptor count : maximum*/
+ put_unaligned_be32(0xffffffff, vpd_pg->data + 20);
+ }
+}
+
static void update_b0_opt_xfer_gran(struct scsi_lu *lu, int opt_xfer_gran)
{
struct vpd *vpd_pg = lu->attrs.lu_vpd[PCODE_OFFSET(0xb0)];
@@ -1776,6 +1792,7 @@ tgtadm_err lu_config(struct scsi_lu *lu, char *params, match_fn_t *fn)
match_strncpy(buf, &args[0], sizeof(buf));
attrs->thinprovisioning = atoi(buf);
/* update the provisioning vpd page */
+ lu_vpd[PCODE_OFFSET(0xb0)]->vpd_update(lu, NULL);
lu_vpd[PCODE_OFFSET(0xb2)]->vpd_update(lu, NULL);
break;
case Opt_online:
@@ -1848,6 +1865,8 @@ int spc_lu_init(struct scsi_lu *lu)
lu_vpd[pg] = alloc_vpd(BLOCK_LIMITS_VPD_LEN);
if (!lu_vpd[pg])
return -ENOMEM;
+ lu_vpd[pg]->vpd_update = update_vpd_b0;
+ lu_vpd[pg]->vpd_update(lu, NULL);
/* VPD page 0xb2 LOGICAL BLOCK PROVISIONING*/
pg = PCODE_OFFSET(0xb2);
--
1.7.3.1
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list