Write management mechanism for flash memory
阅读说明:本技术 用于闪存的写入管理机制 (Write management mechanism for flash memory ) 是由 杜建东 萧佳容 杨宗杰 于 2019-05-20 设计创作,主要内容包括:本发明公开了一种管理闪存模块的方法,该闪存模块包括多个区块,该多个区块中的一部分属于一备用池。该方法包括:在该备用池中预留至少一已抹除区块以利一写入操作的进行;监测该至少一已抹除区块的一已抹除时间;以及当该已抹除时间超过一临界值时,执行一替换操作以替换该至少一已抹除区块。本发明通过对于备用池的妥善管理,在有效地减少写入延迟的(通过在备用池中预留至少一个已抹除区块)同时,又避免潜在的存储器单元的物理性伤害(通过限制区块停留在已抹除状态的时间)。同时,本发明管理机制也进一步与垃圾数据回收操作结合,从而更合理地进行对已抹除区块的写入与替换。(The invention discloses a method for managing a flash memory module, wherein the flash memory module comprises a plurality of blocks, and one part of the blocks belongs to a spare pool. The method comprises the following steps: reserving at least one erased block in the spare pool to facilitate the proceeding of a write operation; monitoring an erased time of the at least one erased block; and when the erased time exceeds a threshold value, executing a replacement operation to replace the at least one erased block. The present invention effectively reduces write latency (by reserving at least one erased block in the spare pool) while avoiding potential physical damage to the memory cells (by limiting the time that the block stays in an erased state) through proper management of the spare pool. Meanwhile, the management mechanism of the invention is further combined with garbage data recovery operation, thereby more reasonably writing and replacing the erased blocks.)
1. A method of managing a flash memory module, the flash memory module including a plurality of blocks, a portion of the plurality of blocks belonging to a spare pool, the method comprising:
reserving at least one erased block in the spare pool to facilitate the proceeding of a write operation;
monitoring an erased time of the at least one erased block; and
when the erased time exceeds a threshold value, a replacement operation is performed to replace the at least one erased block.
2. The method of claim 1, wherein the spare pool comprises the at least one erased block and at least one written block.
3. The method of claim 1, wherein the step of monitoring the erase time of the at least one erased block comprises:
establishing a time stamp associated with the at least one erased block; and
and comparing the time information in the time stamp with the critical value regularly.
4. The method of claim 1, wherein the step of performing the replacement operation comprises:
and writing the at least one erased block.
5. The method of claim 4, wherein writing the at least one erased block comprises:
performing a garbage data recovery operation on a plurality of blocks in the flash memory module; and
and writing the at least one erased block by using the recovery data output by the garbage data recovery operation.
6. The method of claim 1, wherein the step of performing the replacement operation comprises:
selecting a first block from at least one written block in the spare pool, and performing an erasing operation on the first block; and
and replacing the at least one erased block with the first block, wherein the erased block has the erased time exceeding the threshold.
7. The method of claim 1, further comprising:
when an access command from a host is not received, the specific data is automatically read from the flash memory module and written back to the flash memory module.
8. A controller for managing a flash memory module, wherein the flash memory module includes a plurality of blocks, and a portion of the plurality of blocks belongs to a spare pool, the controller comprising:
a storage unit for storing a program code; and
a processing unit, coupled to the storage unit, for reading the program code from the storage unit to execute the program code, thereby performing the following operations:
reserving at least one erased block in the spare pool to facilitate the proceeding of a write operation;
monitoring an erased time of the at least one erased block; and
when the erased time exceeds a threshold value, a replacement operation is performed to replace the at least one erased block.
9. The controller according to claim 8, wherein the processing unit executes the program code to establish a time stamp associated with the at least one erased block; and comparing the time information in the time stamp with the critical value regularly.
10. The controller as recited in claim 8, wherein said processing unit executes said program code to write to said at least one erased block to perform said replacement operation.
11. The controller as recited in claim 10 wherein the processing unit executes the program code to perform a garbage collection operation on a plurality of blocks in the flash memory module; and writing the at least one erased block by utilizing the recovery data output by the garbage data recovery operation to execute the replacement operation.
12. The controller of claim 8, wherein the processing unit executes the program code to select at least a first block from the spare pool and perform an erase operation on the at least a first block; and replacing the at least one erased block with the at least one first block, the erased block having the erased time exceeding the threshold.
13. The controller as claimed in claim 8, wherein the controller is controlled by a host, and the processing unit executes the program code to automatically read specific data from the flash memory module and write back the specific data to the flash memory module when an access command issued by the host is not received.
14. A storage device, comprising:
the flash memory module comprises a plurality of blocks, and one part of the blocks belongs to a spare pool; and
a controller for accessing a flash memory module, comprising:
a storage unit for storing a program code; and
a processing unit, coupled to the storage unit, for reading the program code from the storage unit to execute the program code, thereby performing the following operations:
reserving at least one erased block in the spare pool to facilitate the proceeding of a write operation;
monitoring an erased time of the at least one erased block; and
when the erased time exceeds a threshold value, a replacement operation is performed to replace the at least one erased block.
15. The memory device of claim 14, wherein the spare pool comprises the at least one erased block and at least one written block.
16. The memory device of claim 14, wherein the controller is configured to establish a time stamp associated with the at least one erased block; and comparing the time information in the time stamp with the critical value regularly.
17. The memory device of claim 14, wherein the controller is configured to write to the at least one erased block when the erased time exceeds the threshold.
18. The memory device of claim 17, wherein the controller performs a garbage collection operation on the plurality of blocks in the flash memory module when the erased time exceeds the threshold; and writing the at least one erased block by using the recovery data output by the garbage data recovery operation.
19. The memory device according to claim 14, wherein the controller selects at least one first block from the spare pool and performs an erase operation on the at least one first block when the erased time exceeds the threshold; and replacing the at least one erased block with the at least one first block, the erased block having the erased time exceeding the threshold.
20. The memory device as claimed in claim 14, wherein the controller is controlled by a host, and the controller automatically reads specific data from the flash memory module and writes the specific data back to the flash memory module when the controller does not receive an access command issued by the host.
Technical Field
The present invention relates to a flash memory, and more particularly, to a method, a controller and a related memory device for managing a block to be written in the flash memory.
Background
Generally, for a write command issued by a host, a flash memory controller searches an idle erased block from a flash memory to write data into the erased block. However, if the flash memory cell is in an erased state for a long time, unrecoverable physical damage may be caused to the cell. Therefore, it is necessary to provide a write management mechanism to prevent such a problem.
Disclosure of Invention
In view of the above, an objective of the present invention is to disclose a write management mechanism for a flash memory. In the invention, a part of the blocks of the flash memory is divided to be used as spare pools (spare pools). The controller will find out the block from the spare pool to write data, so as to complete the write command issued by the host. Wherein, only a small number of erased blocks (erased blocks) are reserved in the spare pool, and the rest are written blocks (programmed blocks). When the controller receives a write command from the host, the controller will find the reserved erased blocks from the spare pool to write data. After the writing is completed, the controller will search one or more written blocks from the spare pool and perform an erasing operation to serve as a new reserved block. Thus, the number of erased blocks in the blocks of the flash memory can be reduced.
Drawings
FIG. 1 is a block diagram illustrating an architecture of a related memory device, a controller and a flash memory module according to an embodiment of the invention.
FIG. 2 illustrates an association between a flash module and a spare pool.
FIG. 3 is a flowchart illustrating a method for block write management of a flash memory according to an embodiment of the present invention.
FIG. 4 shows the association between the master command and the memory operation command according to the embodiment of the present invention.
Wherein the reference numerals are as follows:
100 storage device
120 controller
122 processing unit
124 memory cell
130 flash memory module
130_1 ~ 130_ N flash memory chip
138 preparation pool
DB _0 DBK, SB _0 SBQ Block
210 to 250 steps
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of embodiments of the invention to the reader. However, it will be apparent to one skilled in the art how to implement the invention without one or more of the specific details, or with other methods or components, etc. In other instances, well-known structures, materials, or operations are not shown or described in detail to avoid obscuring aspects of the invention.
Moreover, any examples or illustrations presented herein are not intended to be limited or defined by any of the words used therein. Rather, these examples or illustrations should be considered in descriptive sense only and with respect to one particular embodiment. It will be appreciated by those skilled in the art that any words used in these examples or illustrations will encompass other embodiments given elsewhere in this specification. Where words used to indicate such non-limiting examples include, but are not limited to: "for example," such as, "" for example, "" in one embodiment, "and" in an example.
The flowcharts and blocks in the flowcharts within this specification illustrate the architecture, functionality, and operation of what may be implemented by systems, methods and computer software products according to various embodiments of the present invention. In this regard, each block in the flowchart or functional block diagrams may represent a module, segment, or portion of program code, which comprises one or more executable instructions for implementing the specified logical function(s). In addition, each block of the functional block diagrams and/or flowchart illustrations, and combinations of blocks, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer program instructions. These computer program instructions may also be stored in a computer-readable medium that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable medium implement the function/act specified in the flowchart and/or block diagram block or blocks.
FIG. 1 is a schematic diagram of an embodiment of the present invention. As shown in fig. 1, the
The
The
In this embodiment, the
As shown in FIG. 2, the
Into one or more pages of data of a block). When one or more blocks are written with data by a write command from the
In the present invention, the
However, as mentioned previously, if the block is in the erased state for too long, irreversible physical damage may be caused to the cells therein. Therefore, the invention can manage the erased blocks in the preparation pool, and write the erased blocks into data after a certain time, thereby avoiding possible damage. Referring to the flowchart shown in fig. 3, fig. 3 shows a process of the method of the present invention, which at least includes the following steps:
step 210: reserving at least one erased block
Step 220: establishing a time stamp of the at least one erased block
Step 230: determining whether the erased time of the at least one erased block exceeds a threshold
Step 240: writing the at least one erased block
Step 250: at least one written block is selected to replace the erased block.
In step 210, the
Furthermore, in one embodiment, the
From the above, the present invention effectively protects the memory cells in the
In addition, a feature of the present invention is the control behavior of the
Since the management of the erased blocks in the present invention is independent of the host command of the
reading: 00h ALE 30h
Writing: 80h ALE 10h
Erasing: 60h ALE D0h
First, if the timestamp of an erased block exceeds the time limit, the process will be triggered to write to the erased block in step 240. As described above, writing to erased blocks may trigger garbage collection operations at the same time. Therefore, the first read command in the command sequence performs a garbage collection operation to read data from the valid pages in the blocks DB0 to DBK outside the
In summary, the present invention effectively reduces the write latency (by reserving at least one erased block in the spare pool) while avoiding potential physical damage to the memory cells (by limiting the time that the block stays in the erased state) by properly managing the spare pool. Meanwhile, the management mechanism of the invention is further combined with garbage data recovery operation, thereby more reasonably writing and replacing the erased blocks.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
- 上一篇:一种医用注射器针头装配设备
- 下一篇:处理I/O请求的方法及设备