A data programming method for a solid state drive is provided. The solid state drive has a flash memory with plural blocks. If a garbage collection is determined to be performed, a first open block is selected from the plural blocks of the flash memory for storing a moved valid data corresponding to the garbage collection. Then, the moved valid data corresponding to the garbage collection is programmed into the first open block. A second open block is selected from the plural blocks of the flash memory for storing a write data from a host.
|
1. A data programming method for a solid state drive, the solid state drive having a flash memory with plural blocks and a buffer, the data programming method comprising steps of:
temporarily storing a valid data corresponding to a garbage collection in a first storage zone of the buffer when the garbage collection is determined to be performed during a data programming process issued by a host;
temporarily storing a write data from the host in a second storage zone of the buffer, wherein the first storage zone and the second storage zone are individual for respectively temporarily storing the valid data and the write data at the same time;
selecting a first open block and a second open block from the plural blocks of the flash memory, wherein the first open block and the second open block are simultaneously existed;
programming the valid data corresponding to the garbage collection into the first open block; and
programming the write data from the host into the second open block.
7. A solid state drive in communication with a host, the solid state drive comprising:
a controller determining whether to perform a garbage collection during a data programming process issued by the host;
a flash memory connected with the controller, and comprising plural blocks; and
a buffer;
wherein if the garbage collection is determined to be performed, a moved valid data corresponding to the garbage collection is temporarily stored in a first storage zone, and a write data from the host is temporarily stored in the second storage zone, wherein the first storage zone and the second storage zone are individual for respectively temporarily storing the valid data and the write data at the same time,
wherein the controller selects a first open block and a second open block from the plural blocks of the flash memory, programs the moved valid data corresponding to the garbage collection into the first open block, and programs the write data from the host into the second open block,
wherein the first open block and the second open block are simultaneously existed.
3. A data programming method for a solid state drive, the solid state drive having a flash memory with plural blocks, the data programming method comprising steps of: determining whether to perform a garbage collection during a data programming process issued by a host: if the garbage collection is determined to be performed during the data programming process, selecting a first open block from the plural blocks of the flash memory; and programming a moved valid data corresponding to the garbage collection into the first open block, wherein, during the data programming process, a second open block is selected from the plural blocks of the flash memory, and a write data from the host is programmed into the second open block, wherein the first open block and the second open block are simultaneously existed; and wherein the solid state drive further comprises a buffer, and the buffer comprises a first storage zone and a second storage zone, wherein the moved valid data corresponding to the garbage collection is temporarily stored in the first storage zone, and the write data from the host is temporarily stored in the second storage zone.
2. The data programming method as claimed in
4. The data programming method as claimed in
5. The data programming method as claimed in
6. The data programming method as claimed in
8. The solid state drive as claimed in
9. The solid state drive as claimed in
10. The solid state drive as claimed in
|
This application claims the benefit of People's Republic of China Application Serial No. 201510833643.9, filed Nov. 25, 2015, the subject matter of which is incorporated herein by reference.
The present invention relates to a solid state drive and a data programming method thereof, and more particularly to a solid state drive with a garbage collection function and a data programming method comprising the garbage collection.
As is well known, a solid state drive (SSD) is a data storage device that uses a non-volatile memory to store data. A NAND-based flash memory is one kind of the non-volatile memory. After data are written to the flash memory, if the system is powered off, the data are still retained in the flash memory.
A process of programming write data from the host 12 into the flash memory 105 will be illustrated as follows. Firstly, the controller 101 performs an error correction (ECC) encoding operation on the write data, and then temporarily stores the write data into the buffer 107. Moreover, the controller 101 performs a program action at proper time in order to store the write data of the buffer 107 into the flash memory 105.
For example, the buffer 107 is a cache memory such as a static random access memory (SRAM) or a dynamic random access memory (DRAM). Generally, the external bus 20 is a USB bus, an IEEE 1394 bus, an SATA bus, or the like.
Generally, the flash memory 105 comprises plural blocks, for example 1024 blocks. Each block comprises plural pages, for example 64 pages. Each page is typically 4K bytes in size. Due to the inherent properties of the flash memory 105, at least one page is written during the program action, and the erase operation is performed in a block-wise fashion.
Generally, the host 12 accesses the flash memory 105 through logical block addresses (LBA). Each LBA can store data of 512 bytes in size. When the host 12 intends to program the write data into the flash memory 105, the host 12 may provide a write command and a corresponding LBA to the controller 101. Then, the write data is transmitted from the host 12 to the controller 101. The write data is temporarily stored in the buffer 107 by the controller 101.
For example, if one page of the flash memory 105 is 4K bytes in size, the data amount of eight LBAs is equal to the data amount of one page. As known, the flash memory 105 is programmed in a unit of at least one page. If the amount of data temporarily stored in the buffer 107 exceeds the data amount of one page, the controller 101 starts the program action and programs the data to the flash memory 105 in a unit of at least one page.
Moreover, the controller 101 selects one free block of the flash memory 105 as an open block. While the program action is performed, the data temporarily stored in the buffer 107 is programmed into the open block under control of the controller 101. After the open block is occupied by the data, the controller 101 will select another block as another open block and continuously program the data of the buffer 107 into this open block.
Since the erase operation of the flash memory 105 is performed in a block-wise fashion, the data is each page cannot be individually erased and updated. After an updated data is received by the flash memory 105, the updated data is stored in a new page (i.e., a blank page), and the original data in the old page is set as an invalid data. However, after the flash memory 105 has been accessed for a long time, each block of the flash memory 105 may contain some valid data and some invalid data. Consequently, the writable space of the flash memory 105 gradually decreases.
As shown in
For example, the host 12 intends to output the write data Data8′, Data2′, Data9, Data10, Data11, Data7′, Data12 and Data13 to the flash memory 105. The write data Data2′, Data7′ and Data8′ are updated data of the data Data2, Data7 and Data8, respectively. The write data Data9˜Data13 are new data.
Please refer to
Then, the host 12 intends to output the write data Data14, Data3′, Data7″ and Data12′ to the flash memory 105. The write data Data3′, Data7″ and Data12′ are updated data of the data Data3, Data7′ and Data12, respectively. The write data Data14 is a new data.
Please refer to
From the above discussions, after many program actions, the flash memory 105 may contain a great number of invalid data. Consequently, the writable space of the flash memory gradually decreases. Moreover, the erase operation of the flash memory 105 can be performed in a block-wise fashion. Although the flash memory 105 as shown in
As the number of free blocks in the flash memory 105 gradually decreases, it is necessary for the controller 101 of the solid state drive 10 to perform a garbage collection. After the garbage collection is performed, the storing space of the invalid data in the used blocks can be released. Consequently, the writable space of the flash memory 105 increases.
Generally, when the host 12 issues a write command, the write command may be determined as a sequential write command or a random write command according to the logical block address (LBA) from the host 12. For example, if the LBA in the write command is a consecutive logical block address, the write command from the host 12 is determined as the sequential write command. Moreover, according to the sequential write command, the write data from the host 12 is continuously stored into the flash memory 105. For example, the host 12 will continuously overwrite the flash memory 105 or continuously update the data. Hereinafter, the operations of the garbage collection of the conventional flash memory after the situation of
While the valid data in the to-be-released blocks are moved by the controller 101, the write data from the host 12 may be continuously received by the buffer 107. In other words, the controller 101 can simultaneously perform the garbage collection and receive the write data from the host 12. As shown in
As shown in
Then, as shown in
While the controller 101 performs the programming procedure comprising the garbage collection, if the block to be erased contains the valid data and the invalid data, the controller 101 has to move the valid data from the block to the buffer 107, and the controller 101 has to receive the write data from the host 12 and temporarily store the write data into the buffer 107. In other words, while the controller 101 performs the programming procedure comprising the garbage collection, the moved valid data corresponding to the garbage collection and the write data from the host 12 are temporarily stored in the buffer 107 in an interlaced manner. Consequently, after the data in the buffer 107 are programmed to the open blocks of the flash memory 105 by the controller 101, the moved valid data corresponding to the garbage collection and the write data from the host 12 are stored into the first block (Block_1) and the second block (Block_2) in the interlaced manner.
Please refer to
The process of performing another garbage collection will be illustrated with reference to
Similarly, while the valid data in the to-be-released blocks are moved by the controller 101, the write data from the host 12 are continuously received by the buffer 107. As shown in
As shown in
Then, as shown in
Similarly, after the data in the buffer 107 are programmed to the open blocks of the flash memory 105 by the controller 101, the moved valid data corresponding to the garbage collection and the write data from the host 12 are stored into the first block (Block_1) and the second block (Block_2) in the interlaced manner (see
Please refer to
For example, after the above data programming method, the data in the flash memory 105 of the conventional solid state drive 10 has the storage condition as shown in
From the above discussions about the conventional data programming method, the moved valid data (GC) corresponding to the garbage collection and the write data (H) from the host 12 are stored in the flash memory 105 in the interlaced manner. Moreover, if the host 12 intends to update or overwrite the sequential write data, the controller 101 has to re-perform the garbage collection and repeatedly move the valid data corresponding to the previous garbage collection. Moreover, after the valid data in the to-be-released blocks are moved to the buffer 107, the controller 101 performs the block erase operation and programs the data into the flash memory 105. Moreover, since the buffer 107 still contains the valid data (GC) and the write data (H) in the interlaced manner, the valid data (GC) and the write data (H) are programmed into the open block in the interlaced manner.
During the sequential write process, the controller 101 has to continuously re-perform the garbage collection and repeatedly move the valid data corresponding to the previous garbage collection. Consequently, the write speed of the solid state drive 10 fluctuates between a high speed and a low speed. That is, the write speed cannot reach the desired level.
An embodiment of the present invention provides a data programming method for a solid state drive. The solid state drive has a flash memory with plural blocks. If a garbage collection is determined to be performed, a first open block is selected from the plural blocks of the flash memory for storing a moved valid data corresponding to the garbage collection. Then, the moved valid data corresponding to the garbage collection is programmed into the first open block. A second open block is selected from the plural blocks of the flash memory for storing a write data from a host.
Another embodiment of the present invention provides a solid state drive in communication with a host. The solid state drive includes a controller and a flash memory. The controller determines whether to perform a garbage collection. A flash memory is connected with the controller, and includes plural blocks. If the garbage collection is determined to be performed, the controller selects a first open block from the plural blocks of the flash memory for storing a moved valid data corresponding to the garbage collection, and programs the moved valid data corresponding to the garbage collection into the first open block. Moreover, a second open block is selected from the plural blocks of the flash memory for storing a write data from a host.
Numerous objects, features and advantages of the present invention will be readily apparent upon a reading of the following detailed description of embodiments of the present invention when taken in conjunction with the accompanying drawings. However, the drawings employed herein are for the purpose of descriptions and should not be regarded as limiting.
The above objects and advantages of the present invention will become more readily apparent to those ordinarily skilled in the art after reviewing the following detailed description and accompanying drawings, in which:
In accordance with the present invention, the buffer 510 is divided into a first storage zone 512 and a second storage zone 514. The moved valid data (GC) corresponding to the garbage collection are temporarily stored in the first storage zone 512. The write data (H) from the host 52 are temporarily stored in the second storage zone 514.
Moreover, the controller 51 selects two free blocks of the flash memory 505, and defines the two free blocks as a first open block and a second open block. The first open block is used for storing the moved valid data (GC) corresponding to the garbage collection. The second open block is used for storing the write data (H) from the host 52. While the program action is performed, the valid data (GC) in the first storage zone 512 and the write data (H) in the second storage zone 514 are respectively stored into the first open block and the second open block of the flash memory 505 by the controller 501. After the first open block is programmed and is full, the controller 501 selects an additional first open block from the flash memory 505 to store the valid data (GC). Similarly, after the second open block is programmed and is full, the controller 501 selects an additional second open block from the flash memory 505 to store the write data (H).
Since the moved valid data (GC) corresponding to the garbage collection and the write data (H) from the host 52 are programmed into different open blocks by the controller 501, the valid data (GC) and the write data (H) are not simultaneously contained in the same block. Under this circumstance, the write speed of the solid state drive 50 is enhanced.
Please refer to
Similarly, while the valid data in the to-be-released blocks are moved from the flash memory 505 by the controller 501, the write data from the host 52 are continuously received by the controller 501 and stored into the buffer 510. In other words, the controller 501 can simultaneously perform the garbage collection and receive the write data from the host 52. As shown in
As shown in
Then, as shown in
Obviously, the all data in the first block (Block_1) are the moved valid data (GC) corresponding to the garbage collection, and all data in the second block (Block_2) are the write data (H) from the host 52.
Please refer to
After the previous programming procedure comprising the garbage collection is performed, the moved valid data corresponding to the garbage collection are all stored in the first open block, i.e., the first block (Block_1). And, the second open block, i.e., the second block (Block_2), only stores the write data Data15, Data16, Data17 and Data18 from the host 52 but does not store the moved valid data corresponding to the garbage collection. Since the old data Data15, Data16, Data17 and Data18 in the second block (Block_2) are considered as the invalid data because these data have been updated, the controller 501 can directly perform a block erase action on the second block (Block_2) to acquire the storing space. Under this circumstance, it is not necessary to move the valid data.
The process of performing another garbage collection will be illustrated with reference to
Then, as shown in
From the above descriptions, the present invention provides a solid state drive and a data programming method. The controller selects two free blocks as the first open block and the second open block. The first open block is used for storing the moved valid data (GC) corresponding to the garbage collection. The second open block is used for storing the write data (H) from the host. Moreover, the buffer is divided into a first storage zone and a second storage zone. The moved valid data (GC) corresponding to the garbage collection are temporarily stored in the first storage zone. The write data (H) from the host are temporarily stored in the second storage zone.
Moreover, if the storing space of the flash memory 505 is insufficient and the host 52 intends to update or overwrite the sequential write data, the block of the flash memory 505 storing the write data (H) has higher probability of being completely occupied by invalid data because the block of the flash memory 505 storing the write data (H) does not have the moved valid data (GC) corresponding to the garbage collection. Under this circumstance, the controller 501 does not need to repeatedly move the valid data and perform the program action. After the block completely occupied by invalid data is erased, the controller 501 may set the erased free block as the second open block and directly program the write data into the second open block.
While the invention has been described in terms of what is presently considered to be the most practical and preferred embodiments, it is to be understood that the invention needs not be limited to the disclosed embodiment. On the contrary, it is intended to cover various modifications and similar arrangements included within the spirit and scope of the appended claims which are to be accorded with the broadest interpretation so as to encompass all such modifications and similar structures.
Hung, Min-I, Lin, Liang-You, Peng, Yu-Chuang, Pan, Ya-Ping
Patent | Priority | Assignee | Title |
11860777, | Oct 15 2019 | Samsung Electronics Co., Ltd. | Storage device and a garbage collection method thereof |
12061814, | Jan 25 2021 | Pure Storage, Inc. | Using data similarity to select segments for garbage collection |
Patent | Priority | Assignee | Title |
7444462, | Sep 28 2006 | SanDisk Technologies LLC | Methods for phased garbage collection using phased garbage collection block or scratch pad block as a buffer |
8990480, | Mar 15 2012 | Kioxia Corporation | Semiconductor memory device and computer program product |
9342458, | Feb 28 2013 | International Business Machines Corporation | Cache allocation in a computerized system |
20080034175, | |||
20080129740, | |||
20100082890, | |||
20100217927, | |||
20110022778, | |||
20110029749, | |||
20110153911, | |||
20110246821, | |||
20120054414, | |||
20120084489, | |||
20120151124, | |||
20120173795, | |||
20120284587, | |||
20120290769, | |||
20130019057, | |||
20130103889, | |||
20130132647, | |||
20130151892, | |||
20130166818, | |||
20140019670, | |||
20140029341, | |||
20140122774, | |||
20140189209, | |||
20140281338, | |||
20150261797, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Apr 07 2016 | PAN, YA-PING | Lite-On Technology Corporation | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 038284 | /0190 | |
Apr 07 2016 | PENG, YU-CHUANG | Lite-On Technology Corporation | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 038284 | /0190 | |
Apr 07 2016 | LIN, LIANG-YOU | Lite-On Technology Corporation | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 038284 | /0190 | |
Apr 07 2016 | HUNG, MIN-I | Lite-On Technology Corporation | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 038284 | /0190 | |
Apr 07 2016 | PAN, YA-PING | LITE-ON ELECTRONICS GUANGZHOU LIMITED | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 038284 | /0190 | |
Apr 07 2016 | PENG, YU-CHUANG | LITE-ON ELECTRONICS GUANGZHOU LIMITED | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 038284 | /0190 | |
Apr 07 2016 | LIN, LIANG-YOU | LITE-ON ELECTRONICS GUANGZHOU LIMITED | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 038284 | /0190 | |
Apr 07 2016 | HUNG, MIN-I | LITE-ON ELECTRONICS GUANGZHOU LIMITED | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 038284 | /0190 | |
Apr 14 2016 | Lite-On Technology Corporation | (assignment on the face of the patent) | / | |||
Apr 14 2016 | LITE-ON ELECTRONICS (GUANGZHOU) LIMITED | (assignment on the face of the patent) | / | |||
Dec 04 2019 | Lite-On Technology Corporation | SOLID STATE STORAGE TECHNOLOGY CORPORATION | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 051213 | /0824 | |
Dec 04 2019 | LITE-ON ELECTRONICS GUANGZHOU LIMITED | SOLID STATE STORAGE TECHNOLOGY CORPORATION | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 051213 | /0824 |
Date | Maintenance Fee Events |
Dec 07 2021 | M1551: Payment of Maintenance Fee, 4th Year, Large Entity. |
Date | Maintenance Schedule |
Aug 21 2021 | 4 years fee payment window open |
Feb 21 2022 | 6 months grace period start (w surcharge) |
Aug 21 2022 | patent expiry (for year 4) |
Aug 21 2024 | 2 years to revive unintentionally abandoned end. (for year 4) |
Aug 21 2025 | 8 years fee payment window open |
Feb 21 2026 | 6 months grace period start (w surcharge) |
Aug 21 2026 | patent expiry (for year 8) |
Aug 21 2028 | 2 years to revive unintentionally abandoned end. (for year 8) |
Aug 21 2029 | 12 years fee payment window open |
Feb 21 2030 | 6 months grace period start (w surcharge) |
Aug 21 2030 | patent expiry (for year 12) |
Aug 21 2032 | 2 years to revive unintentionally abandoned end. (for year 12) |