1. Field of the Invention
The present invention presents a method of collecting garbage blocks in a solid state drive, and more particularly, a method of collecting garbage blocks in a solid state drive able to protect data from being lost when a malfunction occurs.
2. Description of the Prior Art
A solid state drive (SSD) is a memory device comprising of a plurality of non-volatile flash memories. A flash memory uses voltages for programming and accessing of data. When a malfunction occurs during programming, the data being stored may be damaged. Therefore, protecting the data from being lost during programming of the solid state drive is important.
When a solid state drive of prior art receives a command to access data, a logic mapping table is used such that the logic page address (LPA) being accessed is converted to a physical page address (PPA) and then transmitted to a flash memory. The flash memory has a data area and a spare area. Each area comprises a plurality of blocks. Each of the plurality of blocks comprises a plurality of pages. Data is deleted by block. The flash memory reads the data of the physical page address using the data physical block of the data area. After the data is transmitted to the server through the solid state drive, a spare block of the spare area is selected by the solid state drive. The updated data is then written to the spare block to form a new data physical block of the data area and change the logic mapping table. The data of the logic page address of the data physical block may be discarded by the program so that the garbage block collected is recycled to be reused.
However, the solid state drive of the prior art takes a single garbage block as a unit. After copying effective data of the garbage block to the target block, the deletion of the effective data of the garbage block is completed. When a malfunction such as power outage occurs during transmission of the effective data of the garbage block to the target block, the effective data already programmed into the physical pages of the target block is going to be damaged. Because the effective data of the damaged physical pages correspond to an already recycled garbage block, the deleted effective data are no longer recoverable and cause loss of data stored in the solid state drive. Therefore, there are still problems to solve in the process of collecting garbage blocks of solid state drive according to the method of the prior art.
An objective of the present invention is to present a method of collecting garbage blocks in a solid state drive. After effective data are copied to a target block, dummy data are programmed to a physical cell not completely programmed before deleting effective data of a garbage block to protect the effective data.
Another objective of the present invention is to present a method of collecting garbage blocks in a solid state drive. When a malfunction occurs during programming of the dummy data, the effective data of the garbage block are copied to the target block to prevent loss of data.
To achieve the objective of the present invention, the method of collecting garbage blocks in a solid state drive of the present invention comprises executing a program for collecting of the garbage block when the solid state drive triggers collecting of the garbage block, collecting a garbage block of a data area of a multiple level cell flash memory, selecting a spare block of the multiple level cell flash memory as a target block, copying effective data of the garbage block and programming the effective data to physical pages of a physical cell of the target block, searching for unprogrammed physical pages of the physical cell of the target block, completing programming of the physical cell by programming the unprogrammed physical pages of the physical cell with dummy data, deleting the effective data in the garbage block, and recycling the garbage block to be a new spare block of a spare area of the multiple level cell flash memory.
The method of collecting the garbage blocks in the solid state drive of the present invention completes programming of the physical cell before deleting the effective data in the garbage block. When programming the dummy data, the programming of the unprogrammed physical pages of the physical cell is performed in an interchanging manner and according to a sequence of codes of physical pages of the target block. When a malfunction occurs during programming of the dummy data causing damage to the effective data programmed in the physical pages, the effective data of the garbage block are recopied and programmed to the target block and the physical pages programmed with dummy data and damaged effective data are discarded. After programming the unprogrammed physical pages of the physical cell of the target block with the dummy data, the garbage block is recycled and damaged dummy data in the physical cell are discarded.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.
To achieve the objective of the present invention, preferred embodiments of the present invention are described in the following paragraphs together with some illustrations.
The flash memory 30 may store data in memory cells. A flash memory may be a single level cell (SLC) device, a multi-level cell (MLC) device, a triple level (TLC) device, and a quad level (QLC) device, etc. The flash memory 30 of the present invention may be a multi-level cell (MLC) device. Although the embodiment describes a multi-level cell flash memory, the present invention is not limited to the multi-level cell flash memory. The multi-level cell (MLC) flash memory 30 may comprise of an upper level cell and a lower level cell. Adjacent and simultaneously accessible physical pages may be set as a physical cell 40. And the 128 physical cells 40 of the flash memory 30 may be coded 000 to 127 and may be divided into physical blocks 31 to store 256 logical page data. To prevent programming voltage from affecting voltages of already programmed adjacent physical pages, when programming the multi-level cell (MLC) flash memory 30, programming of logical page data to physical pages may be done according to a sequence of codes of physical pages and in an interchanging manner. The mapping table used to correspond the addresses of the 256 physical pages of each physical block 31 of the multi-level cell (MLC) flash memory 30 and the addresses of the 256 logical page data may be formed and stored in the buffer memory 21.
The physical cell 40 in
The multi-level cell (MLC) flash memory 30 may program a logical page data 0 and a logical page data 4 to the physical cell 40. Before programming the physical cell 40, the voltage of the memory device of the physical cell 40 may be maintained on erase voltage and the flag device 42 may be maintained to indicate single programming using the flag voltage 50. For single programming, by inputting the predetermined voltage to the lower page L of the physical cell 40, the memory device 41 may be formed to have an erase voltage 43 and a single programming flag voltage 50 with different loads and the flag voltage 50 of the flag device 42 may represent a single programming to program the logical page data 0 to the lower page L. For double programming, by adding the predetermined voltage to the flag voltage representing the single programming of the higher page H of the physical cell 40, the higher page H of the memory device 41 may be formed to load different double programming voltages 45, 46, 47, and 48 and the flag device 42 may increase the flag voltage to represent a double programming flag voltage 51 to program the logical page data 4 to the higher page H. When reading data, different predetermined threshold voltages V1-V5 may be used to distinguish the magnitude of the voltage of each memory device 41 and distinguish the bits 1 and 0 of the digital signal to read the logical page data 0 and the logical page data 4 stored in the lower page L and higher page H.
The multi-level cell (MLC) flash memory 30 may prevent damages to the memory caused by excessive amount of voltage by performing successive increment of voltage magnitude during programming of the adjacent physical pages. When a malfunction such as power outage occurs during programming of higher pages H, voltages of the memory device 41 and the flag device 42 may not be able to reach a predetermined voltage. Thus, the predetermined voltage may not be used to distinguish the magnitude of the voltage of each memory device 41 and the adjacent pages may not be able to read the logical page data 0 and the logical page data 4, resulting to the loss of data.
To avoid loss of data when a malfunction occurs, before deleting the effective data in the garbage block, the target block 61 having physical cell programmed with effective data may be searched for unprogrammed physical pages such as the physical cells 004, 005, and 006. Dummy data may be used to program the unprogrammed physical pages in an interchanging manner and according to a sequence of codes of the physical pages of the target block to complete programming up to the higher page H of the physical cell 006. The dummy data may be predetermined data. Thus, the logical page data 11 to 16 marked in
Therefore, the method of collecting garbage blocks in the solid state drive may be able to copy the effective data to the target block when executing the program for collecting of the garbage block. The dummy data may be used to completely program the physical cell before deleting effective data from the garbage block to protect the effective data of the physical cells from damages. After recycling the garbage block, no more programming may be executed on the corresponding physical cells to avoid any damages to the effective data and, thus, achieving the objective of protecting effective data.
The logical page data 11 to 16 of the target block 61 may be dummy data and logical page data 14 and 15 may be programmed in the physical cells 008 and 009. The physical cells 008 and 009 may not be completely programmed. In the process of recycling another garbage block, logical page data 18 to 21 marked in
Therefore, the method of collecting garbage blocks in the solid state drive may copy effective data from garbage blocks not yet deleted and reprogram the copied effective data to the target block when a malfunction occurs during programming of dummy data causing damage to the already programmed effective data to achieve the objective of preventing the solid state drive from losing data.
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
201410341098.7 | Jul 2014 | CN | national |