enable UNMAP when LUN is thin provisioned

- support Block Limits VPD page (0xB0)
 - add UNMAP to REPORT SUPPORTED OPERATION CODES
 - READ CAPACITY(16): set LBPME when Thin provisioning is enabled
 - move Thinprovisioning and BlockShift to config
 - add Unmap to BackingStore
This commit is contained in:
chessman
2019-05-21 12:54:55 +03:00
parent e2192b7b01
commit 22d47a9212
10 changed files with 86 additions and 17 deletions

View File

@@ -295,7 +295,13 @@ sense:
}
func SBCUnmap(host int, cmd *api.SCSICommand) api.SAMStat {
return api.SAMStatGood
err, key, asc := bsPerformCommand(cmd.Device.Storage, cmd)
if err == nil {
return api.SAMStatGood
}
BuildSenseData(cmd, key, asc)
return api.SAMStatCheckCondition
}
/*
@@ -594,7 +600,11 @@ func SBCReadCapacity16(host int, cmd *api.SCSICommand) api.SAMStat {
if allocationLength > 12 {
copy(cmd.InSDBBuffer.Buffer[8:], util.MarshalUint32(uint32(1<<bshift)))
if allocationLength > 16 {
val := (cmd.Device.Attrs.Lbppbe << 16) | cmd.Device.Attrs.LowestAlignedLBA
var lbpme int
if cmd.Device.Attrs.Thinprovisioning {
lbpme = 1
}
val := (cmd.Device.Attrs.Lbppbe << 16) | (lbpme << 15) | cmd.Device.Attrs.LowestAlignedLBA
copy(cmd.InSDBBuffer.Buffer[12:], util.MarshalUint32(uint32(val)))
}
}