TW202123016A - Storage controller, memory management method, and storage device - Google Patents
Storage controller, memory management method, and storage device Download PDFInfo
- Publication number
- TW202123016A TW202123016A TW108145546A TW108145546A TW202123016A TW 202123016 A TW202123016 A TW 202123016A TW 108145546 A TW108145546 A TW 108145546A TW 108145546 A TW108145546 A TW 108145546A TW 202123016 A TW202123016 A TW 202123016A
- Authority
- TW
- Taiwan
- Prior art keywords
- physical
- block
- target
- valid
- section
- Prior art date
Links
Images
Landscapes
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
Description
本發明是有關於一種記憶體管理方法,且特別是有關於一種配置有可複寫式非揮發性記憶體模組的儲存裝置、所述儲存裝置的儲存控制器以及所使用的記憶體管理方法。The present invention relates to a memory management method, and more particularly to a storage device equipped with a rewritable non-volatile memory module, a storage controller of the storage device, and a used memory management method.
一般來說,在儲存裝置的可複寫式非揮發性記憶體模組的閒置空間不足時,可儲存裝置的的控制器會對可複寫式非揮發性記憶體模組的多個實體區塊(亦稱,回收實體區塊)執行垃圾回收操作,以釋放出所述多個回收實體區塊的可用空間。Generally speaking, when the free space of the rewritable non-volatile memory module of the storage device is insufficient, the controller of the storage device will treat multiple physical blocks of the rewritable non-volatile memory module ( Also known as reclaiming physical blocks) perform a garbage collection operation to release the available space of the multiple reclaimed physical blocks.
垃圾回收操作需要耗費大量的時間來辨識儲存於所述多個回收實體區塊中的有效資料的實體位址,而使可複寫式非揮發性記憶體模組於執行垃圾回收操作時的效能降低。The garbage collection operation takes a lot of time to identify the physical addresses of the valid data stored in the multiple garbage collection blocks, which reduces the performance of the rewritable non-volatile memory module when performing garbage collection operations. .
基此,要如何有效率地增進垃圾回收操作的速度,以增進儲存裝置的效能,是本領域人員研究的課題之一。Based on this, how to efficiently increase the speed of the garbage collection operation so as to increase the performance of the storage device is one of the subjects studied by those in the field.
本發明的一實施例提供用於控制配置有可複寫式非揮發性記憶體模組的儲存裝置的一種儲存控制器。所述儲存控制器包括連接介面電路、記憶體介面控制電路、區塊管理電路單元以及處理器。所述連接介面電路用以耦接至主機系統。所述記憶體介面控制電路用以耦接至所述可複寫式非揮發性記憶體模組,其中所述可複寫式非揮發性記憶體模組具有多個實體區塊,並且所述多個實體區塊各自具有多個實體頁面。所述處理器耦接至所述連接介面電路、所述記憶體介面控制電路及所述區塊管理電路單元。所述區塊管理電路單元用以將所述多個實體區塊中的每一個實體區塊的所述多個實體頁面分組至多個實體區段。所述處理器用以執行一寫入指令,其中所述寫入指令用以指示儲存一資料至一或多個邏輯頁面中,其中所述一或多個邏輯頁面已被映射至一目標實體區塊的一或多個目標實體頁面,並且所述一或多個目標實體頁面屬於所述目標實體區塊的多個目標實體區段中的一第一目標實體區段。此外,所述區塊管理電路單元更用以根據所述寫入指令更新所述多個目標實體區段的多個目標區段有效資料計數中的對應所述第一目標實體區段的第一目標區段有效資料計數,其中所述區塊管理電路單元更用以根據已更新的所述第一目標區段有效資料計數來更新所述多個實體區塊的多個區塊有效資料計數中的對應所述目標實體區塊的目標區塊有效資料計數,其中所述區塊管理電路單元更用以根據所述目標實體區塊的所述多個目標區段有效資料計數來更新所述多個實體區塊的多個有效區段計數中對應所述目標實體區塊的目標有效區段計數,其中所述多個有效區段計數各自用以記錄所對應的實體區塊的一或多個有效實體區段的總數量,其中所述一或多個有效實體區段各自的所述區段有效資料計數大於零。An embodiment of the present invention provides a storage controller for controlling a storage device equipped with a rewritable non-volatile memory module. The storage controller includes a connection interface circuit, a memory interface control circuit, a block management circuit unit, and a processor. The connection interface circuit is used for coupling to the host system. The memory interface control circuit is used for coupling to the rewritable non-volatile memory module, wherein the rewritable non-volatile memory module has a plurality of physical blocks, and the plurality of Each physical block has multiple physical pages. The processor is coupled to the connection interface circuit, the memory interface control circuit, and the block management circuit unit. The block management circuit unit is used for grouping the plurality of physical pages of each of the plurality of physical blocks into a plurality of physical sections. The processor is used for executing a write command, wherein the write command is used for instructing to store a data in one or more logical pages, wherein the one or more logical pages have been mapped to a target physical block One or more target entity pages of the target entity page, and the one or more target entity pages belong to a first target entity section of the plurality of target entity sections of the target entity block. In addition, the block management circuit unit is further configured to update the first one corresponding to the first target physical section among the valid data counts of the plurality of target physical sections of the plurality of target physical sections according to the write instruction. The effective data count of the target section, wherein the block management circuit unit is further used to update the effective data counts of the plurality of physical blocks according to the updated effective data count of the first target section The target block effective data count corresponding to the target physical block, wherein the block management circuit unit is further used to update the multiple target block effective data counts of the target physical block A target effective section count corresponding to the target physical block among the plurality of effective section counts of a physical block, wherein each of the plurality of effective section counts is used to record one or more corresponding physical blocks The total number of valid physical segments, wherein the segment valid data count of each of the one or more valid physical segments is greater than zero.
本發明的一實施例提供適用於用以控制配置有一可複寫式非揮發性記憶體模組的一儲存裝置的儲存控制器的一種記憶體管理方法,其中所述可複寫式非揮發性記憶體模組具有多個實體區塊,並且所述多個實體區塊各自具有多個實體頁面。所述方法包括:將所述多個實體區塊中的每一個實體區塊的所述多個實體頁面分組至多個實體區段;執行一寫入指令,其中所述寫入指令用以指示儲存一資料至一或多個邏輯頁面中,其中所述一或多個邏輯頁面已被映射至一目標實體區塊的一或多個目標實體頁面,並且所述一或多個目標實體頁面屬於所述目標實體區塊的多個目標實體區段中的一第一目標實體區段;根據所述寫入指令更新所述多個目標實體區段的多個目標區段有效資料計數中的對應所述第一目標實體區段的第一目標區段有效資料計數;根據已更新的所述第一目標區段有效資料計數來更新所述多個實體區塊的多個區塊有效資料計數中的對應所述目標實體區塊的目標區塊有效資料計數;以及根據所述目標實體區塊的所述多個目標區段有效資料計數來更新所述多個實體區塊的多個有效區段計數中對應所述目標實體區塊的目標有效區段計數,其中所述多個有效區段計數各自用以記錄所對應的實體區塊的一或多個有效實體區段的總數量,其中所述一或多個有效實體區段各自的所述區段有效資料計數大於零。An embodiment of the present invention provides a memory management method suitable for a storage controller for controlling a storage device equipped with a rewritable non-volatile memory module, wherein the rewritable non-volatile memory The module has a plurality of physical blocks, and each of the plurality of physical blocks has a plurality of physical pages. The method includes: grouping the plurality of physical pages of each of the plurality of physical blocks into a plurality of physical sections; executing a write command, wherein the write command is used to instruct storage A data into one or more logical pages, wherein the one or more logical pages have been mapped to one or more target physical pages of a target physical block, and the one or more target physical pages belong to all A first target entity section of the plurality of target entity sections of the target entity block; the corresponding one of the multiple target section valid data counts of the plurality of target entity sections is updated according to the write instruction The effective data count of the first target section of the first target physical section; and the effective data counts of the plurality of physical blocks are updated according to the updated effective data count of the first target section Corresponding to the effective data count of the target block of the target physical block; and updating the multiple effective section counts of the plurality of physical blocks according to the effective data count of the multiple target sections of the target physical block The target effective section count corresponding to the target physical block in the target physical block, wherein each of the plurality of effective section counts is used to record the total number of one or more effective physical sections of the corresponding physical block, wherein the The segment valid data count of each of one or more valid physical segments is greater than zero.
本發明的一實施例提供一種儲存裝置。所述儲存裝置包括可複寫式非揮發性記憶體模組以及儲存控制器,其中所述可複寫式非揮發性記憶體模組具有多個實體區塊,並且所述多個實體區塊各自具有多個實體頁面。所述儲存控制器耦接至所述可複寫式非揮發性記憶體模組。所述儲存控制器用以將所述多個實體區塊中的每一個實體區塊的所述多個實體頁面分組至多個實體區段,其中所述儲存控制器更用以執行一寫入指令,其中所述寫入指令用以指示儲存一資料至一或多個邏輯頁面中,其中所述一或多個邏輯頁面已被映射至一目標實體區塊的一或多個目標實體頁面,並且所述一或多個目標實體頁面屬於所述目標實體區塊的多個目標實體區段中的一第一目標實體區段。所述儲存控制器更用以根據所述寫入指令更新所述多個目標實體區段的多個目標區段有效資料計數中的對應所述第一目標實體區段的第一目標區段有效資料計數,其中所述儲存控制器更用以根據已更新的所述第一目標區段有效資料計數來更新所述多個實體區塊的多個區塊有效資料計數中的對應所述目標實體區塊的目標區塊有效資料計數,其中所述儲存控制器更用以根據所述目標實體區塊的所述多個目標區段有效資料計數來更新所述多個實體區塊的多個有效區段計數中對應所述目標實體區塊的目標有效區段計數,其中所述多個有效區段計數各自用以記錄所對應的實體區塊的一或多個有效實體區段的總數量,其中所述一或多個有效實體區段各自的所述區段有效資料計數大於零。An embodiment of the present invention provides a storage device. The storage device includes a rewritable non-volatile memory module and a storage controller, wherein the rewritable non-volatile memory module has a plurality of physical blocks, and each of the plurality of physical blocks has Multiple physical pages. The storage controller is coupled to the rewritable non-volatile memory module. The storage controller is used for grouping the plurality of physical pages of each of the plurality of physical blocks into a plurality of physical sections, wherein the storage controller is further used for executing a write command, The write command is used to instruct to store a data in one or more logical pages, wherein the one or more logical pages have been mapped to one or more target physical pages of a target physical block, and The one or more target entity pages belong to a first target entity section of the plurality of target entity sections of the target entity block. The storage controller is further configured to update a first target segment corresponding to the first target physical segment in the valid data counts of a plurality of target segments of the plurality of target physical segments according to the write instruction. Data count, wherein the storage controller is further used to update the target entity in the plurality of block effective data counts of the plurality of physical blocks according to the updated first target section effective data count The effective data count of the target block of the block, wherein the storage controller is further used for updating the effective data of the plurality of physical blocks according to the effective data count of the plurality of target sections of the target physical block The section count corresponds to the target effective section count of the target physical block, wherein each of the plurality of effective section counts is used to record the total number of one or more effective physical sections of the corresponding physical block, The valid data count of each of the one or more valid physical segments is greater than zero.
基於上述,本發明的實施例所提供的儲存控制器、記憶體管理方法以及儲存裝置,可將可複寫式非揮發性記憶體模組的多個實體區塊中的每一個實體區塊的所述多個實體頁面分組至多個實體區段,根據所述寫入指令更新對應的區段有效資料計數、對應的有效資料計數以及對應的有效區段計數,以利用所述區塊有效資料計數與所述有效區段計數來選擇且排序多個回收實體區塊,以依據有效資料的集中度來依序對所述多個垃圾實體區塊執行垃圾回收操作,進而有效率地釋放出可複寫式非揮發性記憶體模組的空間而增進了儲存裝置的整體存取效能Based on the above, the storage controller, the memory management method, and the storage device provided by the embodiments of the present invention can combine all the physical blocks of each of the multiple physical blocks of the rewritable non-volatile memory module. The multiple physical pages are grouped into multiple physical sections, and the corresponding section valid data count, the corresponding valid data count, and the corresponding valid section count are updated according to the write command, so as to use the block valid data count and The effective section count selects and sorts a plurality of reclaimed physical blocks, so as to sequentially perform a garbage collection operation on the plurality of garbage physical blocks according to the concentration of effective data, thereby efficiently releasing the rewritable type The space of the non-volatile memory module improves the overall access performance of the storage device
在本實施例中,儲存裝置包括可複寫式非揮發性記憶體模組(rewritable non-volatile memory module)與儲存裝置控制器(亦稱,儲存控制器或儲存控制電路)。此外,儲存裝置是與主機系統一起使用,以使主機系統可將資料寫入至儲存裝置或從儲存裝置中讀取資料。In this embodiment, the storage device includes a rewritable non-volatile memory module and a storage device controller (also referred to as a storage controller or a storage control circuit). In addition, the storage device is used together with the host system so that the host system can write data to the storage device or read data from the storage device.
圖1是根據本發明的一實施例所繪示的主機系統及儲存裝置的方塊示意圖。FIG. 1 is a block diagram of a host system and a storage device according to an embodiment of the invention.
請參照圖1,主機系統(Host System)10包括處理器(Processor)110、主機記憶體(Host Memory)120及資料傳輸介面電路(Data Transfer Interface Circuit)130。在本實施例中,資料傳輸介面電路130耦接(亦稱,電性連接)至處理器110與主機記憶體120。在另一實施例中,處理器110、主機記憶體120與資料傳輸介面電路130之間利用系統匯流排(System Bus)彼此耦接。Please refer to FIG. 1, the
儲存裝置20包括儲存控制器(Storage Controller)210、可複寫式非揮發性記憶體模組(Rewritable Non-Volatile Memory Module)220及連接介面電路(Connection Interface Circuit)230。其中,儲存控制器210包括處理器211、資料管理電路(Data Management Circuit)212與記憶體介面控制電路(Memory Interface Control Circuit)213。The
在本實施例中,主機系統10是透過資料傳輸介面電路130與儲存裝置20的連接介面電路230耦接至儲存裝置20來進行資料的存取操作。例如,主機系統10可經由資料傳輸介面電路130將資料儲存至儲存裝置20或從儲存裝置20中讀取資料。In this embodiment, the
在本實施例中,處理器110、主機記憶體120及資料傳輸介面電路130可設置在主機系統10的主機板上。資料傳輸介面電路130的數目可以是一或多個。透過資料傳輸介面電路130,主機板可以經由有線或無線方式耦接至儲存裝置20。儲存裝置20可例如是隨身碟、記憶卡、固態硬碟(Solid State Drive,SSD)或無線記憶體儲存裝置。無線記憶體儲存裝置可例如是近距離無線通訊(Near Field Communication,NFC)記憶體儲存裝置、無線傳真(WiFi)記憶體儲存裝置、藍牙(Bluetooth)記憶體儲存裝置或低功耗藍牙記憶體儲存裝置(例如,iBeacon)等以各式無線通訊技術為基礎的記憶體儲存裝置。此外,主機板也可以透過系統匯流排耦接至全球定位系統(Global Positioning System,GPS)模組、網路介面卡、無線傳輸裝置、鍵盤、螢幕、喇叭等各式I/O裝置。In this embodiment, the
在本實施例中,資料傳輸介面電路130與連接介面電路230是相容於高速周邊零件連接介面(Peripheral Component Interconnect Express, PCI Express)標準的介面電路。並且,資料傳輸介面電路130與連接介面電路230之間是利用快速非揮發性記憶體介面標準(Non-Volatile Memory express,NVMe)通訊協定來進行資料的傳輸。In this embodiment, the data
然而,必須瞭解的是,本發明不限於此,資料傳輸介面電路130與連接介面電路230亦可以是符合並列先進附件(Parallel Advanced Technology Attachment,PATA)標準、電氣和電子工程師協會(Institute of Electrical and Electronic Engineers,IEEE)1394標準、序列先進附件(Serial Advanced Technology Attachment,SATA)標準、通用序列匯流排(Universal Serial Bus,USB)標準、SD介面標準、超高速一代(Ultra High Speed-I,UHS-I)介面標準、超高速二代(Ultra High Speed-II,UHS-II)介面標準、記憶棒(Memory Stick, MS)介面標準、多晶片封裝(Multi-Chip Package)介面標準、多媒體儲存卡(Multi Media Card,MMC)介面標準、eMMC介面標準、通用快閃記憶體(Universal Flash Storage,UFS)介面標準、eMCP介面標準、CF介面標準、整合式驅動電子介面(Integrated Device Electronics,IDE)標準或其他適合的標準。此外,在另一實施例中,連接介面電路230可與儲存控制器210封裝在一個晶片中,或者連接介面電路230是佈設於一包含儲存控制器210之晶片外。However, it must be understood that the present invention is not limited to this. The data
在本實施例中,主機記憶體120用以暫存處理器110所執行的指令或資料。例如,在本範例實施例中,主機記憶體120可以是動態隨機存取記憶體(Dynamic Random Access Memory,DRAM)、靜態隨機存取記憶體(Static Random Access Memory,SRAM)等。然而,必須瞭解的是,本發明不限於此,主機記憶體120也可以是其他適合的記憶體。In this embodiment, the
儲存控制器210用以執行以硬體型式或韌體型式實作的多個邏輯閘或控制指令並且根據主機系統10的指令在可複寫式非揮發性記憶體模組220中進行資料的寫入、讀取與抹除等運作。The storage controller 210 is used to execute a plurality of logic gates or control commands implemented in a hardware type or a firmware type, and to write data in the rewritable
更詳細來說,儲存控制器210中的處理器211為具備運算能力的硬體,其用以控制儲存控制器210的整體運作。具體來說,處理器211具有多個控制指令,並且在儲存裝置20運作時,此些控制指令會被執行以進行資料的寫入、讀取與抹除等運作。In more detail, the
值得一提的是,在本實施例中,處理器110與處理器211例如是中央處理單元(Central Processing Unit,CPU)、微處理器(micro-processor)、或是其他可程式化之處理單元(Microprocessor)、數位訊號處理器(Digital Signal Processor,DSP)、可程式化控制器、特殊應用積體電路(Application Specific Integrated Circuits,ASIC)、可程式化邏輯裝置(Programmable Logic Device,PLD)或其他類似電路元件,本發明並不限於此。It is worth mentioning that in this embodiment, the
在一實施例中,儲存控制器210還具有唯讀記憶體(未繪示)及隨機存取記憶體(未繪示)。特別是,此唯讀記憶體具有開機碼(boot code),並且當儲存控制器210被致能時,處理器211會先執行此開機碼來將儲存於可複寫式非揮發性記憶體模組220中之控制指令載入至儲存控制器210的隨機存取記憶體中。之後,處理器211會運轉此些控制指令以進行資料的寫入、讀取與抹除等運作。在另一實施例中,處理器211的控制指令亦可以程式碼型式儲存於可複寫式非揮發性記憶體模組220的特定區域,例如,可複寫式非揮發性記憶體模組220中專用於存放系統資料的實體儲存單元中。In one embodiment, the storage controller 210 also has a read-only memory (not shown) and a random access memory (not shown). In particular, the read-only memory has a boot code, and when the storage controller 210 is enabled, the
在本實施例中,如上所述,儲存控制器210還包括資料管理電路212與記憶體介面控制電路213。應注意的是,儲存控制器210各部件所執行的操作亦可視為儲存控制器210所執行的操作。In this embodiment, as described above, the storage controller 210 further includes a
其中,資料管理電路212耦接至處理器211、記憶體介面控制電路213與連接介面電路230。資料管理電路212用以接受處理器211的指示來進行資料的傳輸。例如,經由連接介面電路230從主機系統10(如,主機記憶體120)讀取資料,並且將所讀取的資料經由記憶體介面控制電路213寫入至可複寫式非揮發性記憶體模組220中(如,根據來自主機系統10的寫入指令來進行寫入操作)。又例如,經由記憶體介面控制電路213從可複寫式非揮發性記憶體模組220的一或多個實體單元中讀取資料(資料可讀取自一或多個實體單元中的一或多個記憶胞),並且將所讀取的資料經由連接介面電路230寫入至主機系統10(如,主機記憶體120)中(如,根據來自主機系統10的讀取指令來進行讀取操作)。在另一實施例中,資料管理電路212亦可整合至處理器211中。The
記憶體介面控制電路213用以接受處理器211的指示,配合資料管理電路212來進行對於可複寫式非揮發性記憶體模組220的寫入(亦稱,程式化,Programming)操作、讀取操作或抹除操作。The memory
舉例來說,處理器211可執行寫入指令序列,以指示記憶體介面控制電路213將資料寫入至可複寫式非揮發性記憶體模組220中;處理器211可執行讀取指令序列,以指示記憶體介面控制電路213從可複寫式非揮發性記憶體模組220的對應讀取指令的一或多個實體單元(亦稱,目標實體單元)中讀取資料;處理器211可執行抹除指令序列,以指示記憶體介面控制電路213對可複寫式非揮發性記憶體模組220進行抹除操作。寫入指令序列、讀取指令序列及抹除指令序列可各別包括一或多個程式碼或指令碼並且用以指示對可複寫式非揮發性記憶體模組220執行相對應的寫入、讀取及抹除等操作。在一實施例中,處理器211還可以下達其他類型的指令序列給記憶體介面控制電路213,以對可複寫式非揮發性記憶體模組220執行相對應的操作。For example, the
此外,欲寫入至可複寫式非揮發性記憶體模組220的資料會經由記憶體介面控制電路213轉換為可複寫式非揮發性記憶體模組220所能接受的格式。具體來說,若處理器211要存取可複寫式非揮發性記憶體模組220,處理器211會傳送對應的指令序列給記憶體介面控制電路213以指示記憶體介面控制電路213執行對應的操作。例如,這些指令序列可包括指示寫入資料的寫入指令序列、指示讀取資料的讀取指令序列、指示抹除資料的抹除指令序列、以及用以指示各種記憶體操作(例如,改變預設讀取電壓組的多個預設讀取電壓值以進行讀取操作,或執行垃圾回收程序等等)的相對應的指令序列。這些指令序列可包括一或多個訊號,或是在匯流排上的資料。這些訊號或資料可包括指令碼或程式碼。例如,在讀取指令序列中,會包括讀取的辨識碼、記憶體位址等資訊。In addition, the data to be written into the rewritable
可複寫式非揮發性記憶體模組220是耦接至儲存控制器210(記憶體介面控制電路213)並且用以儲存主機系統10所寫入之資料。可複寫式非揮發性記憶體模組220可以是單階記憶胞(Single Level Cell,SLC)NAND型快閃記憶體模組(即,一個記憶胞中可儲存1個位元的快閃記憶體模組)、多階記憶胞(Multi Level Cell,MLC)NAND型快閃記憶體模組(即,一個記憶胞中可儲存2個位元的快閃記憶體模組)、三階記憶胞(Triple Level Cell,TLC)NAND型快閃記憶體模組(即,一個記憶胞中可儲存3個位元的快閃記憶體模組)、四階記憶胞(Quadruple Level Cell,QLC)NAND型快閃記憶體模組(即,一個記憶胞中可儲存4個位元的快閃記憶體模組)、三維NAND型快閃記憶體模組(3D NAND flash memory module)或垂直NAND型快閃記憶體模組(Vertical NAND flash memory module)等其他快閃記憶體模組或其他具有相同特性的記憶體模組。可複寫式非揮發性記憶體模組220中的記憶胞是以陣列的方式設置。The rewritable
在本實施例中,可複寫式非揮發性記憶體模組220具有多個字元線,其中所述多個字元線的每一個字元線耦接至多個記憶胞。同一條字元線上的多個記憶胞會組成一或多個實體程式化單元。此外,多個實體程式化單元可組成一個實體單元(實體區塊或實體抹除單元)。In this embodiment, the rewritable
在本實施例中,是以記憶胞作為寫入(程式化)資料的最小單位。實體單元為抹除之最小單位,即,每一實體單元含有最小數目之一併被抹除之記憶胞。In this embodiment, the memory cell is used as the smallest unit for writing (programming) data. The physical unit is the smallest unit of erasure, that is, each physical unit contains one of the smallest number of memory cells that are erased.
每一實體單元會具有多個實體子單元。實體子單元可為實體頁面(page)或是實體扇(sector)。在本實施例中,實體子單元包括資料位元區與冗餘(redundancy)位元區。資料位元區用以儲存使用者資料,而冗餘位元區用以儲存系統資料。系統資料例如為錯誤更正碼、錯誤檢查碼或元資料(Meta Data)。然而,本發明不限於此。例如,在另一實施例中,亦可變化本實施例所述的資料傳輸方法,應用至以實體單元作為寫入資料的最小儲存單位的可複寫式非揮發性記憶體模組220。Each physical unit will have multiple physical sub-units. The physical subunit can be a physical page (page) or a physical sector (sector). In this embodiment, the physical subunit includes a data bit area and a redundancy bit area. The data bit area is used to store user data, and the redundant bit area is used to store system data. The system data is, for example, error correction code, error check code, or metadata (Meta Data). However, the present invention is not limited to this. For example, in another embodiment, the data transmission method described in this embodiment can also be modified and applied to a rewritable
應注意的是,在本實施例中,用以記錄一實體單元的資訊的系統資料可利用該實體單元中的一或多個實體子單元來記錄,或是利用一個系統區中用以記錄所有系統資料的特定實體單元的一或多個實體子單元來記錄。在本實施例中,所述對應一實體單元的系統資料包括該實體單元的抹除次數值(Program erase cycle,PEC)、區塊有效資料計數(Block Valid Data Count)、多個區段有效資料計數(Segment Valid Data Count)以及有效區段計數(Valid Segment Count)(亦稱,有效區段總數)等資訊。It should be noted that, in this embodiment, the system data used to record the information of a physical unit can be recorded by one or more physical subunits in the physical unit, or can be recorded in a system area for recording all One or more physical sub-units of a specific physical unit of the system data are recorded. In this embodiment, the system data corresponding to a physical unit includes the erase frequency value (Program erase cycle, PEC) of the physical unit, the block valid data count (Block Valid Data Count), and multiple section valid data. Count (Segment Valid Data Count) and valid segment count (Valid Segment Count) (also known as the total number of valid segments) and other information.
在以下實施例中,是以一個實體區塊作為一個實體單元的範例。然而,在另一實施例中,一個實體單元亦可以是指任意數目的記憶胞組成,視實務上的需求而定。此外,必須瞭解的是,當儲存控制器211對可複寫式非揮發性記憶體模組220中的記憶胞(或實體單元)進行分組以執行對應的管理操作時,此些記憶胞(或實體單元)是被邏輯地分組,而其實際位置並未更動。In the following embodiments, a physical block is used as an example of a physical unit. However, in another embodiment, a physical unit can also refer to any number of memory cells, depending on practical requirements. In addition, it must be understood that when the
儲存控制器210會配置多個邏輯單元給可複寫式非揮發性記憶體模組220。主機系統10是透過所配置的邏輯單元來存取儲存在多個實體單元中的使用者資料。在此,每一個邏輯單元可以是由一或多個邏輯位址組成。例如,邏輯單元可以是邏輯區塊(Logical Block)、邏輯頁面(Logical Page)或是邏輯扇區(Logical Sector)。一個邏輯單元可以是映射至一或多個實體單元,其中實體單元可以是一或多個實體位址、一或多個實體扇、一或多個實體程式化單元或者一或多個實體抹除單元。在本實施例中,邏輯單元為邏輯區塊,並且邏輯子單元為邏輯頁面。每一邏輯單元具有多個邏輯子單元。The storage controller 210 allocates a plurality of logic units to the rewritable
此外,儲存控制器210會建立邏輯轉實體位址映射表(Logical To Physical address mapping table)與實體轉邏輯位址映射表(Physical To Logical address mapping table),以記錄配置給可複寫式非揮發性記憶體模組220的邏輯單元(如,邏輯區塊、邏輯頁面或邏輯扇區)與實體單元(如,實體抹除單元、實體程式化單元、實體扇區)之間的位址映射關係。換言之,儲存控制器210可藉由邏輯轉實體位址映射表來查找一邏輯單元所映射的實體單元,並且儲存控制器210可藉由實體轉邏輯位址映射表來查找一實體單元所映射的邏輯單元。然而,上述有關邏輯單元與實體單元映射的技術概念為本領域技術人員之慣用技術手段且非本發明所欲闡述的技術方案,不再贅述於此。例如,主機系統10可配置多個邏輯頁面,並且所述多個邏輯頁面可被映射至多個實體頁面。In addition, the storage controller 210 creates a logical to physical address mapping table (Logical To Physical address mapping table) and a physical to logical address mapping table (Physical To Logical address mapping table) to record the configuration to the rewritable non-volatile The address mapping relationship between logical units (eg, logical blocks, logical pages, or logical sectors) of the
在本實施例中,錯誤檢查與校正電路214是耦接至處理器211並且用以執行錯誤檢查與校正程序以確保資料的正確性。具體來說,當處理器211從主機系統10中接收到寫入指令時,錯誤檢查與校正電路214會為對應此寫入指令的資料產生對應的錯誤更正碼(error correcting code,ECC)及/或錯誤檢查碼(error detecting code,EDC),並且處理器211會將對應此寫入指令的資料與對應的錯誤更正碼及/或錯誤檢查碼寫入至可複寫式非揮發性記憶體模組220中。之後,當處理器211從可複寫式非揮發性記憶體模組220中讀取資料時會同時讀取此資料對應的錯誤更正碼及/或錯誤檢查碼,並且錯誤檢查與校正電路214會依據此錯誤更正碼及/或錯誤檢查碼對所讀取的資料執行錯誤檢查與校正程序。In this embodiment, the error checking and correcting
在一實施例中,儲存控制器210還包括緩衝記憶體216與電源管理電路217。緩衝記憶體是耦接至處理器211並且用以暫存來自於主機系統10的資料與指令、來自於可複寫式非揮發性記憶體模組220的資料或其他用以管理儲存裝置20的系統資料,以讓處理器211可快速地從緩衝記憶體216中存取所述資料、指令或系統資料。電源管理電路217是耦接至處理器211並且用以控制儲存裝置20的電源。In one embodiment, the storage controller 210 further includes a
在本實施例中,區塊管理電路單元215包括有效資料計數電路2151與有效區段管理電路2152。所述區塊管理電路單元215用以管理可複寫式非揮發性記憶體模組220中的多個實體區塊的資訊。區塊管理電路單元215各部件的運作也可代表區塊管理電路單元215的運作。以下利用圖2來說明區塊管理電路單元215的功用以及對應的本實施例所提供的記憶體管理方法。In this embodiment, the block management circuit unit 215 includes a valid data counting circuit 2151 and a valid section management circuit 2152. The block management circuit unit 215 is used to manage the information of multiple physical blocks in the rewritable
圖2是根據本發明的一實施例所繪示的記憶體管理方法的流程圖。請參照圖2,在步驟S210中,區塊管理電路單元215將可複寫式非揮發性記憶體模組220的多個實體區塊中的每一個實體區塊的多個實體頁面分組至多個實體區段。以下先利用圖4A、4B來進行說明。FIG. 2 is a flowchart of a memory management method according to an embodiment of the invention. 2, in step S210, the block management circuit unit 215 groups the multiple physical pages of each of the multiple physical blocks of the rewritable
圖4A是根據本發明的一實施例所繪示的碼字、實體頁面、實體區塊與可複寫式非揮發性記憶體模組的示意圖。圖4B是根據本發明的一實施例所繪示的分組實體區塊的多個實體頁面為多個實體區段的示意圖。4A is a schematic diagram of a codeword, a physical page, a physical block, and a rewritable non-volatile memory module according to an embodiment of the present invention. FIG. 4B is a schematic diagram illustrating that multiple physical pages of a grouped physical block are multiple physical sections according to an embodiment of the present invention.
請先參照圖4A,在本實施例中,從主機系統10所接收到的資料是以碼字(Codeword)為單位被儲存在一個實體頁面中,如,碼字CW(1)~CW(M),M為正整數。依據每個可複寫式非揮發性記憶體模組220的規格不同,每一個實體頁面所儲存的碼字的數量不同。多個實體頁面P(1)~P(NP)會被劃分為一個實體區塊,N、P為正整數(NP代表N乘以P的積)。多個實體區塊B(1)~B(Q)屬於可複寫式非揮發性記憶體模組220,Q為正整數。Please refer to FIG. 4A. In this embodiment, the data received from the
應注意的是,本發明並不限於M、N、P、Q的具體數值,M、N、P、Q的具體數值是依據可複寫式非揮發性記憶體模組220的規格或廠商的需求被預先設定的。It should be noted that the present invention is not limited to the specific values of M, N, P, and Q. The specific values of M, N, P, and Q are based on the specifications of the rewritable
請參照圖4B,在本實施例中,區塊管理電路單元215會對每一個實體區塊所具有的多個實體頁面進行分組。例如,區塊管理電路單元215將實體區塊B(1)的多個實體頁面P(1)~P(NP)分組為多個實體區段S(1)~S(N)。每P個實體頁面會被分組至一個實體區段,如,實體區段S(1)包括實體頁面P(1)~P(P),實體區段S(2)包括實體頁面P(P+1)~P(2P),實體區段S(N)包括實體頁面P(NP-P+1)~P(NP)等等…。在獲得已分組的所述多個實體區段S(1)~S(N)後,區塊管理電路單元215可對應地記錄/維護/更新相關於所述多個實體區段S(1)~S(N)的多種資訊(如,有效資料計數、區段有效資料計數、區塊有效資料計數、有效區段計數等等…)。Referring to FIG. 4B, in this embodiment, the block management circuit unit 215 groups the multiple physical pages of each physical block. For example, the block management circuit unit 215 groups the multiple physical pages P(1)~P(NP) of the physical block B(1) into multiple physical sections S(1)~S(N). Each P physical pages will be grouped into a physical section. For example, physical section S(1) includes physical pages P(1)~P(P), and physical section S(2) includes physical pages P(P+ 1)~P(2P), the physical section S(N) includes physical pages P(NP-P+1)~P(NP), etc... After obtaining the grouped physical sections S(1) to S(N), the block management circuit unit 215 can correspondingly record/maintain/update related to the plurality of physical sections S(1) ~S(N) a variety of information (such as valid data count, segment valid data count, block valid data count, valid segment count, etc...).
請在回到圖2,在步驟S220中,處理器211執行一寫入指令,其中所述寫入指令用以指示儲存一資料至邏輯區塊的一或多個邏輯頁面中,其中所述邏輯區塊已被映射至所述多個實體區塊中的一目標實體區塊,其中所述一或多個邏輯頁面已被映射至所述目標實體區塊的一或多個目標實體頁面,並且所述一或多個目標實體頁面屬於所述目標實體區塊的多個目標實體區段中的一第一目標實體區段。具體來說,所述寫入指令可以是從主機系統10所接收的寫入指令,或是用以更新/搬移/複製已經儲存在可複寫式非揮發性記憶體模組220的資料的指令。Please return to FIG. 2. In step S220, the
在本實施例中,若所述寫入指令所對應的一或多個邏輯頁面所映射的一或多個實體頁面(亦稱,目標實體頁面)已經儲存有資料,處理器211會選擇其他實體頁面來儲存對應所述寫入指令的寫入資料,所述一或多個實體頁面所儲存的有效資料會成為無效資料,進而經由區塊管理電路單元215(或有效資料計數電路2151)更新/減少所述一或多個實體頁面的有效資料計數(基於所述一或多個實體頁面中成為無效資料的所有碼字的總數量)。In this embodiment, if one or more physical pages (also known as target physical pages) mapped by one or more logical pages corresponding to the write instruction already have data stored in them, the
另一方面,若所述寫入指令所對應的一或多個邏輯頁面所映射的一或多個實體頁面(亦稱,目標實體頁面)是空白的(尚未儲存有資料),處理器211會直接使用所述一或多個目標實體頁面來儲存對應所述寫入指令的寫入資料,所述一或多個實體頁面所儲存的寫入資料會成為有效資料,並且經由區塊管理電路單元215(或有效資料計數電路2151)更新/增加所述一或多個實體頁面的有效資料計數(基於所述一或多個實體頁面中為有效資料的所有碼字的總數量)。另一方面,若所述寫入指令所對應的一或多個邏輯頁面尚未被映射至一或多個實體頁面,處理器211會選擇空白的一或多個目標實體面來儲存對應所述寫入指令的寫入資料,所述一或多個目標實體頁面所儲存的寫入資料會成為有效資料,並且經由區塊管理電路單元215(或有效資料計數電路2151)更新/增加所述一或多個目標實體頁面的有效資料計數(基於所述一或多個實體頁面中為有效資料的所有碼字的總數量)。例如,假設一個空白的目標實體頁面最多可儲存4個碼字。反應於被儲存在所述目標實體頁面的對應寫入指令的寫入資料剛好填滿所述目標實體頁面,所述目標實體頁面的有效資料計數會從0成為4。On the other hand, if one or more physical pages (also known as target physical pages) mapped to one or more logical pages corresponding to the write instruction are blank (no data is yet stored), the
在步驟S230中,區塊管理電路單元215(或有效資料計數電路2151)根據所述寫入指令更新所述多個目標實體區段的多個目標區段有效資料計數中的對應所述第一目標實體區段的第一目標區段有效資料計數。In step S230, the block management circuit unit 215 (or the valid data counting circuit 2151) updates the valid data counts of the plurality of target physical segments corresponding to the first one of the valid data counts of the plurality of target physical segments according to the write instruction. The effective data count of the first target section of the target entity section.
接著,在步驟S240中,區塊管理電路單元215(或有效資料計數電路2151)根據已更新的所述第一目標區段有效資料計數來更新所述多個實體區塊的多個區塊有效資料計數中的對應所述目標實體區塊的目標區塊有效資料計數。Then, in step S240, the block management circuit unit 215 (or the effective data counting circuit 2151) updates the effective data of the plurality of physical blocks according to the updated effective data count of the first target section. The valid data count of the target block corresponding to the target physical block in the data count.
接著,在步驟S250中,區塊管理電路單元215(或有效區段管理電路2152)根據所述目標實體區塊的所述多個目標區段有效資料計數來更新所述多個實體區塊的多個有效區段計數中對應所述目標實體區塊的目標有效區段計數,其中所述多個有效區段計數各自用以記錄所對應的實體區塊的一或多個有效實體區段的總數量,其中所述一或多個有效實體區段各自的所述區段有效資料計數大於零。以下利用圖5A至5B來說明步驟S220~S250的細節。Then, in step S250, the block management circuit unit 215 (or the effective section management circuit 2152) updates the counts of the plurality of physical blocks according to the effective data counts of the plurality of target sections of the target physical block. A plurality of effective section counts corresponds to the target effective section count of the target physical block, wherein each of the plurality of effective section counts is used to record the number of one or more effective physical sections of the corresponding physical block The total number, wherein the segment valid data count of each of the one or more valid physical segments is greater than zero. The details of steps S220 to S250 are described below using FIGS. 5A to 5B.
圖5A至5B為根據本發明的一實施例所繪示的根據寫入指令來更新有效資料計數的示意圖。請參照圖5A,假設實體區塊50的多個實體頁面51(1)、51(2)、52(1)、52(2)、53(1)、53(2)、54(1)、54(2)已映射至邏輯頁面L51(1)、L51(2)、L52(1)、L52(2)、L53(1)、L53(2)、L54(1)、L54(2),並且實體頁面51(1)、51(2)中的多個碼字(亦稱,無效碼字)皆儲存無效資料;實體頁面52(1)、52(2)、53(1)、53(2)、54(1)、54(2)中的碼字(亦稱,有效碼字)皆儲存有效資料。此外,在此例子中,每2個實體頁面會被分組為1實體區段,如,實體頁面51(1)、51(2)被分組為實體區段51;實體頁面52(1)、52(2)被分組為實體區段52;實體頁面53(1)、53(2)被分組為實體區段53;實體頁面54(1)、54(2)被分組為實體區段54。5A to 5B are schematic diagrams of updating the valid data count according to a write command according to an embodiment of the present invention. Referring to FIG. 5A, suppose multiple physical pages 51(1), 51(2), 52(1), 52(2), 53(1), 53(2), 54(1), 54(2) has been mapped to logical pages L51(1), L51(2), L52(1), L52(2), L53(1), L53(2), L54(1), L54(2), and Multiple codewords (also known as invalid codewords) in physical pages 51(1) and 51(2) store invalid data; physical pages 52(1), 52(2), 53(1), 53(2) ), 54(1), 54(2) codewords (also known as valid codewords) store valid data. In addition, in this example, every two physical pages will be grouped into 1 physical section, for example, physical pages 51(1), 51(2) are grouped into
基於每個實體頁面所具有的有效碼字的總數量,區塊管理電路單元215可以辨識出,實體頁面51(1)的有效資料計數為“0”;實體頁面51(2)的有效資料計數為“0”;實體頁面52(1)~54(2)的有效資料計數皆為“4”。此外,區塊管理電路單元215可計算出實體區段51中的所有的實體頁面51(1)~51(2)的有效資料計數的總和為“0”(如,0+0=0);實體區段52中的所有的實體頁面52(1)~52(2)的有效資料計數的總和為“8”(如,4+4=8);實體區段53中的所有的實體頁面53(1)~53(2)的有效資料計數的總和為“8”(如,4+4=8);實體區段54中的所有的實體頁面54(1)~54(2)的有效資料計數的總和為“8”(如,4+4=8)。Based on the total number of valid codewords in each physical page, the block management circuit unit 215 can recognize that the valid data count of the physical page 51(1) is "0"; the valid data count of the physical page 51(2) Is "0"; the valid data counts of physical pages 52(1) to 54(2) are all "4". In addition, the block management circuit unit 215 can calculate that the sum of the valid data counts of all the physical pages 51(1) to 51(2) in the
接著,區塊管理電路單元215(或有效區段管理電路2152)更可辨識出對應於為“0”的區段有效資料計數的實體區段51為無效實體區段以及對應於為非“0”的區段有效資料計數的實體區段52~54為有效實體區段,並且區塊管理電路單元215會計算實體區塊50所具有的有效實體區段的總數量為有效區塊計數(如,對應於3個有效實體區段52~54的有效區塊計數為“3”)。此外,區塊管理電路單元215更可計算實體區塊50的所有實體區段51~54的所有區段有效資料計數的總和,以作為實體區塊50的區塊有效資料計數(如,0+8+8+8=24)。Then, the block management circuit unit 215 (or the effective section management circuit 2152) can further recognize that the
在此例子中,處理器211執行寫入指令WC,並且如箭頭A51所示,所述對應於寫入指令WC的4個碼字(寫入資料)被寫入至邏輯頁面L52(1)。區塊管理電路單元215(或處理器211)可辨識映射至邏輯頁面L52(1)的實體頁面52(1)為目標實體頁面。In this example, the
請參照圖5B,如箭頭A52所示,反應於邏輯頁面L52(1)已經儲存了對應寫入指令WC的4個碼字,區塊管理電路單元215(或處理器211)會辨識原本儲存在所述目標實體頁面52(1)中的4個碼字的資料成為無效資料,將目標實體頁面52(1)的有效資料計數減去4(目標實體頁面52(1)的有效資料計數會減為 “0”(即,4-4=0)),並且將實體區段52的區段有效資料計數從“8”更新為“4”(0+4=4)。此時,區塊管理電路單元215 (或有效區段管理電路2152)會基於所辨識的最新的實體區段51~54各自的區段有效資料計數來辨識出實體區塊50所具有的有效實體區段的總數量仍然為3個(具有大於“0”的區段有效資料計數的有效實體區段的總數量為“3“),即,有效區段計數為“3”。Please refer to FIG. 5B, as indicated by arrow A52, reflecting that the logical page L52(1) has stored 4 codewords corresponding to the write command WC, the block management circuit unit 215 (or the processor 211) will recognize that the original The data of the 4 code words in the target physical page 52(1) becomes invalid data, the valid data count of the target physical page 52(1) is subtracted by 4 (the valid data count of the target physical page 52(1) will be reduced Is “0” (ie, 4-4=0)), and the section effective data count of the
在一實施例中,區塊管理電路單元215(或處理器211)可記錄對應所述多個實體區塊各自的多個區段有效資料計數與所述有效區段計數。例如,區塊管理電路單元215(或處理器211)將對應所述多個實體區塊各自的多個區段有效資料計數與所述有效區段計數記錄至一有效資料計數表中。In an embodiment, the block management circuit unit 215 (or the processor 211) can record the valid data counts and the valid sector counts of the respective multiple sections corresponding to the multiple physical blocks. For example, the block management circuit unit 215 (or the processor 211) records the effective data counts of the plurality of sections corresponding to the respective physical blocks and the effective section counts in a valid data count table.
圖6A為根據本發明的一實施例所繪示的記錄區段有效資料計數及有效區段計數的示意圖。請參照圖6A,如表T60所示,為了方便說明,假設可複寫式非揮發性記憶體模組220具有4個實體區塊50、60、70、80,每個實體區塊具有4個實體區段,每個實體區段具有2個實體頁面,並且每個實體頁面可儲存4個碼字(每個實體頁面的最大的有效資料計數為“4”,每個實體區段的最大的區段有效資料計數為“8”),並且表T60的每個條目對應至一個實體區段。FIG. 6A is a schematic diagram illustrating the effective data count and the effective section count of the recording section according to an embodiment of the present invention. Please refer to Figure 6A, as shown in Table T60, for the convenience of description, suppose that the rewritable
區塊管理電路單元215(或處理器211)可將所辨識/更新的實體區段51~84各自的區段有效資料計數記錄在表T60(亦稱,有效資料計數表)的一個欄位(亦稱,第一欄位),如表T60所記錄的對應實體區段51、52~83、84的區段有效資料計數“0”、“4”~“2”、“8”。此外,區塊管理電路單元215(或處理器211)更可將所辨識/更新的實體區塊50~80各自的有效區段計數記錄在表T60的另一個欄位(亦稱,第二欄位),如表T60所記錄的對應實體區塊50、60、70、80的有效區段計數“3”、“3”、“1”、“3”。The block management circuit unit 215 (or the processor 211) can record the effective data count of each of the identified/updated
此外,在一實施例中,所述區塊管理電路單元215(或處理器211)也可基於所記錄的區段有效資料計數,來即時地計算實體區塊50~80各自的區塊有效資料計數。在另一實施例中,,所述區塊管理電路單元215(或處理器211)也可將所計算的實體區塊50~80各自的區塊有效資料計數記錄至另一欄位(亦稱,第三欄位)中。In addition, in one embodiment, the block management circuit unit 215 (or the processor 211) can also calculate the effective data of the respective
在本實施例中,經由圖2所提供的記憶體管理方法,可經由區塊管理電路單元215即時地獲得/更新每個實體區段的區段有效資料計數以及每個實體區塊的區塊有效資料計數與有效區段計數。處理器211更可用以根據所述多個區塊有效資料計數與所述多個有效區段計數來執行垃圾回收操作。也就是說,本發明的實施利索提供的垃圾回收操作,可藉由所述多個區塊有效資料計數與所述多個有效區段計數增進執行的效率(有效率地辨識回收實體區塊中的有效資料)。In this embodiment, through the memory management method provided in FIG. 2, the block management circuit unit 215 can instantly obtain/update the section effective data count of each physical block and the block of each physical block. Valid data count and valid section count. The
圖3是根據本發明的一實施例所繪示的垃圾回收操作的流程圖。請參照圖3,在步驟S310中,區塊管理電路單元215(或處理器211)可根據回收區塊有效資料計數門檻值與所述多個區塊有效資料計數來選擇所述多個實體區塊中的多個回收實體區塊。所述多個區塊有效資料計數各自用以記錄所屬的實體區塊的所有的有效實體區段各自的所述區段有效資料計數的總和,並且所述區段有效資料計數用以記錄儲存在所屬的實體區段的所有的實體頁面中的所有的有效碼字的總數量。其中,所述多個回收實體區塊各自的所述區塊有效資料計數皆小於所述回收區塊有效資料計數門檻值。Fig. 3 is a flowchart of a garbage collection operation according to an embodiment of the present invention. 3, in step S310, the block management circuit unit 215 (or the processor 211) may select the multiple physical areas according to the reclaimed block effective data count threshold and the multiple block effective data counts Multiple recycled physical blocks in the block. Each of the plurality of block effective data counts is used to record the sum of the respective section effective data counts of all the effective physical sections of the physical block to which they belong, and the section effective data count is used to record and store in The total number of all valid codewords in all the physical pages of the physical section to which it belongs. Wherein, the effective data count of each of the plurality of recycled physical blocks is less than the effective data count threshold value of the recycled block.
接著,在步驟S320中,區塊管理電路單元215(或處理器211)可根據所述多個回收實體區塊各自的所述有效區段計數,由小至大,來排序所述多個回收實體區塊。Then, in step S320, the block management circuit unit 215 (or the processor 211) may sort the multiple reclaimed blocks according to the effective section count of each of the multiple reclaimed physical blocks, from small to large. Physical block.
接著,在步驟S330中,處理器211可根據已排序的所述多個回收實體區塊執行所述垃圾回收操作,其中在已排序的所述多個回收實體區塊中的被排序在最前方的第一回收實體區塊會最先被所述處理器211執行所述垃圾回收操作。Then, in step S330, the
具體來說,所述處理器211僅檢查在所述第一回收實體區塊的一或多個第一有效實體區段中是否儲存有效資料,並且辨識所述有效資料的實體位址,以搬移所述有效資料。在一實施例中,所述處理器211不檢查在所述第一回收實體區塊中非所述一或多個第一有效實體區段的一或多個第二有效實體區段中是否儲存所述有效資料。如此一來,因為僅經由邏輯轉實體位址映射表與實體轉邏輯位址映射表來檢查一或多個第一有效實體區段的實體頁面與邏輯頁面的映射關係以確認一或多個第一有效實體區段中的有效資料的實體位址,可大量地節省所耗費的時間(因為不需要檢查第一回收實體區塊中的無效實體區段,而避免耗費檢查第一回收實體區塊中的全部的實體區段的大量時間)。Specifically, the
以下利用圖6B來說明步驟S310~S330的細節。The details of steps S310 to S330 are described below using FIG. 6B.
圖6B為根據本發明的一實施例所繪示的根據區塊有效資料計數與有效區段計數來選擇且排序多個回收實體區塊的示意圖。請參照圖6B,假設回收區塊有效資料計數門檻值為“14”。延續圖6A的例子,如箭頭A61所示,區塊管理電路單元215(或處理器211)可根據回收區塊有效資料計數門檻值“14”與對應實體區塊50、60、70、80的多個區塊有效資料計數“21”、“7”、“7”、“13”來選擇小於回收區塊有效資料計數門檻值“14”的區塊有效資料計數“7”、“7”、“13”所對應的實體區塊60、70、80作為多個回收實體區塊(步驟S310)。接著,如箭頭A62所示,區塊管理電路單元215(或處理器211)可根據對應實體區塊60、70、80的多個有效區塊計數“3”、“1”、“3”來由小至大排序回收實體區塊60、70、80(步驟S320)為已排序的多個回收實體區塊70、60、80。已排序的多個回收實體區塊70、60、80可被識別/加入為垃圾回收佇列,依據回收順序/排列順序,垃圾回收佇列中的回收實體區塊為實體區塊70、實體區塊60、實體區塊80。FIG. 6B is a schematic diagram of selecting and sorting a plurality of reclaimed physical blocks according to the effective data count of the block and the effective section count according to an embodiment of the present invention. Please refer to Figure 6B, assuming that the valid data count threshold of the recovered block is "14". Continuing the example of FIG. 6A, as shown by arrow A61, the block management circuit unit 215 (or the processor 211) can count the threshold value "14" according to the effective data of the recovered block and the corresponding
處理器211可根據已排序的多個回收實體區塊70、60、80,依序執行垃圾回收操作(步驟S330)。例如,如箭頭A63所示,在已排序的多個回收實體區塊70、60、80中,回收實體區塊70會先被執行垃圾回收操作。此外,參見表T60,處理器211可經由識別回收實體區塊70中的有效實體區段與無效實體區段,僅檢查回收實體區塊70中的實體區段74(有效實體區段)是否儲存有效資料(不檢查無效實體區段71~73)。The
值得一提的是,在本實施例中,每個實體區塊的有效區段計數也可以用來表示所對應的實體區塊所具有的有效資料的集中度。簡單來說,具有越小的有效區段計數的實體區塊所具有的有效資料的集中度越高;具有越大的有效區段計數的實體區塊所具有的有效資料的集中度越低。利用此概念,本實施例所提供的記憶體管理方法可根據有效區段計數來對所有的回收實體區塊進行排序,以有效地依據所有的回收實體區塊的集中度來決定對所有的回收實體區塊所執行的垃圾回收操作的順序。如此一來,即使兩個回收實體區塊(如,回收實體區塊60、70)的區塊有效資料計數相等,處理器211也可依據兩個回收實體區塊的有效資料的集中度(有效區段計數)來先選擇集中度較高(有效區段計數較小)的回收實體區塊(如,回收實體區塊70)以執行垃圾回收操作,進而可因僅檢查較少的有效實體區段,而較快地辨識於其內的有效資料的實體位址,達到快速地回收此回收實體區塊的功效。It is worth mentioning that in this embodiment, the effective section count of each physical block can also be used to indicate the concentration of the effective data of the corresponding physical block. To put it simply, a physical block with a smaller effective section count has a higher concentration of effective data; a physical block with a larger effective section count has a lower concentration of effective data. Using this concept, the memory management method provided by this embodiment can sort all reclaimed physical blocks according to the effective sector count, so as to effectively determine the recovery of all reclaimed physical blocks based on the concentration of all reclaimed physical blocks. The sequence of garbage collection operations performed by the physical block. In this way, even if the effective data counts of the two reclaimed physical blocks (for example, reclaimed
綜上所述,本發明的實施例所提供的儲存控制器、記憶體管理方法以及儲存裝置,可將可複寫式非揮發性記憶體模組的多個實體區塊中的每一個實體區塊的所述多個實體頁面分組至多個實體區段,根據所述寫入指令更新對應的區段有效資料計數、對應的有效資料計數以及對應的有效區段計數,以利用所述區塊有效資料計數與所述有效區段計數來選擇且排序多個回收實體區塊,以依據有效資料的集中度來依序對所述多個垃圾實體區塊執行垃圾回收操作,進而有效率地釋放出可複寫式非揮發性記憶體模組的空間而增進了儲存裝置的整體存取效能。In summary, the storage controller, memory management method, and storage device provided by the embodiments of the present invention can store each of the multiple physical blocks of the rewritable non-volatile memory module The multiple physical pages are grouped into multiple physical sections, and the corresponding section valid data count, the corresponding valid data count, and the corresponding valid section count are updated according to the write command, so as to utilize the block valid data Count and the effective section count to select and sort a plurality of reclaimed physical blocks, so as to sequentially perform garbage collection operations on the plurality of garbage physical blocks according to the concentration of valid data, and then release the recyclable blocks efficiently. The space of the copy-type non-volatile memory module improves the overall access performance of the storage device.
10:主機系統
20:儲存裝置
110、211:處理器
120:主機記憶體
130:資料傳輸介面電路
210:儲存控制器
212:資料管理電路
213:記憶體介面控制電路
214:錯誤檢查與校正電路
215:區塊管理電路單元
2151:有效資料計數電路
2152:有效區段管理電路
216:緩衝記憶體
217:電源管理電路
220:可複寫式非揮發性記憶體模組
230:連接介面電路
S210、S220、S230、S240、S250:記憶體管理方法的流程步驟
S310、S320、S330:垃圾回收操作的流程步驟
CW(1)~CW(M):碼字
WC:寫入指令
P(1)~P(NP)、51(1)~54(2):實體頁面
B(1)~B(Q)、50、60、70、80:實體區塊
S(1)、S(2)~S(N)、51、52、53、54:實體區段
L51(1)~L54(2):邏輯頁面
A51、A52、A61、A62、A63:箭頭
T60:表10: Host system
20:
圖1是根據本發明的一實施例所繪示的主機系統及儲存裝置的方塊示意圖。 圖2是根據本發明的一實施例所繪示的記憶體管理方法的流程圖。 圖3是根據本發明的一實施例所繪示的垃圾回收操作的流程圖。 圖4A是根據本發明的一實施例所繪示的碼字、實體頁面、實體區塊與可複寫式非揮發性記憶體模組的示意圖。 圖4B是根據本發明的一實施例所繪示的分組實體區塊的多個實體頁面為多個實體區段的示意圖。 圖5A至5B為根據本發明的一實施例所繪示的根據寫入指令來更新有效資料計數的示意圖。 圖6A為根據本發明的一實施例所繪示的記錄區段有效資料計數及有效區段計數的示意圖。 圖6B為根據本發明的一實施例所繪示的根據區塊有效資料計數與有效區段計數來選擇且排序多個回收實體區塊的示意圖。FIG. 1 is a block diagram of a host system and a storage device according to an embodiment of the invention. FIG. 2 is a flowchart of a memory management method according to an embodiment of the invention. Fig. 3 is a flowchart of a garbage collection operation according to an embodiment of the present invention. 4A is a schematic diagram of a codeword, a physical page, a physical block, and a rewritable non-volatile memory module according to an embodiment of the present invention. FIG. 4B is a schematic diagram illustrating that multiple physical pages of a grouped physical block are multiple physical sections according to an embodiment of the present invention. 5A to 5B are schematic diagrams of updating the valid data count according to a write command according to an embodiment of the present invention. FIG. 6A is a schematic diagram illustrating the effective data count and the effective section count of the recording section according to an embodiment of the present invention. FIG. 6B is a schematic diagram of selecting and sorting a plurality of reclaimed physical blocks according to the effective data count of the block and the effective section count according to an embodiment of the present invention.
S210、S220、S230、S240、S250:記憶體管理方法的流程步驟S210, S220, S230, S240, S250: Process steps of the memory management method
Claims (15)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW108145546A TWI762843B (en) | 2019-12-12 | 2019-12-12 | Storage controller, memory management method, and storage device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW108145546A TWI762843B (en) | 2019-12-12 | 2019-12-12 | Storage controller, memory management method, and storage device |
Publications (2)
Publication Number | Publication Date |
---|---|
TW202123016A true TW202123016A (en) | 2021-06-16 |
TWI762843B TWI762843B (en) | 2022-05-01 |
Family
ID=77516844
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW108145546A TWI762843B (en) | 2019-12-12 | 2019-12-12 | Storage controller, memory management method, and storage device |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI762843B (en) |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI642059B (en) * | 2017-06-02 | 2018-11-21 | 群聯電子股份有限公司 | Memory management method, memory control circuit unit and memory storage apparatus |
-
2019
- 2019-12-12 TW TW108145546A patent/TWI762843B/en active
Also Published As
Publication number | Publication date |
---|---|
TWI762843B (en) | 2022-05-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10713178B2 (en) | Mapping table updating method, memory controlling circuit unit and memory storage device | |
US9940189B2 (en) | Method and system for data rebuilding and memory control circuit unit thereof | |
US10303367B2 (en) | Mapping table updating method without updating the first mapping information, memory control circuit unit and memory storage device | |
US10642731B2 (en) | Memory management method and storage controller | |
CN109491588B (en) | Memory management method, memory control circuit unit and memory storage device | |
CN107590080B (en) | Mapping table updating method, memory control circuit unit and memory storage device | |
TW202040370A (en) | Data writing method, memory controlling circuit unit and memory storage device | |
US8966344B2 (en) | Data protecting method, memory controller and memory storage device | |
US9983805B1 (en) | Memory management method, memory control circuit unit and memory storage apparatus | |
US9778862B2 (en) | Data storing method for preventing data losing during flush operation, memory control circuit unit and memory storage apparatus | |
TWI548991B (en) | Memory management method, memory control circuit unit and memory storage apparatus | |
CN112860193B (en) | Sorting instruction processing method, memory control circuit unit and memory device | |
CN112051971B (en) | Data merging method, memory storage device and memory control circuit unit | |
CN109273033B (en) | Memory management method, memory control circuit unit and memory storage device | |
CN111737165B (en) | Memory control method, memory storage device and memory control circuit unit | |
CN107204205B (en) | Memory management method, memory control circuit unit and memory storage device | |
TWI571881B (en) | Valid data merging method, memory controller and memory storage apparatus | |
US10635583B2 (en) | Memory management method and storage controller | |
CN110825653B (en) | Memory management method and memory controller | |
CN109032957B (en) | Memory management method, memory control circuit unit and memory storage device | |
CN110825310A (en) | Memory management method and memory controller | |
US9665480B2 (en) | Memory management method, memory storage device and memory control circuit unit | |
TWI688958B (en) | Cold area determining method, memory controlling circuit unit and memory storage device | |
TWI762843B (en) | Storage controller, memory management method, and storage device | |
CN106991055B (en) | Data search method, memory storage device and memory control circuit unit |