Method of protecting cache memory data in storage system

Information

  • Patent Application
  • 20080016274
  • Publication Number
    20080016274
  • Date Filed
    July 13, 2006
    18 years ago
  • Date Published
    January 17, 2008
    16 years ago
Abstract
A method of protecting the cache memory data in a storage system is used to protect the data in the cache memory of a battery backed storage system. The method provides a preserved area in the random access memory (RAM) of the system for storing the information of disk cache items. When the storage system has a power failure, the battery backed function provides power to protect the data stored in the RAM of the system being lost. When the storage system resumes, the information stored in the preserved area preserves the data stored in the disk cache of the system RAM. After the storage system resumes, the data stored in the disk cache of the RAM of the system are written into the corresponding block device. These implement the power failure protection for the data stored in the disk cache of the RAM of the system.
Description

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention will become more fully understood from the detailed description given hereinbelow illustration only, and thus are not limitative of the present invention, and wherein:



FIG. 1 is a flowchart of the method of protecting data in the cache memory of a storage system of the present invention.





DETAILED DESCRIPTION OF THE INVENTION

The flowchart of the method of protecting data in the cache memory of a storage system is illustrated in FIG. 1. The method includes the following steps.


When the storage system starts, a preserved area with an appropriate length is preserved at an appropriate beginning position in the RAM of the storage system (S100). The appropriate beginning position of the preserved area is the position other than the RAM position needed for the initialization of the OS and the mapping position of the hardware in the RAM. The appropriate length is computed using the following formula: ((RAM size)/(disk cache item size)+1)*(entry size of the preserved area)+(UUID size). UUID is a universal unique identifier. When the OS of the storage system establishes the management mechanism of the memory visit area needed by the OS, the beginning position of the preserved area and the length are added in order to preserve the preserved area.


After the storage system runs, the operation of the system on the dirty and clean linked lists are monitored (S110). When it is detected that the system adds one disk cache item to the dirty linked list, an entry serial number of the preserved area is computed using the following formula: (position of disk cache item in RAM)/(disk cache item size) (S120). In accord with the computed entry serial number, the information of the position of the disk cache item in the RAM and the size of the disk cache item in the RAM is recorded in the entry (S130). When the system is detected to add one disk cache item to the clean linked list, an entry serial number of the preserved area is computed according to the position of disk cache item in the RAM using the following formula: (position of disk cache item in RAM) (disk cache item size). The information stored at the entry is deleted according to the computed entry serial number (S140).


When the storage system has a power failure, the battery backed function provides the power for the RAM of the system, protecting the data stored therein. It also provides a short-term power for the CPU of the storage system, so that the CPU can complete the task of synchronizing the data in the cache memory of the CPU to the RAM of the system (S150).


When the storage system resumes, the self test parameters of RAM in the basic input/output system (BIOS) of the storage system are modified to protect all the data stored in the RAM of the system. The preservation process of S100 is repeated. The position and size information of the disk cache items stored in the entries of the preservation area of the RAM of S100 are read. The data stored at the corresponding position in the RAM are preserved in accord with the position and size information (S160).


After the storage system resumes, the information of the disk cache items stored at each entry of the preservation area is read. The information is used to find the RAM at the corresponding position. The information of data to be written to the disk cache items, the name of the block device to be written with the disk cache items, and the position of the disk cache items in the block device is read from the corresponding position of the RAM. The data are then written to the corresponding block device in accord with the information (S170). These implement the protection for the data stored in the disk cache of the RAM of the system.


When all the data stored in the disk cache of the RAM of the system are written into the corresponding block device, the space of the disk cache preserved in the RAM when the storage system starts is released. The value of each entry in the preserved area of the RAM is set to zero (S180).


The invention being thus described, it will be obvious that the same may be varied in many ways. Such variations are not to be regarded as a departure from the spirit and scope of the invention, and all such modifications as would be obvious to one skilled in the art are intended to be included within the scope of the following claims.

Claims
  • 1. A method of protecting data stored in the cache memory of a storage system for protecting the data in the cache memory of a battery backed storage system, the method comprising the steps of: preserving an area with an appropriate length in an appropriate beginning position of the random access memory (RAM) of the storage system when the storage system starts;monitoring the operation of a dirty linked list and a clean linked list and storing or deleting the information of a disk cache item in the preserved area in accord with the monitored operation after the storage system starts;providing power to the RAM by the battery backed function for protecting the data stored in the RAM when the storage system has a power failure;reading the information of the disk cache item stored in the preserved area and preserving the corresponding data stored in the RAM in accord with the information when the storage system resumes; andreading the information of the disk cache item stored in the preserved area and writing the corresponding data stored in the RAM into the corresponding block device in accord with the information after the storage system resumes.
  • 2. The method of claim 1 further comprising the step of releasing the space of the preserved RAM and setting the values of a plurality of entries in the preserved area to zero.
  • 3. The method of claim 1, wherein the appropriate beginning position is a position other than the position of the RAM needed for initializing the operating system of the storage system and the mapping position of the hardware in the RAM.
  • 4. The method of claim 1, wherein the appropriate length is computed using the following formula: ((RAM size)/(disk cache item size)+1)*(entry size of the preserved area)+(UUID size), where UUID is a universal unique identifier.
  • 5. The method of claim 1, wherein the process of preserving the preserved area is achieved by adding the information of the beginning position and length of the preserved area to a management mechanism of the memory visit area needed for starting the operating system (OS) that is established by the OS of the storage system.
  • 6. The method of claim 1, wherein the information of the disk cache item includes the position of the disk cache item in the RAM and the size of the disk cache item.
  • 7. The method of claim 1, wherein the step of storing or deleting information of a disk cache item in the preserved area in accord with the monitored operation further includes the steps of: computing a serial number of an entry of the preserved area according to the position of the disk cache item in the RAM when adding one disk cache item to the dirty linked list;storing the information of the position of the disk cache item in the RAM and the size of the disk cache item to the entry; andcomputing a serial number of an entry of the preserved area according to the position of the disk cache item in the RAM and deleting the information stored in the entry when adding one disk cache item to the clean linked list.
  • 8. The method of claim 7, wherein the entry serial number is computed using the following formula: (position of disk cache item in RAM)/(disk cache item size).