X3T9.2/91-090 Rev. 0 To: X3T9.2 (SCSI Committee) From: Paul Boulay Hitachi Computer Products (voice (408) 986-9770, fax (408) 986-1821, e-mail pboulay@ipd.hitachi.com) Subject: Media Scan Command, SCSI-2, Chapter 15 Thanks to Gary Stevens, some inconsistencies in the SCSI-2 (10c and 10d) Media Scan command (Section 15.2.3.) have been noticed. In this note I've gone over these things and made my personal recommendations. The text of the standard is indented to set it apart from my commentary. A partial results acceptable (PRA) bit of zero indicates that the scan shall not be considered satisfied until a contiguous set of blocks is found within the scan area which is ([TO BE ADDED] (at least) [REPLACING, TO BE DELETED] greater than or) equal in size to the number of blocks requested, and meets the other criteria specified in the command descriptor block. Change the above sentence to delete the "greater than". It was never the intent to require the target to actually determine the extent of the matching area beyond the requested size, simply that one of the requested size exists. Nor was it required that a chunk match the size exactly. This last case is probably the origin of the "greater than". Adding the parenthetical "(at least)" acknowledges this case without confusing the subject further. If an initiator needs to determine the extent of an area once its starting point has been established a second command can be issued. (For example, if the first command was to find the next instance of 20 blank blocks, the follow up could be to find the next instance of 1 written block starting the scan in the just determined blank area.) A PRA bit of one indicates that the scan may be satisfied by a contiguous set of blocks within the scan area which is less than the number of blocks requested, and meets the other criteria specified in the command descriptor block. ([TO BE DELETED] In this case, the target shall determine the largest contiguous set of blocks in the scan area for reporting to the initiator.) I suggest that we strike the last sentence. This creates the requirement that the whole scan area be searched for the largest chunk that meets the criteria. This is unnecessary because the host can get this effect by repeatedly issuing the command and saving the size and location of the largest matching chunk found so far. By insisting that the device find the largest extent, we eliminate the simpler case that the target should find the first instance. Actually the deleted sentence might make sense in the PRA bit is zero case. If no chunk is found that matches the criteria, then you return the second best. To fully specify this case you also have to say which of the possible largest but not up to the requested blocks sized chunks is to be reported - I would suggest the first. But this is not a satisfied scan operation - perhaps we should call it a completed scan operation - so to do this you have to change some of the Request Sense rules to allow at least the valid bit to be set in this case. Perhaps we should make this change but I have not done so here. If deemed appropriate, this might be a SCSI-3 issue. A REQUEST SENSE command following a satisfied MEDIUM SCAN command shall: (1) Return a sense key of EQUAL if the scan was satisfied by a contiguous set of blocks equal in size to the number of blocks requested. If the PRA bit is one and the scan was satisfied by a contiguous set of blocks ([TO BE ADDED] less than [IN PLACE OF, TO BE DELETED] not equal in size to) the number of blocks requested, then a sense key of NO SENSE shall be returned. I've retained the "equal in size" statement in the first clause which is the precedent for dropping the "greater than" in the PRA bit of zero definition. In the second sentence of clause (1), I've added the phrase "if the PRA bit is one" to point out that this the only case where a scan would be satisfied with a not equal case. I also changed the "not equal" to "less than" which is in line with the intended action of the PRA bit is one case. The fundamental question is "does the PRA bit modify the operation of the scan or just the reporting after it is finished?". If PRA is set, does the scan stop as soon as anything is found or does it continue to the end and then the second best block is reported. I don't recall if we ever addressed this in committee. The current language of the PRA bit is one case - "the scan may be satisfied" - says to me that the scan STOPS as soon as the first area is found. The target has to qualify this area to the extent of the original request (report equal or not) but that's all. My recommendations here are consistent with this reading.