CPC G06F 3/064 (2013.01) [G06F 3/0658 (2013.01); G06F 3/0659 (2013.01); G06F 3/0679 (2013.01); G06F 12/0246 (2013.01); G06F 12/10 (2013.01); G06F 3/0604 (2013.01)] | 15 Claims |
1. A method for accessing a flash memory module, wherein the flash memory module comprises a plurality of blocks, and the method comprises the steps of:
writing data into a plurality of pages of a specific block, and establishes or updates a physical address to logical address mapping table (F2H mapping table) based on physical addresses of the plurality of pages and logical addresses of the data;
using the F2H mapping table to update a logical address to physical address mapping table (H2F mapping table);
initializing a flush-bitmap, wherein the flush-bitmap records a plurality of flush bits corresponding to the physical addresses of the plurality of pages, respectively; and if the flush bit has a first logical value, the corresponding physical address and logical address in the F2H table has not been updated to the H2F mapping table, and if the flush bit has a second logical value, the corresponding physical address and logical address in the F2H table is updated to the H2F mapping table;
receiving a trim command from a host device, wherein the trim command asks to mark at least one of the logical addresses of the data as invalid;
updating the H2F mapping data to generate an updated H2F mapping table according to the trim command;
updating the flush-bitmap to generate an updated flush-bitmap according to the trim command; and
writing the updated H2F mapping table and the updated flush-bitmap into the flash memory module.
|