Author: mav
Date: Sat Oct 15 14:40:34 2016
New Revision: 307374
URL: https://svnweb.freebsd.org/changeset/base/307374

Log:
  Add LU option to control reported provisioning type.
  
  MFC after:    2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/usr.sbin/ctladm/ctladm.8

Modified: head/sys/cam/ctl/ctl.c
==============================================================================
--- head/sys/cam/ctl/ctl.c      Sat Oct 15 13:45:12 2016        (r307373)
+++ head/sys/cam/ctl/ctl.c      Sat Oct 15 14:40:34 2016        (r307374)
@@ -10040,6 +10040,7 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio *
 {
        struct scsi_vpd_logical_block_prov *lbp_ptr;
        struct ctl_lun *lun;
+       const char *value;
 
        lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
 
@@ -10077,7 +10078,14 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio *
        if (lun != NULL && lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) {
                lbp_ptr->flags = SVPD_LBP_UNMAP | SVPD_LBP_WS16 |
                    SVPD_LBP_WS10 | SVPD_LBP_RZ | SVPD_LBP_ANC_SUP;
-               lbp_ptr->prov_type = SVPD_LBP_THIN;
+               value = ctl_get_opt(&lun->be_lun->options, "provisioning_type");
+               if (value != NULL) {
+                       if (strcmp(value, "resource") == 0)
+                               lbp_ptr->prov_type = SVPD_LBP_RESOURCE;
+                       else if (strcmp(value, "thin") == 0)
+                               lbp_ptr->prov_type = SVPD_LBP_THIN;
+               } else
+                       lbp_ptr->prov_type = SVPD_LBP_THIN;
        }
 
        ctl_set_success(ctsio);

Modified: head/usr.sbin/ctladm/ctladm.8
==============================================================================
--- head/usr.sbin/ctladm/ctladm.8       Sat Oct 15 13:45:12 2016        
(r307373)
+++ head/usr.sbin/ctladm/ctladm.8       Sat Oct 15 14:40:34 2016        
(r307374)
@@ -903,8 +903,14 @@ Specifies medium rotation rate of the de
 .It Va formfactor
 Specifies nominal form factor of the device: 0 -- not reported, 1 -- 5.25",
 2 -- 3.5", 3 -- 2.5", 4 -- 1.8", 5 -- less then 1.8".
+.It Va provisioning_type
+When UNMAP support is enabled, this option specifies provisioning type:
+"resource", "thin" or "unknown".
+Default value is "thin".
+Logical units without UNMAP support are reported as fully provisioned.
 .It Va unmap
-Set to "on", enables UNMAP support for the LUN, if supported by the backend.
+Setting to "on" or "off" controls UNMAP support for the logical unit.
+Default value is "on" if supported by the backend.
 .It Va unmap_max_lba
 .It Va unmap_max_descr
 Specify maximum allowed number of LBAs and block descriptors per UNMAP
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to