TW202134883A - Write mangement for protecting erased blocks in flash memory - Google Patents

Write mangement for protecting erased blocks in flash memory Download PDF

Info

Publication number
TW202134883A
TW202134883A TW110100022A TW110100022A TW202134883A TW 202134883 A TW202134883 A TW 202134883A TW 110100022 A TW110100022 A TW 110100022A TW 110100022 A TW110100022 A TW 110100022A TW 202134883 A TW202134883 A TW 202134883A
Authority
TW
Taiwan
Prior art keywords
erased
block
flash memory
blocks
memory module
Prior art date
Application number
TW110100022A
Other languages
Chinese (zh)
Other versions
TWI771854B (en
Inventor
杜建東
蕭佳容
楊宗杰
Original Assignee
慧榮科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 慧榮科技股份有限公司 filed Critical 慧榮科技股份有限公司
Priority to TW110100022A priority Critical patent/TWI771854B/en
Publication of TW202134883A publication Critical patent/TW202134883A/en
Application granted granted Critical
Publication of TWI771854B publication Critical patent/TWI771854B/en

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)
  • Read Only Memory (AREA)
  • Pens And Brushes (AREA)

Abstract

A method of managing a flash memory module is provided. The flash memory module includes a plurality of blocks, where a portion of the plurality of blocks belongs to a spare pool. The method includes: reserving at least one erased block in the spare pool for a write operation; monitoring an erasure time of the at least one erased block; when the erasure time exceeds a threshold value, performing a read operation on a plurality of specific blocks in the flash memory module; and utilizing data read from the plurality of specific blocks to program the at least one erased block.

Description

用於快閃記憶體中保護已抹除區塊的寫入管理機制Write management mechanism for protecting erased blocks in flash memory

本發明係關於快閃記憶體,尤指一種針對快閃記憶體中之待寫入區塊進行管理的方法、控制器以及相關的儲存裝置。The present invention relates to flash memory, in particular to a method, controller and related storage device for managing blocks to be written in the flash memory.

一般來說,針對主機下達的寫入命令,快閃記憶體控制器會從快閃記憶體中找尋一個閒置的已抹除區塊來將資料寫入其中。然而,若快閃記憶體單元長時間處在已抹除狀態中,可能會對單元造成不可回復的物理性傷害。因此,有必須提供一種寫入管理機制來預防這種問題。Generally speaking, for a write command issued by the host, the flash memory controller will find an idle erased block from the flash memory to write data into it. However, if the flash memory cell remains in the erased state for a long time, it may cause irreversible physical damage to the cell. Therefore, it is necessary to provide a write management mechanism to prevent this problem.

有鑑於此,本發明之一目的在於提供一種快閃記憶體的寫入管理機制。在本發明中,將從快閃記憶體的區塊中劃分一部分出來作為備用池(spare pool)。控制器將從備用池中找出區塊來寫入資料,以完成主機下達的寫入命令。其中,上述備用池中只會預留少量的已抹除區塊(erased block),其餘為已寫入區塊(programmed block)。當控制器接收到主機端的寫入命令時,控制器會從備用池中找到預留的已抹除區塊來寫入資料。並且,在寫入完成後,控制器會從備用池中找尋一個或多個的已寫入區塊,進行抹除操作,以作為新的預留區塊。如此一來,可以減少快閃記憶體的區塊中已抹除區塊的數量。In view of this, one objective of the present invention is to provide a write management mechanism for flash memory. In the present invention, a part of the block of the flash memory is divided as a spare pool. The controller will find blocks from the spare pool to write data to complete the write command issued by the host. Among them, only a small amount of erased blocks are reserved in the above-mentioned spare pool, and the rest are programmed blocks. When the controller receives the write command from the host side, the controller will find the reserved erased block from the spare pool to write the data. Moreover, after the writing is completed, the controller will find one or more written blocks from the spare pool and perform an erase operation as a new reserved block. In this way, the number of erased blocks in the flash memory block can be reduced.

另一方面,針對每一個在備用池中預留的已抹除區塊,控制器都會建立其時間檔案(如,時戳),用以監控其維持在已抹除狀態的時間,一旦這個時間超過一個臨界值,控制器會將這個已抹除區塊進行寫入,並且從備用池中的已寫入區塊中找一個或多個區塊來替代,從而降低物理性傷害的風險。On the other hand, for each erased block reserved in the spare pool, the controller will create its time file (e.g., time stamp) to monitor the time it stays in the erased state. Once this time If a threshold is exceeded, the controller will write the erased block, and find one or more blocks from the written block in the spare pool to replace it, thereby reducing the risk of physical damage.

本發明之一實施例提供一種管理一快閃記憶體模組的方法。該快閃記憶體模組包含複數個區塊,該複數個區塊中之一部分屬於一備用池,該方法包含:在該備用池中預留至少一已抹除區塊以利一寫入操作之進行;監測該至少一已抹除區塊之一已抹除時間;當該已抹除時間超過一臨界值時,對該快閃記憶體模組中的複數個特定區塊進行讀取操作;以及利用從該複數個特定區塊中所讀取到的資料對該至少一已抹除區塊進行寫入。An embodiment of the present invention provides a method of managing a flash memory module. The flash memory module includes a plurality of blocks, and a part of the plurality of blocks belongs to a spare pool. The method includes: reserving at least one erased block in the spare pool to facilitate a write operation To proceed; monitor the erase time of one of the at least one erased block; when the erased time exceeds a threshold, perform read operations on a plurality of specific blocks in the flash memory module ; And use the data read from the plurality of specific blocks to write to the at least one erased block.

本發明之一實施例提供一種用於管理一快閃記憶體模組的控制器,其中該快閃記憶體模組包含複數個區塊,且該複數個區塊中之一部分屬於一備用池,該控制器包含:一儲存單元與一處理單元。該儲存單元用以儲存一程式碼。該處理單元耦接於該儲存單元,用以從該儲存單元中讀取該程式碼,以執行該程式碼,從而進行以下操作:在該備用池中預留至少一已抹除區塊以利一寫入操作之進行;監測該至少一已抹除區塊之一已抹除時間;當該已抹除時間超過一臨界值時,對該快閃記憶體模組中的複數個特定區塊進行讀取操作;以及利用從該複數個特定區塊中所讀取到的資料對該至少一已抹除區塊進行寫入。An embodiment of the present invention provides a controller for managing a flash memory module, wherein the flash memory module includes a plurality of blocks, and a part of the plurality of blocks belongs to a spare pool, The controller includes: a storage unit and a processing unit. The storage unit is used to store a program code. The processing unit is coupled to the storage unit, and is used to read the code from the storage unit to execute the code, so as to perform the following operations: reserve at least one erased block in the spare pool for benefit Perform a write operation; monitor the erase time of one of the at least one erased block; when the erased time exceeds a threshold, the specific blocks in the flash memory module Perform a read operation; and use the data read from the plurality of specific blocks to write to the at least one erased block.

本發明之一實施例提供一種儲存裝置,該儲存裝置包含:一快閃記憶體模組以及一控制器。該快閃記憶體模組包含複數個區塊,且該複數個區塊中之一部分屬於一備用池。該控制器用以對快閃記憶體模組進行存取,包含:一儲存單元用以儲存一程式碼;以及一處理單元,耦接於該儲存單元。該處理單元用以從該儲存單元中讀取該程式碼,以執行該程式碼,從而進行以下操作:在該備用池中預留至少一已抹除區塊以利一寫入操作之進行;監測該至少一已抹除區塊之一已抹除時間;當該已抹除時間超過一臨界值時,對該快閃記憶體模組中的複數個特定區塊進行讀取操作;以及利用從該複數個特定區塊中所讀取到的資料對該至少一已抹除區塊進行寫入。An embodiment of the present invention provides a storage device. The storage device includes a flash memory module and a controller. The flash memory module includes a plurality of blocks, and a part of the plurality of blocks belongs to a spare pool. The controller is used for accessing the flash memory module and includes: a storage unit for storing a program code; and a processing unit coupled to the storage unit. The processing unit is used to read the program code from the storage unit to execute the program code to perform the following operations: reserve at least one erased block in the spare pool to facilitate a write operation; Monitor the erase time of one of the at least one erased block; when the erased time exceeds a threshold, perform a read operation on a plurality of specific blocks in the flash memory module; and use The data read from the plurality of specific blocks is written to the at least one erased block.

在以下內文中,描述了許多具體細節以提供閱讀者對本發明實施例的透徹理解。然而,本領域的技術人士將能理解,如何在缺少一個或多個具體細節的情況下,或者利用其他方法或元件等來實現本發明。在其他情況下,眾所皆知的結構、材料或操作不會被示出或詳細描述,從而避免模糊本發明的核心概念。In the following text, many specific details are described to provide readers with a thorough understanding of the embodiments of the present invention. However, those skilled in the art will understand how to implement the present invention without one or more specific details or using other methods or elements. In other cases, well-known structures, materials or operations will not be shown or described in detail, so as to avoid obscuring the core concept of the present invention.

此外,說明書內文給出的任何範例或者闡釋,不應被其中使用的任何詞彙所限制或者定義。相反地,這些範例或闡釋應當被認為是針對一個特定實施例進行描述的,並且僅作為說明。本領域的技術人員將可理解,這些範例或闡釋使用的任何詞彙將可涵蓋在本說明書中其他地方給出的其他實施例。其中,用以指出這些非限制性範例的用詞包括但不限於:「例如」、「如」、「舉例來說」、「在一個實施例中」以及在「在一範例中」。In addition, any examples or explanations given in the specification should not be limited or defined by any vocabulary used therein. On the contrary, these examples or explanations should be considered as describing a specific embodiment and only as an illustration. Those skilled in the art will understand that any vocabulary used in these examples or explanations will cover other embodiments given elsewhere in this specification. The terms used to indicate these non-limiting examples include, but are not limited to: "for example," "such as," "for example," "in one embodiment", and "in an example."

說明書內的流程圖中的流程和方塊示出了基於本發明的各種實施例的系統、方法和電腦軟體產品所能實現的架構,功能和操作。在這方面,流程圖或功能方塊圖中的每個方塊可能代表程式碼的模組,區段或者是部分,其包括用於實現指定的邏輯功能的一個或多個可執行指令。另外,功能方塊圖以及/或流程圖中的每個方塊,以及方塊的組合,基本上可以由執行指定功能或動作的專用硬體系統來實現,或專用硬體和電腦程式指令的組合來實現。這些電腦程式指令還可以存儲在電腦可讀媒體中,該媒體可以使電腦或其他可編程數據處理裝置以特定方式工作,使得存儲在電腦可讀媒體中的指令,實現流程圖以及/或功能方塊圖中的方塊所指定的功能/動作。The processes and blocks in the flowcharts in the specification show the architecture, functions, and operations that can be implemented by the system, method, and computer software product based on various embodiments of the present invention. In this regard, each block in the flowchart or functional block diagram may represent a module, section, or part of the program code, which includes one or more executable instructions for implementing specified logical functions. In addition, each block in the function block diagram and/or flowchart, as well as the combination of blocks, can basically be realized by a dedicated hardware system that performs a specified function or action, or a combination of dedicated hardware and computer program instructions. . These computer program instructions can also be stored in a computer-readable medium, which can make a computer or other programmable data processing device work in a specific manner, so that the instructions stored in the computer-readable medium implement flowcharts and/or functional blocks The functions/actions specified by the squares in the figure.

第1圖爲本發明實施例的示意圖。如圖所示,儲存裝置100包含一控制器120與一快閃記憶體模組130,並且受控於一主機(host device)200(儲存裝置100甚至可能為主機200的一部份)。主機200可包含至少一個中央處理器(未顯示),並透過運作一個作業系統與應用程式來控制主機200的運作,並與周邊裝置(未顯示)連動。而存儲裝置100可用來提供存儲空間給主機200,儲存運作作業系統與各種應用程式所必需的程式碼與資料。主控裝置50的範例可包含:多功能移動電話(multifunctional mobile phone)、平板電腦(tablet)、可穿戴裝置(wearable device)以及個人電腦(personal computer)例如桌上型電腦或筆記型電腦。存儲裝置100的例子可包含(但不限於):固態硬碟(solid state drive, SSD)以及各種嵌入式(embedded)存儲裝置(例如符合UFS或EMMC規格的嵌入式存儲裝置)。Figure 1 is a schematic diagram of an embodiment of the present invention. As shown in the figure, the storage device 100 includes a controller 120 and a flash memory module 130, and is controlled by a host device 200 (the storage device 100 may even be a part of the host device 200). The host 200 may include at least one central processing unit (not shown), and controls the operation of the host 200 by operating an operating system and an application program, and is linked with peripheral devices (not shown). The storage device 100 can be used to provide storage space for the host 200 to store program codes and data necessary for operating the operating system and various applications. Examples of the main control device 50 may include: a multifunctional mobile phone, a tablet, a wearable device, and a personal computer such as a desktop computer or a notebook computer. Examples of the storage device 100 may include (but are not limited to): a solid state drive (SSD) and various embedded storage devices (for example, an embedded storage device compliant with UFS or EMMC specifications).

控制器120可用來存取(access)快閃記憶體模組130。在一個實施例中,快閃記憶體模組130可能是一立體NAND型快閃記憶體(3D NAND-type flash),並可包含至少一個快閃記憶體晶片(Flash memory chip),但此非本發明之限制。每一個快閃記憶體晶片包含複數個區塊(Block),控制器120對快閃記憶體模組130進行資料抹除的操作是以區塊爲單位來進行。另外,一個區塊可記錄特定數量的數據頁(Page),而控制器120對快閃記憶體模組130進行資料寫入的操作是以數據頁爲單位來進行寫入。The controller 120 can be used to access the flash memory module 130. In one embodiment, the flash memory module 130 may be a three-dimensional NAND-type flash (3D NAND-type flash), and may include at least one flash memory chip (Flash memory chip), but this is not Limitations of the present invention. Each flash memory chip includes a plurality of blocks, and the controller 120 performs data erasing operations on the flash memory module 130 in units of blocks. In addition, a block can record a specific number of data pages (Pages), and the controller 120 writes data to the flash memory module 130 in units of data pages.

控制器120可能包含處理電路例如微處理器122、與儲存單元124,例如唯讀記憶體(Read Only Memory, ROM),唯讀記憶體124主要用來儲存程式碼與特定資料,而微處理器122則用來執行程式碼以控制對快閃記憶體模組130的存取。另外,控制器120可能還包含有其他的介面邏輯、控制邏輯或緩衝記憶體等等,用以輔助實現下文所述的各種操作。然而,為求說明書之簡潔,在此省略不提。本領域之技術人士在閱讀下文後,應能知曉如何實現運用已知的電路與文中揭露的電路元件與架構結合,從而實現本發明實施例中所提及的各式操作與相關應用。The controller 120 may include a processing circuit such as a microprocessor 122 and a storage unit 124, such as a read only memory (ROM). The read only memory 124 is mainly used to store program codes and specific data, and the microprocessor 122 is used to execute program codes to control access to the flash memory module 130. In addition, the controller 120 may also include other interface logic, control logic, or buffer memory, etc., to assist in implementing various operations described below. However, for the sake of brevity in the description, it is omitted here. After reading the following, those skilled in the art should be able to know how to implement the use of known circuits in combination with the circuit elements and structures disclosed in the text, so as to realize the various operations and related applications mentioned in the embodiments of the present invention.

在本實施例中,主機200可藉由傳送主控命令(host command)與相應的邏輯位址給控制器120,從而間接地存取儲存裝置100。控制器120接收主控命令(讀取或寫入命令)與邏輯地址,並且將主控命令轉譯成記憶體操作命令,再以操作命令控制快閃記憶體模組130讀取、寫入(program)、或抹除(erase) 快閃記憶體模組130當中特定物理地址的記憶體單元(memory unit)或數據頁(page)、或區塊(block)。再者,控制器120也會執行程式碼,以及/或參考儲存單元124內的資料,從而執行一連串的操作來實現下文中將提到的特定操作。In this embodiment, the host 200 can indirectly access the storage device 100 by sending a host command and a corresponding logical address to the controller 120. The controller 120 receives a main control command (read or write command) and a logical address, and translates the main control command into a memory operation command, and then controls the flash memory module 130 to read and write (program) with the operation command. ), or erase (erase) the memory unit or data page (page) or block (block) of a specific physical address in the flash memory module 130. Furthermore, the controller 120 will also execute the program code and/or refer to the data in the storage unit 124 to execute a series of operations to implement specific operations mentioned below.

如第2圖所示,快閃記憶體模組130包含多個區塊,這些區塊可能分布在快閃記憶體晶片130_1~130_N上。再者,快閃記憶體模組130中的區塊又可被劃分出一個備用池(spare pool)138。備用池138中可能包含區塊SB0~SBQ,這些區塊中可能沒有儲存資料,又或者儲存無效資料(已經儲存在其他區塊中,並不再被更新的資料)。在本發明中,所有由主機200發出的寫入命令,都會由控制器120從備用池138中選擇出一個或多個區塊,並根據主機200發出的寫入命令中包含的資料,進行寫入(將資料寫入區塊的一個或多個數據頁中)。當一個或多個區塊因主機200發出的寫入命令而被寫入資料後,則會被移出備用池138,並且,控制器120會從備用池138以外的區塊DB0~DBK中,選擇一個或多個只有儲存無效資料的區塊來補充備用池138。As shown in FIG. 2, the flash memory module 130 includes a plurality of blocks, and these blocks may be distributed on the flash memory chips 130_1~130_N. Furthermore, the blocks in the flash memory module 130 can be divided into a spare pool 138. The spare pool 138 may include blocks SB0 to SBQ, and these blocks may not store data or store invalid data (data that has been stored in other blocks and is no longer updated). In the present invention, all write commands issued by the host 200 will be selected by the controller 120 from the spare pool 138 and one or more blocks will be written according to the data contained in the write command issued by the host 200. Import (write data into one or more data pages of the block). When one or more blocks are written into data due to a write command issued by the host 200, they will be moved out of the spare pool 138, and the controller 120 will select from the blocks DB0~DBK outside the spare pool 138 One or more blocks that only store invalid data are used to supplement the reserve pool 138.

在本發明中,控制器120會在備用池138中預留至少一個已經處在已抹除狀態的已抹除區塊(如:區塊SB_0),這是因為區塊的抹除操作需要耗費的時間可觀,預先進行抹除可以減少寫入操作的延遲。當主機200對控制器120發出寫入命令時,控制器120會將主機端所傳送來的資料寫入至預備池138中預留的已抹除區塊SB_0中,並且,在主機端200對控制器120發出下一道寫入命令之前,控制器120將從預備池138中的已寫入(programmed)區塊SB_1~SB_Q中,找尋找至少一個區塊(如:區塊SB_3),並將其抹除後,預留為下一次寫入操作之用。In the present invention, the controller 120 reserves at least one erased block (such as block SB_0) that is already in the erased state in the spare pool 138. This is because the erase operation of the block needs to be expensive The time is considerable, and pre-wiping can reduce the delay of the write operation. When the host 200 sends a write command to the controller 120, the controller 120 will write the data sent from the host to the erased block SB_0 reserved in the reserve pool 138, and the host 200 will Before the controller 120 issues the next write command, the controller 120 will search for at least one block (such as block SB_3) from the programmed blocks SB_1~SB_Q in the reserve pool 138, and will After it is erased, it is reserved for the next write operation.

然而,如先前所提及,若區塊處在已抹除狀態的時間太長,可能會對其中的單元造成不可逆的物理性傷害。因此,本發明會對預備池中的已抹除區塊進行管理,在一定時間後,將已抹除區塊寫入資料,避免可能造成的傷害。請參考第3圖所示的流程圖,該圖繪示本發明方法之一流程,該流程至少包含以下步驟:However, as mentioned earlier, if the block is in the erased state for too long, it may cause irreversible physical damage to the cells in it. Therefore, the present invention manages the erased blocks in the reserve pool, and writes the erased blocks into data after a certain period of time to avoid possible damage. Please refer to the flowchart shown in Figure 3, which illustrates a process of the method of the present invention. The process includes at least the following steps:

步驟  210:預留至少一個已抹除區塊Step 210: Reserve at least one erased block

步驟  220:建立該至少一個已抹除區塊之時戳Step 220: Establish the time stamp of at least one erased block

步驟  230:判斷該至少一已抹除區塊之已抹除時間是否超過臨界值Step 230: Determine whether the erasure time of the at least one erased block exceeds the threshold

步驟  240:寫入該至少一已抹除區塊Step 240: Write the at least one erased block

步驟  250:選取至少一已寫入區塊替換該已抹除區塊。Step 250: Select at least one written block to replace the erased block.

在步驟210中,控制器120會對預備池138之中至少一個已寫入區塊執行抹除操作,使該至少一已寫入區塊(如SB_7)由已寫入狀態(programmed state)轉換為已抹除狀態,為之後可能的寫入操作做準備。其中,步驟210可能發生在主機200下達寫入命令之前,或者是在控制器120對另一個已抹除區塊進行寫入之後。在步驟220中,控制器120建立該至少一已抹除區塊之一時戳。在步驟230之中,控制器120根據該時戳中之時間訊息與系統時間判斷是否該至少一已抹除區塊處在已抹除狀態之一已抹除時間是否超過一臨界值,此步驟的用意即為保護已抹除區塊,使其避免於受到不可恢復的物理性傷害。若步驟230的判斷結果為是,則進入步驟230;若否,則繼續停留在此步驟。在步驟240中,由於控制器120已經發現該至少一已抹除區塊之已抹除時間已經超過臨界值,代表該已抹除區塊面臨傷害的風險。因此,控制器120會對該至少一已抹除區塊進行寫入,將其由已抹除狀態轉換成已寫入狀態,避免損傷。In step 210, the controller 120 performs an erase operation on at least one written block in the reserve pool 138, so that the at least one written block (such as SB_7) is converted from a programmed state For the erased state, prepare for possible write operations later. Wherein, step 210 may occur before the host 200 issues a write command, or after the controller 120 writes another erased block. In step 220, the controller 120 establishes a time stamp of the at least one erased block. In step 230, the controller 120 determines whether the at least one erased block is in the erased state according to the time information in the time stamp and the system time. One of the erased time exceeds a threshold. This step The purpose of is to protect the erased blocks from unrecoverable physical damage. If the judgment result of step 230 is yes, go to step 230; if not, continue to stay at this step. In step 240, since the controller 120 has found that the erase time of the at least one erased block has exceeded the threshold, it means that the erased block is at risk of damage. Therefore, the controller 120 will write to the at least one erased block and convert it from the erased state to the written state to avoid damage.

再者,在一實施例中,控制器120可能會利用寫入已抹除區塊的機會,同時進行一垃圾資料回收(garbage collection)操作。其中,控制器120將由區塊DB0~DBK之有效頁所蒐集來的資料,寫入該至少一已抹除區塊,從而將該至少一已抹除區塊轉換為已寫入區塊。之後,流程進入步驟250,控制器120會從預備池138中尋找至少一個已寫入區塊(如:SB_4)來替代前述的該至少一已抹除區塊,並回到步驟210,對其進行抹除操作,為之後的寫入命令做準備。Furthermore, in an embodiment, the controller 120 may use the opportunity to write the erased block and perform a garbage collection operation at the same time. The controller 120 writes the data collected from the effective pages of the blocks DB0 to DBK into the at least one erased block, thereby converting the at least one erased block into a written block. After that, the process proceeds to step 250, and the controller 120 searches for at least one written block (such as SB_4) from the reserve pool 138 to replace the aforementioned at least one erased block, and returns to step 210, Perform an erase operation to prepare for the subsequent write command.

由上可知,本發明有效地保護了快閃記憶體模組130中的記憶體單元,避免其因停留在已抹除狀態中的時間過長而發生損傷。另一方面來說,由於本發明在預備池中隨時預留了已抹除區塊,使得資料寫入的延遲可以被縮短(亦即,不需要等待將已寫入區塊進行抹除的時間)。It can be seen from the above that the present invention effectively protects the memory cells in the flash memory module 130 and prevents them from being damaged due to staying in the erased state for too long. On the other hand, because the present invention reserves the erased blocks in the reserve pool at any time, the delay of data writing can be shortened (that is, there is no need to wait for the time for erasing the written blocks. ).

另外,本發明之一特徵在於,控制器120對於快閃記憶體模組130的控制行為。請參考第4圖,當主機端200對控制器120下達主控命令(讀取或寫入)時,控制器120會根據主控命令中包含的存取類型、位址以及相關資料,轉換為相應的記憶體操作命令,對快閃記憶體模組130中的快閃記憶體晶片130_1~130_N進行存取。In addition, one feature of the present invention is that the controller 120 controls the flash memory module 130. Please refer to Figure 4, when the host side 200 issues a master control command (read or write) to the controller 120, the controller 120 will convert it into The corresponding memory operation command accesses the flash memory chips 130_1~130_N in the flash memory module 130.

由於本發明對於已抹除區塊的管理,係獨立於主機端200的主控命令,且根據已抹除區塊的時戳來進行。因此,即便主機端200未對控制器120下達主控命令時,也會發生因備用池138中的已抹除區塊的時戳超過臨界值,而引發已抹除區塊之替換操作並觸發垃圾資料回收操作的事件。因此,在一實施例中,控制器120可能在未收到任何主機端200的存取命令時,對快閃記憶體晶片130_1~130_N下達以下的連續指令序列: 讀取: 00h ALE 30h 寫入: 80h ALE 10h 抹除: 60h ALE D0hSince the present invention manages the erased blocks, it is independent of the master control command of the host 200 and is performed according to the timestamp of the erased blocks. Therefore, even if the host side 200 does not issue a master control command to the controller 120, it will happen that the time stamp of the erased block in the backup pool 138 exceeds the critical value, which triggers the replacement of the erased block and triggers it. The event of the garbage collection operation. Therefore, in an embodiment, the controller 120 may issue the following continuous command sequence to the flash memory chips 130_1~130_N when it does not receive any access command from the host side 200: Read: 00h ALE 30h Write: 80h ALE 10h Erase: 60h ALE D0h

首先,假設一個已抹除區塊的時戳超過時間上限,那麼將會觸發上述流程的步驟240,對已抹除區塊進行寫入。而如上所述,對已抹除區塊進行寫入可能會同時觸發垃圾資料回收操作。因此,上述指令序列中的第一道讀取指令,便是進行垃圾資料回收操作,從備用池138以外的區塊DB0~DBK中的有效頁中讀取出資料。而讀出後的資料會被送到控制器120進行錯誤糾正(error correction)處理。接著,這些處理後的資料會被寫入至已抹除區塊,也就是上述指令序列中的第二道寫入指令。最後,會進入上述流程的步驟250,從備用池中選擇另一個區塊進行抹除,以替代已抹除區塊,也就是上述指令序列中的第三道抹除指令。從第4圖下方的時序示意圖可進一步看出,主控命令未引發控制器120產生相關的記憶體操作命令,但控制器120仍會週期性地產生自發性的記憶體操作命令。因此,本發明之一特徵便是,即便主機200未對控制器120下達存取命令時,控制器120也可能會自發性地對快閃記憶體模組130發出:讀取、寫入、抹除的連續指令序列。First, assuming that the time stamp of an erased block exceeds the upper limit of time, step 240 of the above process will be triggered to write to the erased block. As mentioned above, writing to the erased block may also trigger the garbage collection operation. Therefore, the first read instruction in the above instruction sequence is to perform garbage data collection operation, and read data from the valid pages in the blocks DB0~DBK outside the spare pool 138. The read data will be sent to the controller 120 for error correction processing. Then, the processed data will be written to the erased block, which is the second write command in the above-mentioned command sequence. Finally, it enters step 250 of the above process, and selects another block from the spare pool for erasing to replace the erased block, that is, the third erasing instruction in the above instruction sequence. It can be further seen from the timing diagram at the bottom of FIG. 4 that the main control command does not cause the controller 120 to generate related memory operation commands, but the controller 120 still periodically generates spontaneous memory operation commands. Therefore, one feature of the present invention is that even when the host 200 does not issue an access command to the controller 120, the controller 120 may spontaneously issue the flash memory module 130: read, write, erase A sequence of consecutive instructions for division.

綜上所述,本發明透過對於備用池的妥善管理,在有效地減少寫入延遲的(藉由在備用池中預留至少一個已抹除區塊)同時,又避免潛在的記憶體單元之物理性傷害(藉由限制區塊停留在已抹除狀態的時間)。同時,本發明管理機制也進一步與垃圾資料回收操作結合,從而更合理地進行對已抹除區塊的寫入與替換。 以上所述僅為本發明之較佳實施例,凡依本發明申請專利範圍所做之均等變化與修飾,皆應屬本發明之涵蓋範圍。In summary, through proper management of the spare pool, the present invention effectively reduces write latency (by reserving at least one erased block in the spare pool) while avoiding potential memory cell interference. Physical damage (by limiting the time the block stays in the erased state). At the same time, the management mechanism of the present invention is further combined with the garbage data recovery operation, so as to more rationally write and replace the erased blocks. The foregoing descriptions are only preferred embodiments of the present invention, and all equivalent changes and modifications made in accordance with the scope of the patent application of the present invention shall fall within the scope of the present invention.

100:儲存裝置 120:控制器 122:處理單元 124:儲存單元 130:快閃記憶體模組 130_1~130_N:快閃記憶體晶片 138:預備池 DB_0~DBK、SB_0~SBQ:區塊 210~250:步驟100: storage device 120: Controller 122: Processing Unit 124: storage unit 130: Flash memory module 130_1~130_N: Flash memory chip 138: Preparatory Pool DB_0~DBK, SB_0~SBQ: block 210~250: Step

第1圖繪示本發明實施例之相關儲存裝置、控制器與快閃記憶體模組之架構。 第2圖繪示一快閃記憶體模組與備用池之間的關聯。 第3圖繪示本發明實施例之用於快閃記憶體之區塊寫入管理的方法的流程圖。 第4圖繪示本發明實施例中主控命令與記憶體操作命令之間的關聯。Figure 1 shows the architecture of related storage devices, controllers and flash memory modules according to an embodiment of the present invention. Figure 2 shows the association between a flash memory module and the spare pool. FIG. 3 shows a flowchart of a method for block write management of flash memory according to an embodiment of the present invention. Figure 4 illustrates the association between the main control command and the memory operation command in the embodiment of the present invention.

210~250:步驟 210~250: Step

Claims (17)

一種管理一快閃記憶體模組的方法,該快閃記憶體模組包含複數個區塊,該複數個區塊中之一部分屬於一備用池(spare pool),該方法包含: 在該備用池中預留至少一已抹除區塊以利一寫入操作之進行; 監測該至少一已抹除區塊之一已抹除時間; 當該已抹除時間超過一臨界值時,對該快閃記憶體模組中的複數個特定區塊進行讀取操作;以及 利用從該複數個特定區塊中所讀取到的資料對該至少一已抹除區塊進行寫入。A method for managing a flash memory module, the flash memory module includes a plurality of blocks, a part of the plurality of blocks belongs to a spare pool, the method includes: Reserve at least one erased block in the spare pool to facilitate a write operation; Monitor the erased time of one of the at least one erased blocks; When the erased time exceeds a critical value, perform a read operation on a plurality of specific blocks in the flash memory module; and The at least one erased block is written using the data read from the plurality of specific blocks. 如請求項1所述的方法,其中該備用池中包含該至少一已抹除區塊以及至少一已寫入區塊。The method according to claim 1, wherein the spare pool includes the at least one erased block and at least one written block. 如請求項1所述的方法,其中監測該至少一已抹除區塊之該已抹除時間的步驟包含: 建立關聯於該至少一已抹除區塊的時戳;以及 定期根據該時戳中之時間資訊與該臨界值進行比對。The method according to claim 1, wherein the step of monitoring the erased time of the at least one erased block comprises: Establish a time stamp associated with the at least one erased block; and Periodically compare the time information in the time stamp with the critical value. 如請求項1所述的方法,其中對該該快閃記憶體模組中的複數個區塊進行讀取操作的步驟包含: 對該快閃記憶體模組中的複數個區塊進行一垃圾資料回收(garbage collection)操作;以及對該至少一已抹除區塊進行寫入的步驟包含: 利用將該垃圾資料回收操作所輸出的回收資料對該至少一已抹除區塊進行寫入。The method according to claim 1, wherein the step of reading a plurality of blocks in the flash memory module includes: Performing a garbage collection operation on a plurality of blocks in the flash memory module; and the steps of writing to at least one erased block include: The at least one erased block is written using the recycling data output from the garbage data recycling operation. 如請求項1所述的方法,另包含: 在未接收到一主機下達的存取命令時,自動從該快閃記憶體模組中讀取特定資料,並寫回該快閃記憶體模組中。The method described in claim 1, which additionally includes: When an access command from a host is not received, specific data is automatically read from the flash memory module and written back to the flash memory module. 如請求項1所述的方法,另包含: 從該備用池中之至少一已寫入區塊中選擇一第一區塊,並對該第一區塊進行一抹除操作;以及 以該第一區塊,替換該已抹除時間超過該臨界值的該至少一已抹除區塊。The method described in claim 1, which additionally includes: Select a first block from at least one written block in the spare pool, and perform an erase operation on the first block; and Use the first block to replace the at least one erased block whose erased time exceeds the threshold. 一種用於管理一快閃記憶體模組的控制器,其中該快閃記憶體模組包含複數個區塊,且該複數個區塊中之一部分屬於一備用池(spare pool),該控制器包含: 一儲存單元,用以儲存一程式碼;以及 一處理單元,耦接於該儲存單元,用以從該儲存單元中讀取該程式碼,以執行該程式碼,從而進行以下操作: 在該備用池中預留至少一已抹除區塊以利一寫入操作之進行; 監測該至少一已抹除區塊之一已抹除時間; 當該已抹除時間超過一臨界值時,對該快閃記憶體模組中的複數個特定區塊進行讀取操作;以及 利用從該複數個特定區塊中所讀取到的資料對該至少一已抹除區塊進行寫入。A controller for managing a flash memory module, wherein the flash memory module includes a plurality of blocks, and a part of the plurality of blocks belongs to a spare pool, the controller Include: A storage unit for storing a program code; and A processing unit, coupled to the storage unit, is used to read the program code from the storage unit to execute the program code to perform the following operations: Reserve at least one erased block in the spare pool to facilitate a write operation; Monitor the erased time of one of the at least one erased blocks; When the erased time exceeds a critical value, perform a read operation on a plurality of specific blocks in the flash memory module; and The at least one erased block is written using the data read from the plurality of specific blocks. 如請求項7所述的控制器,其中該處理單元執行該程式碼,以建立關聯於該至少一已抹除區塊的時戳;以及定期根據該時戳中之時間資訊與該臨界值進行比對。The controller according to claim 7, wherein the processing unit executes the code to establish a time stamp associated with the at least one erased block; and periodically performs processing based on the time information in the time stamp and the threshold Comparison. 如請求項7所述的控制器,其中該處理單元執行該程式碼,以對該快閃記憶體模組中的複數個區塊進行一垃圾資料回收(garbage collection)操作;以及利用將該垃圾資料回收操作所輸出的回收資料對該至少一已抹除區塊進行寫入來執行該替換操作。The controller according to claim 7, wherein the processing unit executes the code to perform a garbage collection operation on the plurality of blocks in the flash memory module; and utilizes the garbage The recovered data output by the data recovery operation writes the at least one erased block to perform the replacement operation. 如請求項7所述的控制器,其中該控制器受控於一主機,並且該處理單元執行該程式碼,以在未接收到該主機下達的存取命令時,自動從該快閃記憶體模組中讀取特定資料,並寫回該快閃記憶體模組中。The controller according to claim 7, wherein the controller is controlled by a host, and the processing unit executes the program code to automatically retrieve from the flash memory when an access command from the host is not received Read specific data from the module and write it back to the flash memory module. 如請求項7所述的控制器,該處理單元執行該程式碼,以從該備用池中之至少一已寫入區塊中選擇一第一區塊,並對該第一區塊進行一抹除操作;以及以該第一區塊,替換該已抹除時間超過該臨界值的該至少一已抹除區塊。For the controller according to claim 7, the processing unit executes the code to select a first block from at least one written block in the spare pool, and perform an erase on the first block Operation; and replacing the at least one erased block whose erased time exceeds the threshold with the first block. 一種儲存裝置,包含: 一快閃記憶體模組,包含複數個區塊,且該複數個區塊中之一部分屬於一備用池;以及 一控制器,用以對快閃記憶體模組進行存取,包含: 一儲存單元,用以儲存一程式碼;以及 一處理單元,耦接於該儲存單元,用以從該儲存單元中讀取該程式碼,以執行該程式碼,從而進行以下操作: 在該備用池中預留至少一已抹除區塊以利一寫入操作之進行; 監測該至少一已抹除區塊之一已抹除時間; 當該已抹除時間超過一臨界值時,對該快閃記憶體模組中的複數個特定區塊進行讀取操作;以及 利用從該複數個特定區塊中所讀取到的資料對該至少一已抹除區塊進行寫入。A storage device including: A flash memory module including a plurality of blocks, and a part of the plurality of blocks belongs to a spare pool; and A controller for accessing the flash memory module, including: A storage unit for storing a program code; and A processing unit, coupled to the storage unit, is used to read the program code from the storage unit to execute the program code to perform the following operations: Reserve at least one erased block in the spare pool to facilitate a write operation; Monitor the erased time of one of the at least one erased blocks; When the erased time exceeds a critical value, perform a read operation on a plurality of specific blocks in the flash memory module; and The at least one erased block is written using the data read from the plurality of specific blocks. 如請求項12所述的儲存裝置,其中該備用池中包含該至少一已抹除區塊以及至少一已寫入區塊。The storage device according to claim 12, wherein the spare pool includes the at least one erased block and at least one written block. 如請求項12所述的儲存裝置,其中該控制器用以建立關聯於該至少一已抹除區塊的時戳;以及定期根據該時戳中之時間資訊與該臨界值進行比對。The storage device according to claim 12, wherein the controller is used to establish a time stamp associated with the at least one erased block; and periodically compare the time information in the time stamp with the threshold value. 如請求項12所述的儲存裝置,其中當該已抹除時間超過該臨界值時,該控制器對該快閃記憶體模組中的複數個區塊進行一垃圾資料回收操作;以及利用將該垃圾資料回收操作所輸出的回收資料對該至少一已抹除區塊進行寫入。The storage device according to claim 12, wherein when the erased time exceeds the threshold, the controller performs a garbage data collection operation on the plurality of blocks in the flash memory module; and uses the The recycling data output by the garbage data recycling operation is written to the at least one erased block. 如請求項12所述的儲存裝置,其中該控制器受控於一主機,並且該控制器在未接收到該主機下達的存取命令時,自動從該快閃記憶體模組中讀取特定資料,並寫回該快閃記憶體模組中。The storage device according to claim 12, wherein the controller is controlled by a host, and when the controller does not receive the access command issued by the host, it automatically reads the specific flash memory module Data and write back to the flash memory module. 如請求項12所述的儲存裝置,其中當該已抹除時間超過該臨界值時,該控制器從該備用池中選擇至少一第一區塊,並對該至少一第一區塊進行一抹除操作;以及以該至少一第一區塊,替換該已抹除時間超過該臨界值的該至少一已抹除區塊。The storage device according to claim 12, wherein when the erased time exceeds the threshold, the controller selects at least one first block from the spare pool, and performs a wipe on the at least one first block An erasing operation; and replacing the at least one erased block whose erased time exceeds the threshold with the at least one first block.
TW110100022A 2019-04-01 2019-04-01 Write mangement for protecting erased blocks in flash memory TWI771854B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW110100022A TWI771854B (en) 2019-04-01 2019-04-01 Write mangement for protecting erased blocks in flash memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW110100022A TWI771854B (en) 2019-04-01 2019-04-01 Write mangement for protecting erased blocks in flash memory

Publications (2)

Publication Number Publication Date
TW202134883A true TW202134883A (en) 2021-09-16
TWI771854B TWI771854B (en) 2022-07-21

Family

ID=78777328

Family Applications (1)

Application Number Title Priority Date Filing Date
TW110100022A TWI771854B (en) 2019-04-01 2019-04-01 Write mangement for protecting erased blocks in flash memory

Country Status (1)

Country Link
TW (1) TWI771854B (en)

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7441071B2 (en) * 2006-09-28 2008-10-21 Sandisk Corporation Memory systems for phased garbage collection using phased garbage collection block or scratch pad block as a buffer
US8694754B2 (en) * 2011-09-09 2014-04-08 Ocz Technology Group, Inc. Non-volatile memory-based mass storage devices and methods for writing data thereto
CN103488578B (en) * 2012-12-28 2016-05-25 晶天电子(深圳)有限公司 Virtual memory facilities (VMD) application/driver
US20150379678A1 (en) * 2014-06-25 2015-12-31 Doa'a M. Al-otoom Techniques to Compose Memory Resources Across Devices and Reduce Transitional Latency
US9990279B2 (en) * 2014-12-23 2018-06-05 International Business Machines Corporation Page-level health equalization
CN108874309B (en) * 2018-05-25 2021-07-23 新华三技术有限公司 Method and device for managing physical blocks in solid state disk

Also Published As

Publication number Publication date
TWI771854B (en) 2022-07-21

Similar Documents

Publication Publication Date Title
KR102094334B1 (en) Non-volatile multi-level cell memory system and Method for performing adaptive data back-up in the system
TWI592800B (en) Memory management method and storage controller using the same
KR102467032B1 (en) Memory scheduling method and Memory system operating method
CN110908925B (en) High-efficiency garbage collection method, data storage device and controller thereof
US9280460B2 (en) Data writing method, memory control circuit unit and memory storage apparatus
US8285954B2 (en) Memory system managing a plurality of logs
US20140075100A1 (en) Memory system, computer system, and memory management method
US9058256B2 (en) Data writing method, memory controller and memory storage apparatus
US9021218B2 (en) Data writing method for writing updated data into rewritable non-volatile memory module, and memory controller, and memory storage apparatus using the same
CN107402716B (en) Data writing method, memory control circuit unit and memory storage device
US8667209B2 (en) Non-volatile memory access method and system, and non-volatile memory controller
CN102915208A (en) Information processing apparatus, semiconductor memory device and control method for the semiconductor memory device
JP2010211734A (en) Storage device using nonvolatile memory
US8914587B2 (en) Multi-threaded memory operation using block write interruption after a number or threshold of pages have been written in order to service another request
TW202001565A (en) Method for managing flash memory module and associated flash memory controller and electronic device
KR20200137244A (en) Memory system and operating method thereof
CN112083873A (en) Method and device for intelligently identifying unreliable blocks of nonvolatile storage medium
US20130179627A1 (en) Method for managing buffer memory, memory controllor, and memory storage device
TWI718516B (en) Write mangement for protecting erased blocks in flash memory
US9304906B2 (en) Memory system, controller and control method of memory
TWI771854B (en) Write mangement for protecting erased blocks in flash memory
US10846019B2 (en) Semiconductor device
TWI670598B (en) Method for managing flash memory module and associated flash memory controller and electronic device
JP4888333B2 (en) Flash disk device
CN112540932B (en) Memory controller and write assist method