A cache is maintained with write order numbers that indicate orders of writes into the cache, so that periodic partial flushes of the cache can be executed while maintaining write order consistency. A method of storing data into the cache includes receiving a request to write data into the cache, identifying lines in the cache for storing the data, writing the data into the lines of the cache, storing a write order number, and associating the write order number with the lines of the cache. A method of flushing a cache having cache lines associated with write order numbers includes the steps of identifying lines in the cache that are associated with either a selected write order number or a write order number that is less than the selected write order number, and flushing data stored in the identified lines to a persistent storage.
Legal claims defining the scope of protection, as filed with the USPTO.
1. A method of storing data into a storage cache and maintaining write order numbers that indicate data dependency of writes into the storage cache, the method comprising: providing a cache map and a consistency group set for the storage cache, the storage cache including a plurality of cache lines, the cache map keeping a write order number associated with each cache line of the plurality of cache lines, the write order number tracking an order in which data is written into the plurality of cache lines, the consistency group set including a list of write order numbers wherein each of the write order numbers in the consistency group set is used to identify cache lines to be flushed together to maintain write order consistency; receiving a request to access the storage cache; upon determining that the access request is a write request to a dirty cache line, wherein the dirty cache line is a cache line associated with a non-zero first write order number in the cache map: incrementing a value of a write order counter; writing data into the dirty cache line; replacing the first write order number in the cache map with a second write order number, the second write order number having a value equal to the value of the write order counter; adding the second write order number into the consistency group set; and removing, from the write order numbers in the consistency group set, any write order numbers that are greater than or equal to the first write order number and less than the second write order number; receiving a request to execute a partial cache flush using a selected write order number from the consistency group set; and executing the partial cache flush to persistent storage based on the selected write order number in response to the received request, wherein executing the partial cache flush includes flushing all cache lines associated with a write order number no larger than the selected write order number and keeping any cache lines associated with a write order number that meets or exceeds the selected write order number.
2. The method of claim 1 , wherein the lines of the storage cache are associated with a plurality of different write order numbers.
3. The method of claim 1 , further comprising: receiving an additional request to write data into the storage cache; identifying additional lines in the cache associated with a write order number of zero for storing the data of the additional request; writing the data of the additional request into the additional lines of the storage cache; assigning the additional lines of the storage cache the write order number equal to a value of the incremented write order counter; storing the assigned write order number in the consistency group set; and incrementing the incremented write order counter.
4. The method of claim 3 , wherein a write order number associated with data of the additional write request is the value of the incremented write order counter.
5. The method of claim 3 , wherein the additional request to write data into the storage cache is generated in response to a read request that is directed to data not stored in the storage cache.
6. The method of claim 1 , wherein partially flushing the storage cache is performed when a threshold value of available storage capacity of the storage cache is reached.
7. The method of claim 1 , wherein executing the partial flush comprises flushing lines that do not have any data dependencies on any other data remaining in the storage cache.
8. A system for storing data into a storage cache and maintaining write order numbers that indicate data dependency of writes into the storage cache, the system comprising: persistent storage; and at least one processor associated with the system, the at least one processor programmed to: provide a cache map and a consistency group set for the storage cache, the storage cache including a plurality of cache lines, the cache map keeping a write order number associated with each cache line of the plurality of cache lines, the write order number tracking an order in which data is written into the plurality of cache lines, the consistency group set including a list of write order numbers wherein each of the write order numbers in the consistency group set is used to identify cache lines to be flushed together to maintain write order consistency; receive a request to access the storage cache; upon determining that the access request is a write request to a dirty cache line, wherein the dirty cache line is a cache line associated with a non-zero first write order number in the cache map: increment a value of a write order counter; write data into the dirty cache line; replace the first order number in the cache map with a second write order number, the second write order number having a value equal to the value of the write order counter; add the second write order number into the consistency group set; and remove, from the write order numbers in the consistency group set, any write order numbers that are greater than or equal to the first write order number and less than the second write order number; receive a request to execute a partial cache flush using a selected write order number from the consistency group set; and execute the partial cache flush to the persistent storage based on the selected write order number in response to the received request, wherein executing the partial cache flush includes flushing all cache lines associated with a write order number no larger than the selected write order number and keeping any cache lines associated with a write order number that meets or exceeds the selected write order number.
9. The system of claim 8 , wherein the lines of the storage cache are associated with a plurality of different write order numbers.
10. The system of claim 8 , wherein the at least one processor is further programmed to: receive an additional request to write data into the storage cache; identify additional lines in the storage cache associated with a write order number of zero for storing the data of the additional request; write the data of the additional request into the additional lines of the storage cache; assign the additional lines of the storage cache the write order number equal to a value of the incremented write order counter; store the assigned write order number in the consistency group set; and increment the incremented write order counter.
11. The system of claim 10 , wherein a write order number associated with data of the additional write request is the value of the incremented write order counter.
12. The system of claim 10 , wherein the additional request to write data into the storage cache is generated in response to a read request that is directed to data not stored in the storage cache.
13. The system of claim 8 , wherein the at least one processor is further programmed to: receive an indication that the flushing failed; and in response to the received indication, re-attempt the flushing of the data stored in the identified lines.
14. The system of claim 8 , wherein the at least one processor is further programmed to: receive an indication that the flushing failed; in response to the received indication, select a different one of the plurality of write order numbers from the consistency group set; identify one or more data dependent lines that are associated with the selected different write order number, and excluding the first write order number, all write order numbers that were stored in the consistency group set before the selected different write order number was stored in the consistency group set; and flush data stored in the identified one or more data dependent lines to the persistent storage.
15. The system of claim 8 , wherein executing the partial flush comprises flushing lines that do not have any data dependencies on any other data remaining in the storage cache.
16. A non-transitory computer-readable storage medium comprising instructions for causing a computer system to perform a method of managing a storage cache using a plurality of write order numbers that indicate data dependency of writes into the storage cache, said method comprising: providing a cache map and a consistency group set for the storage cache, the storage cache including a plurality of cache lines, the cache map keeping a write order number associated with each cache line of the plurality of cache lines, the write order number tracking an order in which data is written into the plurality of cache lines, the consistency group set including a list of write order numbers wherein each of the write order numbers in the consistency group set is used to identify cache lines to be flushed together to maintain write order consistency; receiving a request to access the storage cache; upon determining that the access request is a write request to a dirty cache line, wherein the dirty cache line is a cache line associated with a non-zero first write order number in the cache map: incrementing a value of a write order counter; writing data into the dirty cache line; replacing the first write order number in the cache map with a second write order number, the second write order number having a value equal to the value of the write order counter; adding the second write order number into the consistency group set; and removing, from the write order numbers in the consistency group set, any write order numbers that are greater than or equal to the first write order number and less than the second write order number; receiving a request to execute a partial cache flush using a selected write order number from the consistency group set; and executing the partial cache flush to persistent storage based on the selected write order number in response to the received request, wherein executing the partial cache flush includes flushing all cache lines associated with a write order number no larger than the selected write order number and keeping any cache lines associated with a write order number that meets or exceeds the selected write order number.
17. The non-transitory computer-readable storage medium of claim 16 , wherein executing a partial cache flush comprises: flushing the data stored in all cache lines having a write order number no larger than the selected write order number without flushing the data stored in the lines having a write order number larger than the selected write order number from the consistency group set.
18. The non-transitory computer-readable storage medium of claim 16 , wherein executing a partial cache flush comprises flushing lines that do not have any data dependencies on any other data remaining in the storage cache.
19. The non-transitory computer-readable storage medium of claim 16 , wherein the method further comprises: maintaining a write order count that is incremented each time a new write request is received, wherein a write order number associated with data of the new write request that are stored in the storage cache is a current value of the write order counter.
20. The non-transitory computer-readable storage medium of claim 16 , wherein partially flushing the storage cache is performed when a threshold value of available storage capacity of the storage cache is reached.
Cooperative Patent Classification codes for this invention. Click any code to explore related patents in that topic.
June 5, 2012
August 20, 2019
Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.