Patent ID: 7975095

Claim:
A method of caching access a hard disk, comprising: (a) establishing a management table, the management table comprising a plurality of storage sectors, a plurality of cache buffers, a plurality of main blocks and a plurality of overflow blocks, the management table determining a relationship between logical block addresses in a hard disk and physical block addresses in a flash memory; (b) determining whether to reconstruct the management table; (c) reconstructing the management table by calculating the corresponding logical block address index in flash-memory block pages to determine if the flash memory block is a main block or an overflow block of a certain cache buffer, wherein the step (c) comprises the steps of: (c1) inspecting every physical memory block of the flash memory; (c2) determining whether the flash memory block contains data; (c3) determining whether blank pages are between data pages, wherein the step (c3) further comprises the steps of: (c31) determining whether all data page indices are consistent with indices computed with stored data logical block address; (c32) setting this physical memory block as a main block or an overflow block depending on the needs of management table; (c33) based on the block status of cache buffer, determining whether physical memory block is a main block or an overflow block; (c4) according to logical block address corresponding to physical flash-memory page of the main block, or physical flash-memory page of overflow block, determining the storage sector to which the cache buffer belongs; and (c5) sending this information into management table; (d) detecting whether to recycle cache space; (e) recycling cache space when the overflow block is filled and new data in the main block are colliding; (f) detecting whether to replace the cache data; (g) replacing original cache data temporarily stored in the main block and the overflow block of a cache buffer; (h) detecting whether the cache data temporarily stored in the flash memory is read from or write to the flash memory; (i) reading the cache data from the main block or overflow block of the cache buffer which corresponds to logical block address of hard disk to be read, and sending the cache data to a host device; and (j) temporarily storing the written cache data into the main block or overflow block of the cache buffer which corresponds to logical block address of hard disk to be written.