The present invention relates generally to memory operations and, more particularly, to methods and systems for performing block relinking.
In non-volatile memory systems, blocks of data stored in the memory are periodically garbage collected (i.e., compacted or consolidated) to reclaim a memory's storage capacity. In a typical garbage collection operation, valid data from a block are copied to another block. After the valid data are transferred, the original metablock is erased to provide storage capacity. Currently, a write operation can trigger a memory system to perform a garbage collection operation. The host allows a fixed amount of time for the execution of the write operation and the garbage collection operation. For example, the Secure Digital protocol limits the amount of time to 250 milliseconds. A timeout error can result if the memory system exceeds this fixed amount of time in a write operation.
The sizes of memory blocks have been increasing due to increased capacity, higher parallelism, and die size scaling. Accordingly, execution of write operations and the performance of garbage collection operations are taking longer because more data are transferred. A garbage collection operation can therefore easily exceed the fixed amount of time allocated to the write operation. As a result, there is a need to prevent the timeout errors when the amount of time to perform a garbage collection operation exceeds the fixed amount of time. Additionally, there is also another need to reduce the amount of time used by garbage collection operations.
Various embodiments of the present invention provide methods and/or systems for performing block relinking during garbage collection. It should be appreciated that the embodiments can be implemented in numerous ways, including as a method, a circuit, a system, or a device. Several embodiments of the present invention are described below. In accordance with various embodiments of the present invention, a system for block relinking is described. The system may include a non-volatile memory storage system comprising a memory configured to store a storage system firmware, a non-volatile memory cell array configured to maintain a first metablock, the first metablock comprising a first block, a processor in communication with the memory and the non-volatile memory cell array, the processor being configured to execute the storage system firmware stored in the memory, the storage system firmware comprising program instructions for writing a memory write to update a block of a first metablock to a block of a second metablock, copying valid portions of the block of the first metablock to the block of the second metablock, and linking the block of the second metablock to the first metablock.
Other embodiments and advantages of the invention will become apparent from the following detailed description, taken in conjunction with the accompanying drawings, illustrating by way of example the principles of the invention.
The present invention will be readily understood by the following detailed description in conjunction with the accompanying drawings, and like reference numerals designate like structural elements.
A detailed description of one or more embodiments is provided below along with accompanying figures. The detailed description is provided in connection with such embodiments, but is not limited to any particular embodiment. The scope is limited only by the claims and numerous alternatives, modifications, and equivalents are encompassed. Numerous specific details are set forth in the following description in order to provide a thorough understanding. These details are provided for the purpose of example and the described embodiments may be implemented according to the claims without some or all of these specific details. For the purpose of clarity, technical material that is known in the technical fields related to the embodiments has not been described in detail to avoid unnecessarily obscuring the description.
The embodiments described herein provide methods and/or systems for performing partial garbage collection including block relinking. In general, during garbage collection, a memory update is performed. The memory update may be performed using an update metablock to update an original metablock. During garbage collection, valid portions (i.e., the portions not being updated) of a block of an original metablock are copied into a block of the update metablock. The block of the update metablock may then be disassociated from the remainder of the update metablock, and the block of the original metablock may be disassociated from the remainder of the original metablock. The block of the update metablock can then be linked to the remainder of the original metablock.
Memory 118 can include array logic 120 and non-volatile memory cell array 122. Non-volatile memory cell array 122 may include a variety of non-volatile memory structures and technologies. Examples of non-volatile memory technologies include flash memories (e.g., NAND, NOR, Multi-Level Cell (MLC), Divided bit-line NOR (DINOR), AND, high capacitive coupling ratio (HiCR), asymmetrical contactless transistor (ACT), other flash memories), erasable programmable read-only memory (EPROM), electrically-erasable programmable read-only memory (EEPROM), one-time programmable (OTP) memories, and other memory technologies.
Array logic 120 interfaces memory controller 110 with non-volatile memory cell array 122 and can provide, for example, addressing, data transfer and sensing, and other support to the non-volatile memory cell array and the memory cell array. To support non-volatile memory cell array 122, array logic 120 can include row decoders, column decoders, charge pumps, word line voltage generators, page buffers, input/output buffers, address buffers, and other circuitries.
According to an embodiment, the logical linking between blocks (e.g., the blocks 220-223) to form a metablock may be stored in a data structure such as a block linking table. For example, the block linking table may indicate that the blocks 220, 221, 222, and 223 are linked together to form a metablock. As is discussed further below, blocks of a metabtock may be disassociated and other blocks may be associated with a metablock. The block 220 may be disassociated from the metablock (i.e., removed), and a block 224 may subsequently be associated with the metablock. The block linking table could then describe a metablock including the blocks 224, 221, 222, and 223. This process may generally be referred to as “relinking.” According to an embodiment, increase reading and/or writing parallelism may be achieved by constructing metablocks from blocks located in different dies and/or chips.
As shown in
When host creates file 2 after file 1, the host similarly assigns two different ranges of continuous addresses within logical address space 512. Host may not assign a continuous logical address to a file, such as file 1, 2, or 3, but can rather assign fragments of logical addresses in between logical address ranges already allocated to other files. The example of
The host can keep track of logical address space 512 by maintaining a file allocation table (FAT), where the logical addresses assigned by the host to the various data files, such as files 1-3, by conversion are maintained. The host references files 1-3 by their logical addresses and not by the physical locations where the non-volatile memory storage system stores the files. On the other hand, the non-volatile memory storage system references files 1-3 by portions of the logical addresses to which data have been written and does not reference the files by the logical addresses allocated to the files. The non-volatile memory storage system converts the logical addresses provided by the host into unique physical addresses within memory cell array 502 where data from the host are stored. Block 504 represents a table of these logical-to-physical address conversions, which is maintained by the non-volatile memory storage system.
The sizes of blocks and metablocks are increasing and these increases result in a large proportion of individual data writes storing an amount of data that is less than the storage capacity of a metablock, and in many instances, even less than that of a block. Since the non-volatile memory storage system can direct new data to an erased pool metablock, such direction can result in portions of blocks or metablocks being unfilled. If the new data are updates of some data stored in another metablock, remaining valid metapages of data from that other metablock having logical addresses contiguous with those of the new data metapages are also copied in logical address order into the new metablock. The old metablock may retain other valid data metapages. Accordingly, data of certain metapages of an individual metablock can be rendered obsolete or invalid, and replaced by new data with the same logical address being written to a different metablock.
In order to maintain enough physical memory space to store data over a logical address space, such data can be periodically garbage collected (i.e., compacted or consolidated). In general, a garbage collection operation involves reading the valid data from a block and writing the valid data to a new block, ignoring invalid data in the process. The non-volatile memory storage system may perform the garbage collection operation within a timeout period allocated to a write command. If the garbage collection operation cannot be completed within one timeout period, then the one garbage collection operation may be split into several different phases (or portions), in accordance with an embodiment of the present invention. Here, the non-volatile memory storage system performs portions of the garbage collection operation using the timeout periods allocated to multiple write commands. In other words, the non-volatile memory storage system utilizes the timeout periods allocated to multiple write commands to perform portions of one garbage collection operation.
As shown in
If one garbage collection operation cannot be completed within the timeout period, as shown in operation 604, a first phase of the garbage collection operation is performed within the timeout period allocated to the write command. The remaining phases of the garbage collection can be completed at later timeout periods. For example,
Still referring to
Returning to
As described above, a metablock may be described using a block linking table. The block linking table may include an entry stating that the blocks 802a-802d comprise the original metablock 800, and that the blocks 822a-822d comprise the update metablock 820. When some blocks of the original metablock 800 and the update metablock 820 are relinked, the entry in the block linking table may be changed to reflect the relinking, according to an embodiment.
The update metablock 820 includes the memory write 824. The memory write 824 may be a memory write received from a write command that may be a single sector write. Alternatively, the block 822a may include a multiple sector write updating the original metablock 800. The memory write 824 updates a portion of the block 802a. During garbage collection, the valid portion of the block 802a (i.e., the portion that is not being updated by the memory write 824) is copied into the block 822a.
Several scenarios of phased garbage collection using block relinking are described regarding
When performing garbage collection, the worst case scenario (i.e., the longest time it may take to complete a garbage collection) may be given by equation (1):
T
gc
=T
prog
*N
pages/block
+T
xfer
*N
pages/block
*N
parallelism
+T
erase (1)
where Tgc is the time to garbage collect, Tprog is the time to program a page, Txfer is the time to transfer a page of data, Npages/block is the number of pages in a block (e.g., 32), Nparallelism is the number of physical blocks programmed and erased in parallel (e.g., the number of blocks in a metablock), and Terase is the time to erase.
Using the process described regarding
T
gc
=T
prog
*N
pages/block
+T
xfer
*N
pages/block
+T
relink
+T
erase (2)
where Trelink is the time to relink a metablock. As can be seen, the Nparallelism factor is not present in the equation (2). According to an embodiment, the relinking time Trelink may include block erase time and control update time.
If the garbage collection is completed in less than a single timeout period (e.g., less than 250 ms), the garbage collection may be performed without being phased. Alternatively, the garbage collection may be split into two or more phases, as described with respect to
The process 900 describes a general process for performing relinking while copying data that may comprise a portion of a garbage collection operation. According to various embodiments, garbage collection may be performed as part of a sequence of memory writes.
In operation 902, a write command comprising a memory write to update a first block (e.g., the block 802a) of an original metablock (e.g., the original metablock 800) is received. The memory write may be, for example, a single- or multi-sector write.
In operation 904, the memory write is written to a second block of the update metablock. For example, the block 822a (e.g., the second block) of the update metablock 820 may correspond to the block 802a of the original metablock 800. The memory write is written to the second block of the update metablock that corresponds to the first block of the original metablock so that the memory write updates the appropriate portion of the original metablock (e.g., the memory write is written to the block 822a to update the block 802a). As is discussed further regarding
In operation 906, valid portions of the first block of the original metablock are copied to the second block of the update metablock. According to an embodiment, the operation 906 may be triggered by a new write to another logical group, which may result in the closing of the update metablock 820. This operation may comprise a portion of garbage collection. For example, as shown above in
In operation 908, the second block of the update metablock is linked to the original metablock. According to an embodiment, linking the second block of the update metablock to the original metablock may include several operations. First, the first block is disassociated (i.e., unlinked) from the original metablock (e.g., the block 802a). Next, the second block of the update metablock is disassociated from the update metablock (e.g., the block 822a). Finally, the second block of the update metablock is linked to the remainder of the original metablock (e.g., blocks 802b-802d), forming a relinked original metablock (e.g., see
The resulting original metablock is a garbage collected metablock updated with the data of the memory write (e.g., the memory write 824). For example, the relinked original metablock 800 shown in
According to an embodiment, the update metablock 1040 may be a temporary entity allocated for the garbage collection operation. Once the relinking is complete, the update metablock 1040 may be returned to the pool of update metablocks. The update metablock 1020 may remain open as long as it is not full and no other writes invoke its closure.
The original metablock 1000 includes four blocks 1002a-1002d. The update metablock 1020 includes four blocks 1022a-1022d. Each of the four blocks 1022a-1022d of the update metablock 1020 includes update data for each of the four blocks 1002a-1002d of the original metablock 1000. The update metablock 1040 includes a memory write 1044 in a block 1042c, as well as empty blocks 1042a, 1042b, and 1042d. The memory write 1044 is to update the block 1022c of the update metablock 1020.
Similar to the scenario described regarding
According to different scenarios, the block 1042c may either be garbage collected with the block 1022c of the update metablock 1020 or with the block 1002c of the original metablock 1000.
After the block 1042c is linked into the update metablock 1020, the update metablock 1020 may be used to update the original metablock 1000. The updating of the original metablock 1000 may be performed using any type of garbage collection, including phased garbage collection, and may further include another instance of metablock relinking.
In operation 1102, a write command comprising a memory write to update a first block of a first metablock is received. The memory write may be, as described above, a single- or multi-sector memory write. The first metablock may be a first update metablock (e.g., the update metablock 1020) that is being updating by a second update metablock (e.g., the update metablock 1040). For example, the first block may be the block 1022c of the update metablock 1020 that is being updated.
In operation 1104, the memory write is written to a second block of a second metablock. The second metablock may be a second update metablock (e.g., the update metablock 1040) updating the first update metablock. The second block may be, for example, the block 1042c of the update metablock 1040. According to an embodiment, the first block and the second block may be allocated from the same memory plane (see, e.g.,
In operation 1106, valid portions of the first block of the first metablock are copied to the second block of the second metablock. Operation 1106 may include portions of garbage collection as described above.
In operation 1108, the second block of the second metablock is linked to the first metablock. Operation 1108 may include relinking, as described above. For example, the first block may be disassociated from the first metablock. Then, the second block may be disassociated from the second metablock. Finally, the second block may be associated with the first metablock. The linking of the metablocks may be described in a block-linking table, for example. After the relinking, the first metablock may be as the update metablock 1020 as shown in
In operation 1152, a write command comprising a memory write to update a first block of a first update metablock is received. The first update metablock (e.g., the update metablock 1020) may be updating an original metablock (e.g., the original metablock 1000). The memory write may be, as described above, a single- or multi-sector memory write. For example, the first block may be the block 1022c of the update metablock 1020 that is being updated.
In operation 1154, the memory write is written to a second block of a second update metablock. The second update metablock may be the update metablock 1040, for example. The second block may be, for example, the block 1042c of the update metablock 1040. According to an embodiment, the first block and the second block may be allocated from the same memory plane (see, e.g.,
In operation 1156, valid portions of a third block of the original metablock are copied to the second block of the second metablock. Operation 1106 may include portions of garbage collection as described above. The third block of the original metablock may be, for example, the block 1002c. According to an embodiment, the third block and the second block may be consolidated when it is determined that the memory write is written to a logical address of the first update metablock that is unwritten. In other words, the third block and the second block are consolidated when the memory write updates a portion of the first update metablock that contains no data.
In operation 1158, the second block of the second metablock is linked to the original metablock. Operation 1158 may include relinking, as described above. For example, the third block may be disassociated from the original metablock. Then, the second block may be disassociated from the second metablock. Finally, the second block may be associated with the original metablock. The linking of the metablocks may be described in a block-linking table, for example. After the relinking, the original metablock may be as the original metablock 1000 as shown in
In operation 1202, a write command including a memory write is received. The memory write may be, for example, a single or multi-sector write such as the memory write 1044. The memory write is written into an available update metablock. Alternatively, the memory write may be written to another logical group without an open update metablock.
In operation 1204, it is determined whether there is another open update metablock (e.g., the update metablock 1020) related to the original metablock (e.g., the original metablock 800 or 1000). If there is not another open update metablock, in operation 1206, it is determined that the original metablock (e.g., the original metablock 800) is to be relinked (see, e.g.,
If there is another open update metablock, as determined in operation 1204, the process 1200 continues to operation 1208, where it is determined whether the logical address of the memory write is already written in the other open update metablock. If the logical address of the memory write is already written to the open update metablock, in operation 1210, the open update metablock is relinked. For example, as shown in
If the memory write writes to a logical address that is not already in the other open update metablock, in operation 1206, the original metablock is relinked. For example, as shown in
When a block is garbage collected, the process of garbage collection may change the order of the pages within the block. For example, during a garbage collection operation, an update metablock 1320 may include a block 1322a to update the block 1302a. The update metablock may include a memory write 1324 (e.g., a single- or multi-sector write) to update the page 1304b. The update metablock includes the memory write 1324 written to a first page 1326a of the block 1322a.
Uniform page tags may be retained throughout the metablock 1300 by buffering the memory write 1324 to a temporary location such as a buffer (e.g., somewhere in RAM) or scratch pad block.
The scratch pad block 1340 may be used by the non-volatile memory system as temporary storage according to various embodiments. Specifically, new data (e.g., a memory write) can be temporarily stored in the scratch pad block 1340, before being transferred to the update metablock during consolidation, in accordance with an embodiment of the present invention. It should be appreciated that a scratch pad block 1340 is a form of data update block in which logical sectors within an associated logical group may be updated in a random order and with any amount of repetition. The scratch pad block 1340 is created by a write command where the intended logical sectors do not end at or cross physical page boundary. The scratch pad block 1340 can contain partial physical pages worth of data but no partial programmed page data are allowed. The scratch pad block 1340 can hold a valid page of data for each update metablock in the non-volatile memory storage system. The non-volatile memory storage system can have, for example, eight update metablocks allocated and therefore, the scratch pad block can store, with the addition of the temporary storage functionality, nine valid pages of data.
During garbage collection, the valid portions of the block 1302a and the memory write 1324 may be combined together into the block 1322a. Because the memory write 1324 is written from the scratch pad block 1340, the proper offset and page tag may be retained during garbage collection. According to an embodiment, a write to one logical group may trigger garbage collection of another logical group. An update metablock for the write not be available at the time the write is made. According to another embodiment, the write may either be written into the update block, where the page tag may be changed, or may be buffered (e.g., into the scratch pad block 1340) and given any page tag later. The garbage collection for the other logical group may be performed in a phased manner (e.g., two phases of garbage collection), or may be performed using relinking.
For example, if the memory write 1324 has a logical address in the page 1304b, the page 1304a is first written to the block 1322a. Then the memory write 1324 and other valid data of the page 1304b are written to the block 1322a, and the page 1304c and any subsequent pages are written to the block 1322a. The write may be completed in sequential logical address order. The block 1322a can then be relinked to the original metablock 1300 using techniques described above. Additionally, these techniques may eliminate the need for a separate page offset for each physical block (e.g., as in
In operation 1402, a write command comprising a memory write to update a first metablock is received. As described above, the memory write may be a single- or multi-sector memory write including update data. The first metablock may be an original metablock or an update metablock according to various embodiments.
In operation 1404, the memory write is written to a buffer. The buffer may be a scratch pad block (e.g., the scratch pad block 1340) or other temporary data storage. As previously described, if an update metablock is available, the memory write may also be written directly to the update metablock, and the page tag of the memory write may be changed at that time. In operation 1406, a second metablock is allocated. The second metablock may be, for example, an update metablock.
In operation 1408, valid portions of a first block of the first metablock and the memory write are copied to a second block of the second metablock. The valid portions and the memory write may be copied in a logical order corresponding to the first metablock. For example, pages of the first block may have an offset or page tag, and the copying retains this offset or page tag. The resulting second block has the same offset as the first block.
In operation 1410, the second block of the second metablock is linked to the first metablock. As described above, the linking may include disassociating the second block from the second metablock, disassociating the first block from the first metablock, and associating the second block with the first metablock.
The first update metablock 1620 may be written to in two phases. For example, the write to the address x may be a single sector write to which a timeout period is assigned. In operation 1506, a first phase of garbage collection may be performed during a timeout period. The first phase of garbage collection may include copying valid data (i.e., data from the block 1602a that is not from the addresses to which the write is written, plus the write) to the block 1622a of the first update metablock 1620.
In operation 1508, a second write command is received. The second write command may be written to the block 1612a of the metablock 1610. The second write command opens a second update metablock 1630. In some scenarios, there may not be an additional available update metablock, so the first update metablock 1620 should be closed (i.e., the first update should be completed) before the second update metablock 1630 can be allocated. However, there may not be sufficient time before the expiration of the timeout period to finish writing the first update metablock 1620. Relinking can be used to close the first update metablock 1620 before the timeout period expires.
In operation 1510, the remainder of the garbage collection of the block 1622a of the first update metablock 1620 is completed. The garbage collection may include copying the valid data from the memory write (e.g., the written sector) and the block 1602a into the block 1622a. In block 1512, the block 1622a (i.e., the first update metablock) is linked to the block 1602b (i.e., the original metablock), to create a new metablock. The new metablock is the updated metablock including the memory write. Since the new metablock has been updated, the process 1500 may close the first update metablock 1620 and open the second update metablock 1630.
The relinking between the blocks 1602b and 1622a is shown by the connection 1632. Additionally, page tags may be maintained during the process 1500 as discussed above regarding
In operation 1702, a write to an address a in a block 1802a of a metablock 1800 is received. The address a and the other addresses described herein are arbitrary and may represent any address within the block they are located in. The metablock 1800 may comprise two blocks 1802a and 1802b. The write may also result in a first update metablock 1820 including two blocks 1822a and 1822b being opened. In operation 1704, a write to an address b in a block 1812a of a metablock 1810 is received. The metablock 1810 may comprise two blocks 1812a and 1812b. The write to the address b may trigger garbage collection of the update metablock 1820 (corresponding to the write to the address a) according to an embodiment.
In operation 1706, the write to the address b is buffered to a scratch pad block (or to any other location within the memory storage system). The written sector may be buffered to allow the sector to be written at a later time, after other consolidation has been completed. After the sector has been buffered, in operation 1708, garbage collection of the first update metablock 1820 begins. According to an embodiment, a portion (e.g., half) of the garbage collection of the update metablock 1820 may be completed during the first busy period.
In operation 1710, a write to an address c is received. As a result of receiving the write to the address c, the remainder of the garbage collection of the update metablock 1820 is completed in operation 1712, the sector buffered to the scratch pad block in operation 1706 (i.e., the write to b) is written to a second update metablock 1830 in operation 1714, and the sector written to the address c is written to the scratch pad block (or other storage) in operation 1716.
In operation 1718, a write to an address d is received. The write to the address d may trigger garbage collection of the second update metablock 1830. This garbage collection may be a phased garbage collection including relinking. For example, the garbage collection may be completed during one or more busy periods. During garbage collection, data may only be written to a block 1832a of the metablock 1830. The block 1832a may then be relinked to the block 1812b of the metablock 1810.
The relinking between the blocks 1802b and 1822a is shown by the connection 1834. Additionally, page tags may be maintained during the process 1700 as discussed above regarding
Although the foregoing embodiments have been described in some detail for purposes of clarity of understanding, the embodiments are not limited to the details provided. There are many alternative ways of the implementing the embodiments. Accordingly, the disclosed embodiments are to be considered as illustrative and not restrictive, and the embodiments are not to be limited to the details given herein, but may be modified within the scope of equivalents of the appended claims. In the claims, elements and/or operations do not imply any particular order of operation, unless explicitly stated in the claims.
This application is related to U.S. patent application Ser. No. ______ (Attorney Docket No. SAN-006), filed on Dec. 28, 2006, and entitled “Method for Block Relinking;” is related to U.S. patent application Ser. No. 11/540,778 (Attorney Docket No. SAN-004), filed on Sep. 29, 2006, and entitled “Method for Phased Garbage Collection;” is related to U.S. patent application Ser. No. 11/541,371 (Attorney Docket No. SAN-014), filed on Sep. 29, 2006, and entitled “System for Phased Garbage Collection;” is related to U.S. patent application Ser. No. 11/541,035 (Attorney Docket No. SAN-005), filed on Sep. 28, 2006, and entitled “Methods for Phased Garbage Collection Using Phased Garbage Collection Block or Scratch Pad Block as a Buffer;” is related to U.S. patent application Ser. No. 11/541,012 (Attorney Docket No. SAN-013), filed on Sep. 28, 2006, and entitled “Memory Systems for Phased Garbage Collection Using Phased Garbage Collection Block or Scratch Pad Block as a Buffer;” is related to U.S. patent application Ser. No. 11/040,325 (Attorney Docket No. SNDK.434US0), filed on Jan. 20, 2005, and entitled “Scheduling of Housekeeping Operations in Flash Memory Systems;” is related to U.S. application Ser. No. 11/499,606 (Attorney Docket No. SAN-007), filed on Aug. 4, 2006, and entitled “Methods for Phased Garbage Collection;” and is related to U.S. patent application Ser. No. 11/499,598 (Attorney Docket No. SAN-008), filed on Aug. 4, 2006, and entitled “Non-Volatile Memory Storage Systems for Phased Garbage Collection,” the disclosures of which are incorporated herein by reference.