Efficient mapping of data blocks in a flash cache
A storage device made up of multiple storage media is configured such that a flash memory serves as a cache for data stored on a backend storage device having one or more magnetic storage media. The storage device includes a controller configured to maintain a direct mapping from respective backend block addresses of the backend storage device to respective physical addresses of the flash memory. Such mapping is used to translate a backend block address of the backend storage device at which a first block is stored into a physical address of the flash memory at which the first block is cached.
1. A method, comprising:
receiving a request to access a first block stored in a storage device, the storage device having one or more magnetic storage media and the one or more magnetic storage media storing blocks addressable by block addresses;
determining whether the first block is cached in a caching device, the caching device having a flash memory configured to cache data stored in the storage device and the flash memory organized as blocks addressable by physical addresses which correspond to respective physical locations on the flash memory; and
if the first block is cached in the caching device, (i) translating a block address of the storage device at which the first block is stored into a physical address of the flash memory at which the first block is cached using a direct mapping from respective block addresses of the storage device to respective physical addresses of the flash memory and (ii) providing access to the first block cached in the caching device; otherwise, providing access to the first block stored in the storage device.
2. A storage system, comprising:
a storage device having one or more magnetic storage media storing blocks addressable by block addresses;
a caching device having a flash memory configured to cache data stored in the storage device, the flash memory organized as blocks addressable by physical addresses which correspond to respective physical locations on the flash memory; and
a controller configured to maintain a direct mapping from respective block addresses of the storage device to respective physical addresses of the flash memory.
3. The storage system of claim 2 , wherein the controller is further configured to translate a block address of the storage device at which a first block is stored into a physical address of the flash memory at which the first block is cached in response to a request for said first block.
4. The storage system of claim 2 , wherein the direct mapping is stored in a dynamic random access memory (DRAM) accessible to the controller.