CROSS-REFERENCE TO RELATED APPLICATION

This application claims priority to Chinese Patent Application No. CN201810801996.4, on file at the China National Intellectual Property Administration (CNIPA), having a filing date of Jul. 20, 2018, and having “METHOD, APPARATUS AND COMPUTER PROGRAM PRODUCT FOR MANAGING CACHE” as a title, the contents and teachings of which are herein incorporated by reference in their entirety.

FIELD

Embodiments of the present disclosure generally relate to the field of data storage, and specifically to a method, an apparatus and a computer program product for managing cache.

BACKGROUND

A storage system usually has a plurality of disks. The disks can be divided into a group of disk extents (briefly called DE) of a fixed size. For the purpose of data redundancy backup and/or performance improvement, it is possible to use a plurality of disk extents to build a redundant array of independent disks (RAID). The RAID built based on disk extents of the disk but not the whole disk is also called “mapped RAID”. To ensure reliability of the mapped RAID, some spare disk extents are usually reserved in the plurality of disks. When a certain disk in the plurality of disks fails, these spare disk extents can be used to rebuild a RAID strip associated with the failure, thereby avoiding occurrence of data loss. However, when the mapped RAID does not fail, these spare disk extents are normally not used.

In addition, to improve access performance of the storage system, there is usually a cache built using a disk (e.g., a flash memory, or a solid-state disk etc.) having a higher access speed in the storage system for caching data which is accessed frequently. However, the capacity of such cache is usually limited.

SUMMARY

Embodiments of the present disclosure provide a method, an apparatus and a computer program product for managing a cache.

According to a first aspect of the present disclosure, there is provided a method of managing a cache. The method includes creating a primary cache by a cache management module in a storage system. The method further includes: in response to the primary cache being created, sending a first request to a hardware management module in the storage system to obtain first information about a first virtual disk in the storage system. The storage system includes at least one physical disk having a plurality of extents, the plurality of extents include a first group of extents for creating a first disk array, and the first virtual disk is created by the hardware management module based on at least one spare extent from the first group of extents, the at least one spare extent from the first group of extents is reserved for rebuilding the first disk array. The method further includes: in response to receiving the first information from the hardware management module, creating a secondary cache using the first virtual disk. In addition, the method further includes: in response to an available capacity of the primary cache being below a predetermined threshold, flushing at least one cache page in the primary cache to the secondary cache.

According to a second aspect of the present disclosure, there is provided an apparatus for managing a cache. The apparatus includes at least one processing unit and at least one memory. The at least one memory is coupled to the at least one processing unit and has instructions stored thereon and executed by the at least one processing unit. The instructions, when executed by the at least one processing unit, causes the apparatus to perform acts, the acts including: creating a primary cache in a storage system; in response to the primary cache being created, sending a first request to a hardware management module in the storage system to obtain first information about a first virtual disk in the storage system, wherein the storage system includes at least one physical disk having a plurality of extents, the plurality of extents include a first group of extents for creating a first disk array, and the first virtual disk is created by the hardware management module based on at least one spare extent from the first group of extents, the at least one spare extent from the first group of extents is reserved for rebuilding the first disk array; in response to receiving the first information from the hardware management module, creating a secondary cache using the first virtual disk; and in response to an available capacity of the primary cache being below a predetermined threshold, flushing at least one cache page in the primary cache to the secondary cache.

According to a third aspect of the present disclosure, there is provided a computer program product that is tangibly stored on a non-transient computer readable medium and includes machine-executable instructions. The machine-executable instructions, when being executed by an apparatus, cause the apparatus to execute any step of the method described according to the first aspect of the present disclosure.

This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.

