# option 'sense_format' '0'
# Rotaion rate: 0: not reported, 1: non-rotational medium (SSD), 2-1024: reserverd, 1025+: "Nominal rotation rate"
# option 'rotation_rate' '0'
+# A thin-provisioned LUN is represented as a sparse file.
+# When initiators use the SCSI UNMAP command TGTD will release the affected areas back to the filesystem using FALLOC_FL_PUNCH_HOLE.
+# This option applies to the disk type and rdwr bstype
+# option 'thin_provisioning' '1'
#config lun 2_1
# option device /mnt/iscsi.img
'scsi_sn:string' \
'sense_format:range(0, 1)' \
'vendor_id:string' \
- 'rotation_rate:uinteger'
+ 'rotation_rate:uinteger' \
+ 'thin_provisioning:bool:0'
}
handle_lun() {
bsoflags="--bsoflags $bsoflags"
fi
+ if [ "$thin_provisioning" -eq 1 ]; then
+ [ "$type" = disk ] || {
+ $logger "Thin provisioning is supported only for the 'disk' type"
+ return 1
+ }
+ [ "$bstype" = rdwr ] || {
+ $logger "Thin provisioning is supported onfy for the 'rdwr' bstype"
+ return 1
+ }
+ fi
+
blocksize=${blocksize+--blocksize=$blocksize}
local params='' i
- for i in mode_page product_id product_rev readonly removable scsi_id scsi_sn sense_format vendor_id rotation_rate; do
+ for i in mode_page product_id product_rev readonly removable scsi_id scsi_sn sense_format vendor_id rotation_rate thin_provisioning; do
eval params=\${$i+$i=\$$i,}\$params
done