provide offset and tl to DataSync

This commit is contained in:
chessman
2019-06-27 19:23:13 +03:00
parent d13122d350
commit 0b1ffd5704
6 changed files with 26 additions and 7 deletions

View File

@@ -87,8 +87,13 @@ func bsPerformCommand(bs api.BackingStore, cmd *api.SCSICommand) (err error, key
doWrite = true
goto write
case api.SYNCHRONIZE_CACHE, api.SYNCHRONIZE_CACHE_16:
if err = bs.DataSync(); err != nil {
panic(err)
if tl == 0 {
tl = int64(lu.Size - offset)
}
if err = bs.DataSync(int64(offset), tl); err != nil {
key = MEDIUM_ERROR
asc = ASC_READ_ERROR
break
}
break
case api.WRITE_VERIFY, api.WRITE_VERIFY_12, api.WRITE_VERIFY_16:
@@ -161,7 +166,7 @@ write:
goto sense
}
if ((opcode != api.WRITE_6) && (scb[1]&0x8 != 0)) || (pg.Data[0]&0x04 == 0) {
if err = bs.DataSync(); err != nil {
if err = bs.DataSync(int64(offset), tl); err != nil {
key = MEDIUM_ERROR
asc = ASC_READ_ERROR
goto sense