Method for writing data into flash memory is disclosed. The method includes storing the frequently updated data and the not-aligned data collectively into some of the physical memory blocks of the flash memory. In other words, the method collectively writes those data into the same physical memory blocks of the flash memory as far as possible. By doing this, the invalid physical memory pages in the physical memory blocks can be generated collectively. As a result, the storage releasing efficiency of garbage collection can be greatly improved.
Legal claims defining the scope of protection. Each claim is shown in both the original legal language and a plain English translation.
1. A method for writing data into flash memory, the flash memory including a control unit and a memory unit, in which the memory unit has a plurality of physical memory blocks, wherein the physical memory block includes a plurality of physical memory pages, and the control unit has a logical/physical address mapping table which is for recording a relation between logical addresses and physical addresses, the method comprising: receiving a writing instruction and a set of target data from a host by the control unit, in which the writing instruction includes a target logical address and a target data length corresponding to the set of target data; comparing the target data length with a threshold value by the control unit; when the target data length equals to or is smaller than the threshold value, the set of target data is determined to be a frequently-updated data and then stored into a first physical memory block; when the target data length is larger than the threshold value, determining whether the set of target data has a part of not-aligned target data which is not aligned to the physical memory page; and when the set of target data has the part of not-aligned target data, the part of not-aligned target data is then stored into a third physical memory block, and a part of aligned target data is then stored into a second physical memory block; wherein when the target data length is not an integral multiple of a storage size of one physical memory page, the target data has the part of not-aligned target data, and the part of not-aligned target data are data not filling one physical memory page to the full, and the part of aligned data are data filling at least one physical memory page to the full.
A method for writing data to flash memory, which has a control unit and a memory unit containing physical memory blocks divided into physical memory pages. The control unit uses a logical/physical address mapping table. The method involves receiving a write instruction and data from a host, including a target logical address and data length. The control unit compares the data length to a threshold. If the data length is at or below the threshold, the data is considered frequently-updated and stored in a first physical memory block. If the data length exceeds the threshold, the method checks if the data contains a not-aligned part (data not filling a full physical memory page). If so, the not-aligned part is stored in a third physical memory block, and the aligned part (data filling one or more full pages) is stored in a second physical memory block.
2. The method as in claim 1 , wherein the first physical memory block and the third physical memory block are the same physical memory block in the memory unit.
In the flash memory writing method described where frequently-updated data goes to a first physical memory block, not-aligned data goes to a third physical memory block, and aligned data goes to a second physical memory block, the first physical memory block and the third physical memory block are the *same* physical memory block within the memory unit. This means both the frequently updated data and any not-aligned data are written to the same memory block.
3. The method as in claim 2 , wherein the first physical memory block and the third physical memory block is the physical memory block which already stores at least a set of small data, or the physical memory block which already stores at least a set of not-aligned data; in which data length of the set of small data equals to or is smaller than the threshold value, and the set of not-aligned data is not aligned to the physical memory page.
In the flash memory writing method described where frequently-updated data goes to a first physical memory block, not-aligned data goes to a third physical memory block, and aligned data goes to a second physical memory block, and where the first physical memory block and third physical memory block are the same, that shared physical memory block is a block that *already* contains either small data (data length at or below the threshold) or not-aligned data (data not aligned to a physical memory page). Effectively, this combines new small or unaligned data with existing small or unaligned data into the same block.
4. The method as in claim 1 , wherein the first physical memory block and the third physical memory block are respectively erased physical memory blocks.
In the flash memory writing method described where frequently-updated data goes to a first physical memory block, not-aligned data goes to a third physical memory block, and aligned data goes to a second physical memory block, the first physical memory block (for frequently-updated data) and the third physical memory block (for not-aligned data) are *both* erased physical memory blocks. This means new, empty blocks are used for storing frequently-updated data and not-aligned data.
5. The method as in claim 1 , wherein the second physical memory block is an erased physical memory block or the physical memory block which already stores a set of aligned data.
In the flash memory writing method described where frequently-updated data goes to a first physical memory block, not-aligned data goes to a third physical memory block, and aligned data goes to a second physical memory block, the second physical memory block (for aligned data) is either an erased physical memory block *or* a physical memory block that already contains aligned data. This means aligned data can be written either to a new, empty block, or appended to an existing block of aligned data.
6. The method as in claim 1 , further comprising: updating the relation between logical addresses and physical addresses recorded in the logical/physical address mapping table according to the allocation of the set of target data.
The flash memory writing method described where frequently-updated data goes to a first physical memory block, not-aligned data goes to a third physical memory block, and aligned data goes to a second physical memory block, also includes updating the logical/physical address mapping table. This table maintains the relationship between logical addresses (used by the host) and physical addresses (within the flash memory). The table is updated based on how the data (frequently-updated, aligned, not-aligned) is allocated to the physical memory blocks, thus ensuring the system can retrieve the data later using its logical address.
7. The method as in claim 1 , wherein the threshold value equals to the storage size of the physical memory page.
In the flash memory writing method described where frequently-updated data goes to a first physical memory block, not-aligned data goes to a third physical memory block, and aligned data goes to a second physical memory block, the threshold value used to determine whether data is "frequently-updated" is equal to the storage size of one physical memory page. If the data size is less than or equal to the page size, it's considered frequently-updated; otherwise, the method checks for alignment.
Cooperative Patent Classification codes for this invention. Click any code to explore related patents in that topic.
September 18, 2009
August 27, 2013
Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.