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:
The flowchart of the method of protecting data in the cache memory of a storage system is illustrated in
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.