A write cache provides for staging of data units written from a processor for recording in a disk. The order in which destages and validations occur is controlled to make validations more efficient. The data units are arranged in a circular
queue according to their respective
disk storage addresses. Each data unit is tagged with a state value of 1, 0, or −1. A destaging pointer is advanced one-by-one to each data unit like the hand of a
clock. Each data unit pointed to is evaluated as a destage victim. The first step is to check its state value. A data unit newly brought into the write cache will have its state value reset to 0. It will stay that way until it receives an overwrite x command or the destage pointer clocks around to x. If an overwrite x, the state value is set to 1, in a way, indicating recent use of the data unit and postponing its destaging and eviction. If the destage pointer clocks around to x when the state was 0, then it's time to destage x and the state value is changed to −1. A write to the disk occurs and a later read will be used to verify the write. If the state value was already 1 when the destage pointer clocks around to x, the state value is reset to 0. If the destage pointer clocks around to x when the state is −1, the associated data is read from the disk and validated to be same as the copy in cache. If not, the destage of x is repeated, and the state value remains as −1. Otherwise, if the associated read for validation did return a success, then data unit x is evicted from the write cache.