TWI557559B - Method for writing into and reading from bad pages of a flash memory - Google Patents

Method for writing into and reading from bad pages of a flash memory Download PDF

Info

Publication number
TWI557559B
TWI557559B TW104100264A TW104100264A TWI557559B TW I557559 B TWI557559 B TW I557559B TW 104100264 A TW104100264 A TW 104100264A TW 104100264 A TW104100264 A TW 104100264A TW I557559 B TWI557559 B TW I557559B
Authority
TW
Taiwan
Prior art keywords
data
sub
segment
bad page
flash memory
Prior art date
Application number
TW104100264A
Other languages
Chinese (zh)
Other versions
TW201626230A (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 TW104100264A priority Critical patent/TWI557559B/en
Publication of TW201626230A publication Critical patent/TW201626230A/en
Application granted granted Critical
Publication of TWI557559B publication Critical patent/TWI557559B/en

Links

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Description

利用快閃記憶體的壞頁來存取資料的方法Method of accessing data by using bad pages of flash memory

本發明與一種快閃記憶體的資料存取方法有關,特別是與一種利用快閃記憶體的壞頁來存取資料的方法有關。The present invention relates to a data access method for flash memory, and more particularly to a method for accessing data using a bad page of a flash memory.

隨著雲端技術以及大數據資料的應用,對於儲存系統的效能需求越來越大。使用NAND快閃記憶體(NAND flash memory)為儲存媒介,再配合適當的控制晶片(controller)進行各種運算處理,所製成的固態硬碟(Solid State Disk,簡稱SSD)已漸漸取代傳統硬碟。顯而易見地,在固態硬碟的基本設計架構中,控制晶片及NAND快閃記憶體是影響固態硬碟的效能及穩定度的重要關鍵。With the application of cloud technology and big data materials, the performance requirements for storage systems are increasing. Using NAND flash memory as the storage medium and various controllers for various operations, the solid state disk (SSD) has gradually replaced the traditional hard disk. . Obviously, in the basic design architecture of solid state drives, control chips and NAND flash memory are important factors affecting the performance and stability of solid state drives.

習知的控制晶片,其功能包括:輸入/輸出的指令(I/O Command)、資料管理(Data Shaping)、磨損均衡技術(Wear Leveling)、空間回收(Garbage Collection)的處理能力,以及電源、快取記憶體(Cache)和損壞區塊(Bad Block)的管理能力等。特別重要的是對TRIM指令的支援方式、以及隨著NAND快閃記憶體的尺寸愈小而愈重要的錯誤檢查及修正機制(Error Checking and Correcting,簡稱ECC)等。以上種種無一不需仰賴控制晶片進行運作,來優化固態硬碟的效能及穩定度。The conventional control chip, its functions include: input/output command (I/O Command), data management (Data Shaping), wear leveling technology (Wear Leveling), space recovery (Garbage Collection) processing power, and power supply, The management capabilities of the cache (Cache) and Bad Block. Of particular importance are the support methods for TRIM commands and the Error Checking and Correcting (ECC), which is more important as the size of NAND flash memory is smaller. All of the above must rely on the control chip to operate to optimize the performance and stability of the solid state hard disk.

在NAND快閃記憶體中,儲存資料的最小單元稱為一個記憶胞(cell)。記憶胞是由電晶體所組成,電晶體是由晶圓(Die)所製成。晶圓內部的電晶體組織規劃,基本為頁(Page)、區塊(Block)及資料紀錄矩陣(Plane)。藉由行與列的排序,將每數個「頁」集合成一個「區塊」,每數個「區塊」構成一個「資料紀錄矩陣」。然而,固態硬碟在讀寫資料上有特別的單位限制,最小能被讀寫的單位是「頁」。當一「頁」內已經存有資料時,新資料不能直接被寫入,必須先清除資料再做寫入。清除資料的動作被稱為空間回收 (garbage collection),而固態硬碟是以「區塊(block)」作為清除資料的最小單位。因此,固態硬碟的讀寫與清除資料的最小單位是不對等的。In NAND flash memory, the smallest unit that stores data is called a memory cell. The memory cell is composed of a transistor, which is made of a wafer. The organization of the transistor inside the wafer is basically a page, a block, and a data recording matrix (Plane). Each row of "pages" is grouped into a "block" by sorting rows and columns, and each of the "blocks" constitutes a "data record matrix". However, SSDs have a special unit limit on reading and writing data. The smallest unit that can be read or written is the "page". When there is already data in a "page", the new data cannot be directly written. The data must be cleared before writing. The action of clearing data is called garbage collection, and the solid state hard disk is a "block" as the smallest unit for clearing data. Therefore, the minimum unit for reading and writing and erasing data on a solid state drive is not equal.

隨著NAND快閃記憶體的尺寸越來越小,其耐抺寫次數(Programming/Erase Cycle,簡稱P/E Cycle)也越來越少,使得NAND快閃記憶體的使用壽命越來越短,所以NAND快閃記憶體的壽命議題將會越來越重要。一般來說,控制晶片必須用更多先進技術和運算方式來延長NAND快閃記憶體的壽命。As the size of NAND flash memory is getting smaller and smaller, the programming/Erase Cycle (P/E Cycle) is becoming less and less, making the service life of NAND flash memory shorter and shorter. Therefore, the life of NAND flash memory will become more and more important. In general, control chips must use more advanced techniques and algorithms to extend the life of NAND flash memory.

目前改善NAND快閃記憶體的壽命問題最主要使用的方法有:At present, the most important methods for improving the lifetime of NAND flash memory are:

一、以磨損均衡技術(Wear Leveling)平均地使用快閃記憶體中的每個儲存區塊(Block),以避免某些「特定」儲存區塊因過度使用而形成壞區塊(bad block)。First, use Wear Leveling to average use each block in the flash memory to avoid some "specific" storage blocks from forming bad blocks due to overuse. .

二、以重複資料刪除技術(Data Deduplication)或是資料壓縮技術(Data Compression)來減少資料的寫入量。Second, use Data Deduplication or Data Compression to reduce the amount of data written.

三、次級化快閃記憶體(Downgraded Flash Memory): NAND快閃記憶體中,為了標示不同的資料狀態,在一個記憶胞(Cell)可利用多個位元(Bit)來標示多種狀態。舉一多級儲存單元(Multi-level cell, MLC)為例,MLC在一個記憶胞當中存入2個位元來表示4種狀態,但隨著MLC的磨損,最後會無法正確的區分出4種狀態。但若仍可區分出2種狀態,則可將MLC當成一單級儲存單元(Single Level Cell, SLC)來使用。另一種次級化快閃記憶體的做法是將NAND快閃記憶體中已損壞的儲存區塊(Block)作管理,並且重映射(Remap)到正常的儲存區塊(Block),使得一具有損壞區塊(Block)的NAND快閃記憶體晶片(chip)仍可以正常使用。Third, Downgraded Flash Memory: In NAND flash memory, in order to indicate different data states, a single cell can use multiple bits to indicate multiple states. Taking a multi-level cell (MLC) as an example, MLC stores two bits in one memory cell to represent four states, but with the wear and tear of MLC, it will not be able to distinguish correctly. State. However, if the two states can still be distinguished, the MLC can be used as a single level cell (SLC). Another method of secondary flash memory is to manage the corrupted memory blocks in the NAND flash memory and remap them to the normal memory blocks (Block) so that one has The NAND flash memory chip of the damaged block can still be used normally.

綜合以上所述,以往的技術大多著眼於將磨損平均分散、減少資料的寫入量,或是將損壞區塊做管理,但並未考慮如何對已經損壞的區塊重新作利用。In summary, the prior art mostly focuses on dispersing wear evenly, reducing the amount of data written, or managing damaged blocks, but does not consider how to reuse the damaged blocks.

本發明之一目的在於提出一種利用快閃記憶體的壞頁來存取資料的方法,用以延長快閃記憶體的壽命。It is an object of the present invention to provide a method for accessing data using a bad page of a flash memory to extend the life of the flash memory.

為了達到上述目的,本發明提供一種利用快閃記憶體的壞頁來存取資料的方法,此方法包括一寫入程序及一讀取程序,用以將一頁(page)容量大小的一原始資料寫入一具有兩壞頁的快閃記憶體中,並可進行讀取,在以下敘述中,該兩壞頁分別稱為一第一壞頁及一第二壞頁,兩者皆具有複數錯誤位元。In order to achieve the above object, the present invention provides a method for accessing data by using a bad page of a flash memory, the method comprising a writing program and a reading program for initializing a page size The data is written into a flash memory having two bad pages and can be read. In the following description, the two bad pages are respectively referred to as a first bad page and a second bad page, both of which have plural numbers. Error bit.

寫入程序包括以下基本步驟:利用一資料分離器(data separator)將原始資料平均拆分成一第一子資料及一第二子資料,並且將第一子資料及第二子資料各別複製一份,形成兩份第一子資料及兩份第二子資料;利用一資料遮蔽器(data masker)將兩份第一子資料其中之一及兩份第二子資料其中之一各別轉換成兩份虛擬資料(dummy data),並且形成一第一資料組及一第二資料組,其中第一資料組包括兩份第一子資料其中的另一加上兩份虛擬資料其中之一,第二資料組包括兩份第二子資料其中的另一加上兩份虛擬資料其中的另一;利用一編碼器根據第一資料組產生一第一同位校正碼,並且根據第二資料組產生一第二同位校正碼;以及將兩份第一子資料及第一同位校正碼合併寫入第一壞頁,並且將兩份第二子資料及第二同位校正碼合併寫入第二壞頁。The writing process includes the following basic steps: using a data separator to split the original data into a first sub-data and a second sub-data, and copying the first sub-data and the second sub-data separately. Forming two first sub-data and two second sub-data; using a data masker to convert one of the two first sub-data and one of the two second sub-data into one Two dummy data, and forming a first data group and a second data group, wherein the first data group includes two of the first sub-data and the other one of the two virtual materials, the first The second data set includes two of the second sub-data and the other of the two virtual data; generating, by the encoder, a first parity correction code according to the first data set, and generating according to the second data set a second parity correction code; and combining the two first sub-data and the first parity correction code into the first bad page, and combining the two second sub-data and the second parity correction code into the second bad page.

讀取程序,包括以下基本步驟:將第一壞頁上的實體儲存空間平均劃分為一第一段及一第二段;資料遮蔽器將儲存於第一段的資料內容轉換成虛擬資料;利用一解碼器根據第一同位校正碼對儲存於第二段的資料內容進行校正,而將儲存於第二段的資料內容還原為第一子資料;將第二壞頁上的實體儲存空間平均劃分為一第三段及一第四段;資料遮蔽器將儲存於第三段的資料內容轉換成虛擬資料;利用解碼器根據第二同位校正碼對儲存於第四段的資料內容進行校正,而將儲存於第四段的資料內容還原為第二子資料;以及利用一資料組合器(data assembler),將還原得到的第一子資料及第二子資料組合成原始資料。The reading program comprises the following basic steps: dividing the physical storage space on the first bad page into a first segment and a second segment; the data masker converts the data content stored in the first segment into virtual data; a decoder corrects the data content stored in the second segment according to the first parity correction code, and restores the data content stored in the second segment to the first sub-data; averages the physical storage space on the second bad page Divided into a third segment and a fourth segment; the data masker converts the data content stored in the third segment into virtual data; and uses the decoder to correct the data content stored in the fourth segment according to the second parity correction code, The data content stored in the fourth segment is restored to the second sub-data; and the first sub-data and the second sub-data obtained by the reduction are combined into the original data by using a data assembler.

在一實施例中,若解碼器根據第一同位校正碼,無法將儲存於第二段的資料還原為第一子資料,則上述的讀取程序更包括以下步驟:資料遮蔽器判斷該第二段中的該等錯誤位元數量多於該第一段中的該等錯誤位元數量,進而重新選擇將儲存於第二段的資料轉換成虛擬資料,而保留儲存於第一段的資料內容;以及解碼器根據第一同位校正碼(parity)對儲存於第一段的資料內容進行校正,而將儲存於第一段的資料內容還原為第一子資料。In an embodiment, if the decoder cannot restore the data stored in the second segment to the first sub-data according to the first parity correction code, the reading process further includes the following steps: the data masker determines the first The number of such error bits in the second segment is greater than the number of the wrong bits in the first segment, and the data selected in the second segment is reselected to be converted into virtual data, and the data stored in the first segment is retained. And the decoder corrects the data content stored in the first segment according to the first parity correction code, and restores the data content stored in the first segment to the first sub-data.

在一實施例中,若解碼器根據第二同位校正碼,無法將儲存於第四段的資料還原為第二子資料,則上述的讀取程序更包括以下步驟:資料遮蔽器判斷該第四段中的該等錯誤位元數量多於該第三段中的該等錯誤位元數量,進而重新選擇將儲存於第四段的資料轉換成虛擬資料,而保留儲存於第三段的資料內容;以及解碼器根據第二同位校正碼對儲存於第三段的資料內容進行校正,而將儲存於第三段的資料內容還原為第二子資料。In an embodiment, if the decoder cannot restore the data stored in the fourth segment to the second sub-data according to the second parity correction code, the reading process further includes the following steps: the data masker determines the fourth The number of such error bits in the segment is greater than the number of the wrong bits in the third segment, and then re-selecting the data stored in the fourth segment into virtual data, while retaining the data content stored in the third segment And the decoder corrects the data content stored in the third segment according to the second parity correction code, and restores the data content stored in the third segment to the second sub-data.

在一實施例中,上述之利用快閃記憶體的壞頁來存取資料的方法是應用於一快閃記憶體控制器中。此快閃記憶體控制器電性連接於快閃記憶體,並且具有一快閃記憶體轉換層(Flash Translation Layer, FTL),其中若需要將原始資料拆分並儲存於兩壞頁時,原始資料將會通過快閃記憶體轉換層而傳送至資料分離器。此快閃記憶體控制器是包含於一資料處理系統中,此資料處理系統包括一檔案系統、快閃記憶體控制器、一記憶體技術裝置(Memory Technology Device, MTD)以及快閃記憶體,其中主機產生原始資料,並將原始資料傳送至快閃記憶體轉換層,快閃記憶體轉換層將原始資料輸入資料分離器,資料分離器所輸出的"兩份第一子資料"的資料組及"兩份第二子資料"的資料組,最後被傳送到該記憶體技術裝置,進而寫入該快閃記憶體中。In one embodiment, the above method of accessing data using a bad page of a flash memory is applied to a flash memory controller. The flash memory controller is electrically connected to the flash memory and has a flash translation layer (FTL), wherein if the original data needs to be split and stored in two bad pages, the original The data will be transferred to the data splitter via the flash memory conversion layer. The flash memory controller is included in a data processing system including a file system, a flash memory controller, a memory technology device (MTD), and a flash memory. The host generates the original data, and transmits the original data to the flash memory conversion layer, and the flash memory conversion layer inputs the original data into the data separator, and the data set of the "two first sub-data" output by the data separator And the data set of "two second sub-data" is finally transmitted to the memory technology device, and then written into the flash memory.

在一實施例中,第一壞頁及第二壞頁位於快閃記憶體中的同一個晶圓(die)的相鄰兩儲存矩陣(plane)中,並且第一壞頁及第二壞頁在各別的儲存矩陣上具有相同的位移(Offset)。如此,可提供一平行指令給前述的記憶體技術裝置,在將兩份第一子資料及第一同位校正碼合併寫入第一壞頁的同時,也將兩份第二子資料及第二同位校正碼合併寫入第二壞頁。In one embodiment, the first bad page and the second bad page are located in adjacent storage mats of the same die in the flash memory, and the first bad page and the second bad page Have the same offset (Offset) on each of the storage matrices. In this way, a parallel command can be provided to the foregoing memory technology device, and two copies of the first sub-data and the first parity correction code are combined into the first bad page, and the second sub-data and the second The two parity correction codes are combined and written into the second bad page.

在一實施例中,所述之利用快閃記憶體的壞頁來存取資料的方法更包括:提供一壞頁記錄器,以記錄第一壞頁與第二壞頁的實體位址。In an embodiment, the method for accessing data by using a bad page of the flash memory further includes: providing a bad page recorder to record physical addresses of the first bad page and the second bad page.

在一實施例中,第一壞頁具有一第一備用區(spare area),並且第二壞頁具有一第二備用區。在上述寫入程序中,第一同位校正碼被寫入第一備用區,並且第二同位校正碼被寫入第二備用區。In an embodiment, the first bad page has a first spare area and the second bad page has a second spare area. In the above writing process, the first parity correction code is written to the first spare area, and the second parity correction code is written to the second spare area.

本發明之方法和以往的技術最大的不同在於,本發明之方法可以將NAND快閃記憶體晶片當中已經損壞的「頁」空間回收管理並且再利用,透過本發明之管理層,可以將資料儲存在這些原本已經損壞的頁空間中,並且稍後可以正確的讀出並還原回原始資料,透過壞頁再利用的方式來延長NAND快閃記憶體晶片的壽命。The biggest difference between the method of the present invention and the prior art is that the method of the present invention can recover and reuse the damaged "page" space in the NAND flash memory chip, and the data can be stored through the management layer of the present invention. In these originally damaged page spaces, and later, the original data can be correctly read and restored, and the life of the NAND flash memory chip is extended by the bad page reuse.

有關本發明之前述及其他技術內容、特點與功效,在以下配合參考圖式之一較佳實施例的詳細說明中,將可清楚的呈現。以下實施例中所提到的方向用語,例如:上、下、左、右、前或後等,僅是用於參照隨附圖式的方向。因此,該等方向用語僅是用於說明並非是用於限制本發明。The above and other technical contents, features and advantages of the present invention will be apparent from the following detailed description of the preferred embodiments. The directional terms mentioned in the following embodiments, such as upper, lower, left, right, front or rear, etc., are only used to refer to the directions of the accompanying drawings. Therefore, the directional terms are used for illustration only and are not intended to limit the invention.

本發明所揭露的利用快閃記憶體的壞頁來存取資料的方法可應用於一資料處理系統的一快閃記憶體控制器中。圖1為一實施例的資料處理系統100的整體架構示意圖。資料處理系統100包括一主機110、一快閃記憶體控制器120、一記憶體技術裝置(Memory Technology Device, MTD)130以及一快閃記憶體140。主機110電性連接於快閃記憶體控制器120;並且記憶體技術裝置130電性連接於快閃記憶體控制器120與快閃記憶體140之間。主機110具有一作業系統111及一檔案系統112。複數應用程式200a, 200b…200n通過作業系統111及檔案系統112的運作,而產生一原始資料。原始資料通過一介面150而從主機110傳送至快閃記憶體控制器120,接著通過記憶體技術裝置130而寫入快閃記憶體140中。本實施例的快閃記憶體140為一NAND快閃記憶體晶片(Chip),其儲存資料的最小硬體單元為一個記憶胞(Cell),記憶胞是由電晶體(Transistor)所組成,電晶體是由晶圓(Die)所製成。晶圓內部的電晶體組織規劃,分為頁(Page)、區塊(Block)及資料紀錄矩陣(Plane)。每數個「頁」集合成一個「區塊」,每數個「區塊」構成一個「資料紀錄矩陣」。The method for accessing data by using a bad page of a flash memory disclosed in the present invention can be applied to a flash memory controller of a data processing system. FIG. 1 is a schematic diagram of an overall architecture of a data processing system 100 according to an embodiment. The data processing system 100 includes a host 110, a flash memory controller 120, a memory technology device (MTD) 130, and a flash memory 140. The host device 110 is electrically connected to the flash memory controller 120; and the memory technology device 130 is electrically connected between the flash memory controller 120 and the flash memory 140. The host 110 has an operating system 111 and a file system 112. The plurality of applications 200a, 200b...200n generate an original material through the operation of the operating system 111 and the file system 112. The original data is transferred from the host 110 to the flash memory controller 120 via an interface 150, and then written into the flash memory 140 by the memory technology device 130. The flash memory 140 of this embodiment is a NAND flash memory chip. The smallest hardware unit for storing data is a memory cell, and the memory cell is composed of a transistor. The crystal is made of a wafer. The organization of the transistor inside the wafer is divided into a page, a block, and a data record matrix. Each of the "pages" is grouped into a "block", and each of the "blocks" constitutes a "data record matrix".

在本發明的實施例中,快閃記憶體控制器120除了具有一快閃記憶體轉換層121(Flash Translation Layer, FTL)及一執行錯誤檢查及修正機制的編碼/解碼器122(ECC Encoder/Decoder)之外,還增加一管理層123(Management Layer)。In the embodiment of the present invention, the flash memory controller 120 has a flash translation layer (FTL) and an encoder/decoder 122 (ECC Encoder/) that performs error checking and correction mechanisms. In addition to Decoder, a management layer of 123 is added.

快閃記憶體轉換層121包括一邏輯/實體位址轉換模組1211 (Logical/Physical Address Translation)、空間回收模組1212(Garbage Collection)及一磨損均衡模組1213(Wear Leveling)。The flash memory conversion layer 121 includes a logical/physical address translation module 1211 (Logical/Physical Address Translation), a space collection module 1212 (Garbage Collection), and a wear leveling module 1213 (Wear Leveling).

管理層123銜接於快閃記憶體轉換層121、錯誤檢查及修正機制的編碼/解碼器122及記憶體技術裝置130三者之間,用來執行一寫入程序,將一頁容量大小的原始資料寫入一具有兩壞頁的快閃記憶體140中,在寫入後,可提供一對應的讀取程序。如此一來,控制器廠商不需要對快閃記憶體控制器120的原有架構作大幅修改,即可達到利用快閃記憶體140的壞頁來存取資料的目的。The management layer 123 is connected between the flash memory conversion layer 121, the error checking and correcting mechanism of the encoder/decoder 122 and the memory technology device 130, and is used to execute a write program to convert a page size original. The data is written into a flash memory 140 having two bad pages, and after writing, a corresponding reading program can be provided. In this way, the controller manufacturer does not need to modify the original architecture of the flash memory controller 120 to achieve the purpose of accessing the data by using the bad pages of the flash memory 140.

管理層123由一壞頁紀錄器1231(Bad Page Recorder)、一資料分離器1232(Data Separator)、資料遮蔽器1233(Data Masker)及一資料組合器1234(Data Assembler)等四個主要的元件所構成,分述如下:The management layer 123 consists of four main components: a bad page recorder 1231 (Bad Page Recorder), a data separator 1232 (Data Separator), a data masker 1233 (Data Masker), and a data combiner 1234 (Data Assembler). The composition is as follows:

(1) 壞頁記錄器1231:用來記錄目前已損壞「頁」的實體位址(Physical Address)。(1) Bad Page Recorder 1231: Used to record the physical address of the currently damaged "page".

(2) 資料分離器1232:在管理層123裡頭需要將一頁容量大小的資料拆成兩半,各別儲存在已損壞的兩個「頁」上,所以需要資料分離器1232來負責資料的拆分與儲存。在本實施例中,資料分離器1232所拆分的原始資料是通過快閃記憶體轉換層121傳遞而來的,拆分後的子資料,則被傳送到記憶體技術裝置130,進而寫入快閃記憶體140中。(2) Data separator 1232: In the management layer 123, it is necessary to split the data of one page size into two halves, and store them separately on the two damaged "pages", so the data separator 1232 is required to be responsible for the data. Split and store. In this embodiment, the original data split by the data separator 1232 is transmitted through the flash memory conversion layer 121, and the split sub-data is transmitted to the memory technology device 130, and then written. Flash memory 140.

(3) 資料遮蔽器1233:透過資料分離器1232將原始資料拆分後的兩份第一子資料與兩份第二子資料,透過資料遮蔽器1233會將各半頁容量大小的子資料替換成虛擬資料(Dummy Data)後,並且形成一第一資料組及一第二資料組,其中第一資料組包括第一子資料加上虛擬資料,第二資料組包括第二子資料加上虛擬資料,再交由ECC編碼/解碼器122進行錯誤檢查及修正編碼(ECC encoding) ,產生與第一資料組及第二資料組相對應的兩個錯誤校正碼。如此一來,可以對一頁容量大小的原始資料使用兩個頁大小的錯誤校正碼,進而重新定義其同位校正碼(Parity)。(3) The data masker 1233: the two first sub-data and the two second sub-data after the original data are separated by the data separator 1232, and the sub-data of each half-page capacity is replaced by the data shutter 1233. After the dummy data (Dummy Data), and forming a first data group and a second data group, wherein the first data group includes the first sub-data plus the virtual data, and the second data group includes the second sub-data plus the virtual data The data is then subjected to error checking and ECC encoding by the ECC encoder/decoder 122 to generate two error correction codes corresponding to the first data group and the second data group. In this way, a two-page error correction code can be used for the original data of one page size, thereby redefining its parity correction code (Parity).

(4) 資料組合器1234:由於寫入資料前使用資料分離器1232將原始資料重新安排在兩個「頁」空間中,要讀取時就需要再透過資料組合器1234來還原出原始資料。(4) Data combiner 1234: Since the original data is rearranged in two "page" spaces by using the data separator 1232 before writing the data, the original data needs to be restored through the data combiner 1234 to be read.

參考圖2及圖3,將本實施例的發明概念,說明如下:若錯誤檢查及修正機制(ECC)的校正能力是每頁n個位元(bits/page),那麼當一頁空間中的錯誤位元(Error Bits)數目超過n個時,無法再使用這個頁空間來正確的儲存資料。本實施例中將這樣的頁空間稱為「壞頁(Bad Page)」。若使用本實施例中管理層123,則只要壞頁中的錯誤位元數目不超過2n個,都可以透過管理層123選用任意兩個壞頁來儲存一頁容量大小的原始資料。從原理上來說,假設某個壞頁的錯誤位元數目為2n個,若將這個壞頁的實體儲存空間平均劃分成兩段,則總是可以找到其中一段,其錯誤位元數目是介於0~n之間。Referring to FIG. 2 and FIG. 3, the inventive concept of the present embodiment is explained as follows: if the error checking and correction mechanism (ECC) correction capability is n bits per page (bits/page), then in a page space When the number of Error Bits exceeds n, this page space can no longer be used to store data correctly. Such a page space is referred to as a "Bad Page" in this embodiment. If the management layer 123 in this embodiment is used, as long as the number of error bits in the bad page does not exceed 2n, any two bad pages can be selected by the management layer 123 to store the original data of one page size. In principle, assuming that the number of error bits of a bad page is 2n, if the physical storage space of the bad page is equally divided into two segments, one of the segments can always be found, and the number of error bits is Between 0~n.

進一步說明請參照圖2,頁PA 有4個錯誤位元,若錯誤檢查及修正機制(ECC)的校正能力是每頁2個位元,則無法校正此頁PA ,因此頁PA 將被視為一壞頁。此時,管理層123會將壞頁PA 的實體儲存空間平均劃分成一第一段S1A 與一第二段S2A 。觀念上可依每段S1A 或S2A 中所含錯誤位元數目的多寡,分別稱之為強段(Strong Segment)與弱段(Weak Segment),強段的錯誤位元數目少於或等於弱段。最佳的情況是壞頁PA 的錯誤位元都聚集於弱段中,則強段沒有錯誤位元的出現,例如壞頁PA 的強段為第二段S2A 。最差的狀況是所有錯誤位元平均分布在兩段中,例如壞頁PB 的一第三段S1B 與一第四段S2B 。儘管是最差狀況,仍是可以使用ECC去校正壞頁PB 的兩段S1B 及/或S1BFor further explanation, please refer to FIG. 2. Page P A has 4 error bits. If the error checking and correction mechanism (ECC) correction capability is 2 bits per page, the page P A cannot be corrected, so page P A will It is considered a bad page. At this time, the management layer 123 divides the physical storage space of the bad page P A into a first segment S 1A and a second segment S 2A . Conceptually, according to the number of error bits included in each segment S 1A or S 2A , respectively, it is called Strong Segment and Weak Segment, and the number of error bits in the strong segment is less than or equal to Weak section. The best case is that the error bits of the bad page P A are concentrated in the weak segment, and the strong segment has no occurrence of the error bit. For example, the strong segment of the bad page P A is the second segment S 2A . The worst case is that all the error bits are evenly distributed in two segments, such as a third segment S 1B and a fourth segment S 2B of the bad page P B . Despite the worst case, it is still possible to use ECC to correct the two segments S 1B and/or S 1B of the bad page P B .

如圖3所示,在一實施例中,可將兩個壞頁PA 及PB 組成一個壞頁組Pset (Bad-Page Set)來儲存一頁容量大小的原始資料D0 。透過以上過程,在每個壞頁PA 或PB 裡頭可儲存原始資料D0 的一半大小的內容,例如一第一子資料DA 或一第二子資料DBAs shown in FIG. 3, in one embodiment, two bad pages P A and P B may be combined into one bad page group P set (Bad-Page Set) to store a page size original data D 0 . Through the above process, half of the size of the original data D 0 can be stored in each of the bad pages P A or P B , such as a first sub-data D A or a second sub-data D B .

關於管理層123在實作上的細節,例如子資料DA 及DB 各別存在壞頁PA 及PB 後的資料結構、將原始資料D0 寫入壞頁PA 及PB ,以及從壞頁PA 及PB 中讀取原始資料D0 的整個流程,詳細地說明如下:About 123 management in the implementation details, such as the sub-data D A and D B P A respective presence of the bad page P B and the data structure, the original data D 0 and writes bad page P B P A, and The entire flow of reading the original data D 0 from the bad pages P A and P B is described in detail as follows:

圖4顯示使用管理層123寫入一頁容量大小的原始資料D0 到壞頁組Pset 的過程,寫入程序主要藉由資料分離器1232及資料遮蔽器1233協同完成。當原始資料D0 通過快閃記憶體轉換層121而傳遞給管理層123後,管理層123先利用資料分離器1232將原始資料D0 的內容及大小均分成兩半,形成如圖4所示之第一子資料DA 與第二子資料DB ,並且將子資料DA 與子資料DB 各別複製一份而形成兩頁容量的資料DAA 及DBB ,每頁資料DAA (或DBB )包括兩份的子資料DA (或兩份子資料DB )。如此,當這兩頁資料DAA 及DBB 被寫到壞頁組Pset 時,子資料DA 與DB 分別被儲存到壞頁組Pset 的兩個壞頁PA 及PB 中,且兩份的子資料DA 分別存在壞頁PA 的其中一段S1A (或S2A )以及兩份子資料DB 分別存在壞頁PB 的其中一段S1B (或S2B )中,可以保證DAA (或DBB )中的其中一個DA (或DB )會存在壞頁PA (或PB )的強段當中。接下來使用資料遮蔽器1233分別將複製處理後的第一頁資料DAA 中的其中一份子資料DA 以虛擬資料Du 取代,以及將第二頁資料DBB 中的其中一份子資料DB 以虛擬資料Du 取代,而形成”子資料DA +虛擬資料Du ”與”子資料DB +虛擬資料Du ”等兩資料組DAM1 及DBM1 。然後再將此兩資料組DAM1 及DBM1 各別進行ECC編碼而重新定義出一第一同位校正碼PCA (Parity)與一第二同位校正碼PCB 。校正碼PCA 用以維護半頁大小的子資料DA ;校正碼PCB 用以維護半頁大小的子資料DB 。最後,將第一頁資料DAA 中兩份子資料DA 與校正碼PCA 合併寫到壞頁PA 中;並且將第二頁資料DBB 中兩份子資料DB 與校正碼PCB 合併寫到壞頁PB 中,而完成了寫入程序。實務上,由於每個壞頁PA 或PB 的每段S1A 、S2A 、S1B 或S2B 皆可能有錯誤位元,因此實際存在各段S1A 及S2A 中的資料內容與子資料DA 相比較可能有缺失,另以代號D1A 及D2A 來表示,存於壞頁PA 的資料” D1A +D2A +PCA ”則以DAW 來表示。同理,以DBW 來表示存於壞頁PB 的資料” D1B +D2B +PCB ”。4 shows the process of writing the original data D 0 to the bad page group P set of one page size using the management layer 123. The writing process is mainly performed by the data separator 1232 and the data masker 1233. After the original data D 0 is transmitted to the management layer 123 through the flash memory conversion layer 121, the management layer 123 first uses the data separator 1232 to divide the content and size of the original data D 0 into two halves, as shown in FIG. The first sub-data D A and the second sub-data D B , and the sub-data D A and the sub-data D B are separately copied to form a two-page capacity data D AA and D BB , and each page of data D AA ( Or D BB ) includes two copies of sub-data D A (or two sub-data D B ). Thus, when the two pages of data D AA and D BB are written to the bad page group P set , the sub-data D A and D B are respectively stored in the two bad pages P A and P B of the bad page group P set . And the two sub-data D A respectively have a segment S 1A (or S 2A ) of the bad page P A and two sub-data D B respectively exist in one segment S 1B (or S 2B ) of the bad page P B , which can be guaranteed One of D A (or D B ) in D AA (or D BB ) may be in the strong segment of bad page P A (or P B ). Next, the data masker 1233 is used to replace one of the sub-data D A of the first page data D AA after the copy processing with the virtual material D u , and one of the sub-data D B of the second page data D BB . Substituting the virtual data D u to form two data sets D AM1 and D BM1 such as "sub-data D A + virtual data D u " and "sub-data D B + virtual data D u ". Then, the two data sets D AM1 and D BM1 are respectively ECC-encoded to redefine a first parity correction code P CA (Parity) and a second parity correction code P CB . The correction code P CA is used to maintain the half-page size sub-data D A ; the correction code P CB is used to maintain the half-page size sub-data D B . Finally, the two sub-data D A and the correction code P CA in the first page data D AA are merged into the bad page P A ; and the two sub-data D B in the second page data D BB are combined with the correction code P CB Go to the bad page P B and complete the writing process. In practice, since each segment S 1A , S 2A , S 1B or S 2B of each bad page P A or P B may have an erroneous bit, there is actually a data content and sub-section in each segment S 1A and S 2A . The data D A may be missing, and the codes D 1A and D 2A are used. The data "D 1A + D 2A + P CA " stored in the bad page P A is represented by D AW . Similarly, the data "D 1B + D 2B + P CB " stored in the bad page P B is represented by D BW .

圖5顯示使用管理層123讀取先前儲存在壞頁組Pset 的資料DAW 及DBW ,並且將其還原為一頁大小的原始資料D0 的過程,讀取程序主要藉由資料組合器1234及資料遮蔽器1233協同完成。同時參照圖2來說明讀取程序的基本步驟如下:FIG. 5 shows a process of using the management layer 123 to read the data D AW and D BW previously stored in the bad page group P set and restore it to a page size original data D 0 . The reading program is mainly by the data combiner. 1234 and the data masker 1233 are cooperatively completed. The basic steps of reading the program are described below with reference to FIG. 2 as follows:

以資料遮蔽器1233對其中一個壞頁PA 選擇其第一段S1A 或第二段S1B 其中之一實體儲存空間作遮蔽,如圖2所示的PAM ,例如:將被遮蔽的一段S1A 中的位元皆填入0,也就是利用資料遮蔽器1233將儲存於第一段S1A 的資料內容D1A 轉換成虛擬資料Du ;利用ECC編碼/解碼器122根據遮蔽處理後的資料組DAM2 ,其包括一第一同位校正碼PCA 、虛擬資料Du 及儲存於第二段S2A 的資料內容D2A ,進行校正而將儲存於第二段S2A 的資料內容D2A 還原為第一子資料DAThe data masker 1233 selects one of the first page S 1A or the second segment S 1B of one of the bad pages P A to be shielded, such as P AM as shown in FIG. 2 , for example, a segment to be masked The bits in S 1A are filled with 0, that is, the data content D 1A stored in the first segment S 1A is converted into the virtual data D u by the data masker 1233; and the mask is processed by the ECC encoder/decoder 122. information group D AM2, which comprises a first correction code parity P CA, virtual information stored in the second section D U S 2A and the contents of the information D 2A, by correcting the stored data in the second segment S 2A content D 2A is restored to the first sub-data D A .

同理,以資料遮蔽器1233將儲存於第三段S1B 的資料內容D1B 轉換成虛擬資料Du 。利用ECC編碼/解碼器122根據遮蔽處理後的資料組DBM2 ,其包括第二同位校正碼PCB 、虛擬資料Du 及儲存於第四段S2B 的資料內容,進行校正而將儲存於第四段S2B 的資料內容D2B 還原為第二子資料DB 。最後,利用資料組合器1234,將還原得到的第一子資料DA 及第二子資料DB 組合成原始資料D0 ,並傳回快閃記憶體轉換層121,進而往主機110傳送,而完成讀取程序。Similarly, the data content D 1B stored in the third segment S 1B is converted into the virtual material D u by the data masker 1233. Using the ECC encoder/decoder 122, according to the masked processed data set D BM2 , including the second parity correction code P CB , the virtual data Du and the data content stored in the fourth segment S 2B , the correction is performed and stored in the first The data content D 2B of the four-segment S 2B is restored to the second sub-data D B . Finally, the data subcombiner 1234 is used to combine the restored first sub-data D A and the second sub-data D B into the original data D 0 and transmitted back to the flash memory conversion layer 121 to be transmitted to the host 110. Complete the reading process.

如圖5所示,在一實施例中,若ECC編碼/解碼器122根據第一同位校正碼PCA ,無法將儲存於第二段S2A 的資料內容D2A 還原為第一子資料DA ,則資料遮蔽器1233會判斷第二段S2A 為一弱段,而重新選擇將儲存於第二段S2A 的資料內容D2A 轉換成虛擬資料Du ,並保留儲存於第一段S1A 的資料內容D1A 。之後ECC編碼/解碼器122再根據第一同位校正碼PCA ,對儲存於第一段S1A 的資料內容D1A 進行校正,而將儲存於第一段S1A 的資料內容D1A 還原為第一子資料DAAs shown in FIG. 5, in an embodiment, if the ECC encoder/decoder 122 fails to restore the data content D 2A stored in the second segment S 2A to the first sub-data D according to the first parity correction code P CA . A , the data masker 1233 determines that the second segment S 2A is a weak segment, and reselects to convert the data content D 2A stored in the second segment S 2A into the virtual data D u and keeps the first segment S 1A 's data content D 1A . The ECC encoder/decoder 122 then corrects the data content D 1A stored in the first segment S 1A according to the first parity correction code P CA , and restores the data content D 1A stored in the first segment S 1A to The first sub-data D A .

同理,若ECC編碼/解碼器122根據第二同位校正碼PCB ,無法將儲存於第四段S2B 的資料內容D2B 還原為第二子資料DB ,則資料遮蔽器1233會判斷第四段S2B 為一弱段,而重新選擇將儲存於第四段S2B 的資料內容D2B 轉換成虛擬資料Du ,並保留儲存於第三段S1B 的資料內容D1B 。之後ECC編碼/解碼器122再根據第二同位校正碼PCB ,對儲存於第三段S1B 的資料內容D1B 進行校正,而將儲存於第三段S1B 的資料內容D1B 還原為第二子資料DBSimilarly, if the ECC encoder/decoder 122 cannot restore the data content D 2B stored in the fourth segment S 2B to the second sub-data D B according to the second parity correction code P CB , the data masker 1233 will determine the first 2B is a weak four S segment, and re-select S data stored in the fourth paragraph D 2B 2B content into virtual data D u, and stored in the third paragraph of S reserved content material 1B, D 1B. The ECC encoder/decoder 122 then corrects the data content D 1B stored in the third segment S 1B according to the second parity correction code P CB , and restores the data content D 1B stored in the third segment S 1B to the first The second sub-data D B .

再參照圖3,在一實施例中,管理層123可以在同一個晶圓(die)裡頭相鄰的兩個儲存矩陣(plane)中,選擇具有相同位移的兩個壞頁來組合成一壞頁組Pset 。如此,管理層123可以使用進階的平行指令去操作這兩個壞頁,以減輕資料處理系統100的負擔,並加快處理速度。換句話說,管理層123可提供一平行指令給記憶體技術裝置130,在將兩份第一子資料DA 及第一同位校正碼PCA 合併寫入第一壞頁PA 的同時,也將兩份第二子資料DB 及第二同位校正碼合併寫入第二壞頁PB 。如此,利用"平行指令"來對兩個壞頁同時寫入資料,而不是依時間順序地寫入資料,故可以減少寫入時的處理時間。Referring again to FIG. 3, in an embodiment, the management layer 123 may select two bad pages having the same displacement to form a bad page in two storage matrices adjacent to each other in the same die. Group P set . As such, the management layer 123 can use the advanced parallel instructions to operate the two bad pages to ease the burden on the data processing system 100 and speed up the processing. In other words, the management layer 123 can provide a parallel instruction to the memory technology device 130, and combine the two first sub-data D A and the first parity correction code P CA into the first bad page P A . The two second sub-data D B and the second parity correction code are also combined and written into the second bad page P B . In this way, the "parallel instruction" is used to simultaneously write data to two bad pages instead of sequentially writing data, so that the processing time at the time of writing can be reduced.

在一實施例中,第一壞頁PA 的實體儲存空間包含一第一備用區SaA (Spare Area),並且第二壞頁PB 的實體儲存空間包含一第二備用區SaB 。在上述寫入程序中,第一同位校正碼PCA 被寫入第一備用區SaA ,並且第二同位校正碼PCB 被寫入第二備用區SaB 。由於管理層123使用兩個壞頁PA 及PB 儲存一頁容量大小的原始資料D0 ,所以對於一頁容量大小的原始資料D0 來說,有兩個備用區(Spare Area)可供使用,故可儲存更長的同位校正碼。In an embodiment, the physical storage space of the first bad page P A includes a first spare area S aA (Spare Area), and the physical storage space of the second bad page P B includes a second spare area S aB . In the above writing procedure, the first parity correction code P CA is written to the first spare area Sa a and the second parity correction code P CB is written to the second spare area SaB . Since the management layer 123 uses two bad pages P A and P B to store the original data D 0 of one page size, there are two spare areas (Spare Area) for the original data D 0 of one page size. It can be used to store longer parity codes.

在習知技術中,廠商通常為了加速ECC的計算,會使用硬體來實作ECC 編碼/解碼器。以習知的作法,若需要產生更長的同位校正碼就需要增加ECC編碼器的輸出,進而必須要改變ECC編碼器的硬體。然而,本發明的管理層123可以在不改變ECC的硬體的情形下來達到ECC增強的效果。關鍵在於,本發明不是使用一個兩倍大小的ECC同位校正碼來維護一頁容量大小的資料,而是使用兩個正常大小的ECC同位校正碼分別維護兩個半頁容量大小的資料。在對半頁容量大小的資料進行ECC編碼的時候,管理層123將另外半頁的儲存位元皆補上虛擬資料,例如”0”,形成一頁容量大小的資料,以符合一般ECC編碼器的輸入格式。由於補上虛擬資料的那一半的資料內容為已知值,則所產生的ECC同位校正碼只需要保護半頁容量大小的資料。如圖4所示,這也是為什麼要在ECC編碼的時候,進行資料遮蔽而產生虛擬資料的原因。In the prior art, manufacturers usually use hardware to implement an ECC encoder/decoder in order to speed up the calculation of ECC. In a conventional practice, if it is necessary to generate a longer parity correction code, it is necessary to increase the output of the ECC encoder, and thus the hardware of the ECC encoder must be changed. However, the management layer 123 of the present invention can achieve the ECC enhanced effect without changing the hardware of the ECC. The key point is that instead of using a double-sized ECC parity correction code to maintain a page size data, the present invention maintains two half page size data using two normal size ECC parity correction codes. When ECC encoding the half-page size data, the management layer 123 fills the other half of the storage bits with dummy data, such as "0", to form a page size data to conform to the general ECC encoder. Input format. Since the data content of the half of the dummy data is a known value, the generated ECC parity correction code only needs to protect the data of half page size. As shown in Figure 4, this is the reason why data is masked to generate virtual data when ECC is encoded.

本發明之方法應用固態硬碟的平台時,可配合Windows XP, Linux (Ubuntu 9), Multimedia和Financial的workload等作業環境。實驗結果顯示,使用本發明的方法在以上4種作業環境下,可以使固態硬碟分別增加48.54%, 28.38%, 65.45%與44.77%的壽命。When the method of the present invention is applied to a platform of a solid state hard disk, it can cooperate with an operating environment such as Windows XP, Linux (Ubuntu 9), Multimedia, and Financial workload. The experimental results show that using the method of the present invention can increase the life of the solid state hard disk by 48.54%, 28.38%, 65.45% and 44.77%, respectively, under the above four working environments.

本發明之方法和以往的技術最大的不同在於,本發明之方法可以將NAND快閃記憶體晶片當中已經損壞的「頁」空間回收管理並且再利用,透過本發明之管理層,可以將資料儲存在這些原本已經損壞的頁空間中,並且稍後可以正確的讀出並還原回原始資料,透過壞頁再利用的方式來延長NAND快閃記憶體晶片的壽命。The biggest difference between the method of the present invention and the prior art is that the method of the present invention can recover and reuse the damaged "page" space in the NAND flash memory chip, and the data can be stored through the management layer of the present invention. In these originally damaged page spaces, and later, the original data can be correctly read and restored, and the life of the NAND flash memory chip is extended by the bad page reuse.

本發明和已知先前技術,其共同的目的都在於解決快閃記憶體的壽命問題,不同之處在於本發明考慮到先前技術所沒有注意到的特性, 亦即,重新利用原本已經損壞的快閃記憶體區塊。透過本發明所設計的軟體管理層,壞頁可以轉換成正常頁繼續使用。本發明的管理層與先前技術沒有衝突,所以本發明可以任意的附加在先前技術上,進一步地延長快閃記憶體的壽命。The present invention and the prior art are known to solve the problem of the lifetime of a flash memory, except that the present invention takes into account characteristics not noticed by the prior art, that is, reusing the already damaged one. Flash memory block. Through the software management layer designed by the present invention, bad pages can be converted into normal pages for continued use. The management layer of the present invention does not conflict with the prior art, so the present invention can be arbitrarily added to the prior art to further extend the life of the flash memory.

惟以上所述者,僅為本發明之較佳實施例而已,當不能以此限定本發明實施之範圍,即大凡依本發明申請專利範圍及發明說明內容所作之簡單的等效變化與修飾,皆仍屬本發明專利涵蓋之範圍內。另外本發明的任一實施例或申請專利範圍不須達成本發明所揭露之全部目的或優點或特點。此外,摘要部分和標題僅是用來輔助專利文件搜尋之用,並非用來限制本發明之權利範圍。The above is only the preferred embodiment of the present invention, and the scope of the invention is not limited thereto, that is, the simple equivalent changes and modifications made by the scope of the invention and the description of the invention are All remain within the scope of the invention patent. In addition, any of the objects or advantages or features of the present invention are not required to be achieved by any embodiment or application of the invention. In addition, the abstract sections and headings are only used to assist in the search of patent documents and are not intended to limit the scope of the invention.

100‧‧‧資料處理系統
110‧‧‧主機
111‧‧‧作業系統
112‧‧‧檔案系統
120‧‧‧快閃記憶體控制器
121‧‧‧快閃記憶體轉換層
1211‧‧‧邏輯/實體位址轉換模組
1212‧‧‧空間回收模組
1213‧‧‧磨損均衡模組
122‧‧‧執行錯誤檢查及修正機制的編碼/解碼器
123‧‧‧管理層
1231‧‧‧壞頁紀錄器
1232‧‧‧資料分離器
1233‧‧‧資料遮蔽器
1234‧‧‧資料組合器
130‧‧‧記憶體技術裝置
140‧‧‧快閃記憶體
200a,200b…200n‧‧‧複數應用程式
150‧‧‧介面
PA、PB‧‧‧壞頁
PAM、PBM‧‧‧壞頁(經遮蔽處理)
S1A、S2A‧‧‧壞頁PA中的實體儲存空間分段
S1B、S2B‧‧‧壞頁PB中的實體儲存空間分段
SaA‧‧‧壞頁PA中的備用區
SaB‧‧‧壞頁PB中的備用區
Pset‧‧‧壞頁組
D0‧‧‧原始資料
DA‧‧‧第一子資料
DB‧‧‧第二子資料
DAA、DBB‧‧‧寫入程序中資料分離器輸出的資料
Du‧‧‧虛擬資料
DAM1、DBM1‧‧‧寫入程序中資料遮蔽器輸出的資料組
DAM2、DBM2‧‧‧讀取程序中資料遮蔽器輸出的資料組
PCA‧‧‧第一同位校正碼
PCB‧‧‧第二同位校正碼
DAW‧‧‧實際存於壞頁PA的資料
DBW‧‧‧實際存於壞頁PB的資料
D1A、D2A‧‧‧實際存於壞頁PA的子資料
D1B、D2B‧‧‧實際存於壞頁PB的子資料
100‧‧‧Data Processing System
110‧‧‧Host
111‧‧‧Operating system
112‧‧‧File System
120‧‧‧Flash Memory Controller
121‧‧‧Flash memory conversion layer
1211‧‧‧Logical/Physical Address Translation Module
1212‧‧‧ Space Recycling Module
1213‧‧‧ wear leveling module
122‧‧‧Encoder/decoder for performing error checking and correction mechanisms
123‧‧‧Management
1231‧‧‧Bad page recorder
1232‧‧‧ data separator
1233‧‧‧ data shutter
1234‧‧‧Data combiner
130‧‧‧Memory technology device
140‧‧‧Flash memory
200a, 200b...200n‧‧‧ plural applications
150‧‧‧ interface
P A , P B ‧‧ ‧ bad page
P AM , P BM ‧‧‧bad pages (masked)
Entity storage space segmentation in S 1A , S 2A ‧‧ ‧ bad page P A
Entity storage space segmentation in S 1B , S 2B ‧‧ ‧ bad page P B
S aA ‧‧‧The spare area in the bad page P A
Spare area in S aB ‧‧‧Bad page P B
P set ‧‧‧bad page group
D 0 ‧‧‧Source
D A ‧‧‧ first sub-data
D B ‧‧‧Second sub-data
D AA , D BB ‧‧‧Data written by the data separator in the program
D u ‧‧‧virtual information
D AM1 , D BM1 ‧‧‧ Data set output by the data masker in the program
D AM2 , D BM2 ‧‧‧Reading the data set output by the data masker
P CA ‧‧‧First parity correction code
P CB ‧‧‧Second parity correction code
D AW ‧‧‧Information actually stored on the bad page P A
D BW ‧‧‧Information actually stored on the bad page P B
D 1A , D 2A ‧ ‧ sub-data actually stored in the bad page P A
D 1B , D 2B ‧ ‧ sub-data actually stored in the bad page P B

圖1為應用本發明之方法的資料處理系統的整體架構示意圖。1 is a schematic diagram of the overall architecture of a data processing system to which the method of the present invention is applied.

圖2為本發明之一實施例的壞頁及其判斷強段/弱段的方法示意圖。2 is a schematic diagram of a bad page and a method for determining a strong/weak segment according to an embodiment of the present invention.

圖3為本發明之一實施例的原始資料重新安排後儲存於壞頁組結構示意圖。FIG. 3 is a schematic structural diagram of storing original data in a bad page group after rearranging the original data according to an embodiment of the present invention.

圖4為本發明之一實施例的管理層之資料寫入程序示意圖。4 is a schematic diagram of a data writing procedure of a management layer according to an embodiment of the present invention.

圖5為本發明之一實施例的管理層之資料讀取程序示意圖。FIG. 5 is a schematic diagram of a data reading program of a management layer according to an embodiment of the present invention.

no

no

1232‧‧‧資料分離器 1232‧‧‧ data separator

1233‧‧‧資料遮蔽器 1233‧‧‧ data shutter

122‧‧‧執行錯誤檢查及修正機制的編碼/解碼器 122‧‧‧Encoder/decoder for performing error checking and correction mechanisms

Pset‧‧‧壞頁組 P set ‧‧‧bad page group

PA、PB‧‧‧壞頁 P A , P B ‧‧ ‧ bad page

S1A、S2A‧‧‧壞頁PA中的實體儲存空間分段 Entity storage space segmentation in S 1A , S 2A ‧‧ ‧ bad page P A

S1B、S2B‧‧‧壞頁PB中的實體儲存空間分段 Entity storage space segmentation in S 1B , S 2B ‧‧ ‧ bad page P B

SaA‧‧‧壞頁PA中的備用區 S aA ‧‧‧The spare area in the bad page P A

SaB‧‧‧壞頁PB中的備用區 Spare area in S aB ‧‧‧Bad page P B

D0‧‧‧原始資料 D 0 ‧‧‧Source

DA‧‧‧第一子資料 D A ‧‧‧ first sub-data

DB‧‧‧第二子資料 D B ‧‧‧Second sub-data

DAA、DBB‧‧‧寫入程序中資料分離器輸出的資料 D AA , D BB ‧‧‧Data written by the data separator in the program

Du‧‧‧虛擬資料 D u ‧‧‧virtual information

DAM1、DBM1‧‧‧寫入程序中資料遮蔽器輸出的資料組 D AM1 , D BM1 ‧‧‧ Data set output by the data masker in the program

DAM2、DBM2‧‧‧讀取程序中資料遮蔽器輸出的資料組 D AM2 , D BM2 ‧‧‧Reading the data set output by the data masker

PCA‧‧‧第一同位校正碼 P CA ‧‧‧First parity correction code

PCB‧‧‧第二同位校正碼 P CB ‧‧‧Second parity correction code

DAW‧‧‧實際存於壞頁PA的資料 D AW ‧‧‧Information actually stored on the bad page P A

DBW‧‧‧實際存於壞頁PB的資料 D BW ‧‧‧Information actually stored on the bad page P B

D1A、D2A‧‧‧實際存於壞頁PA的子資料 D 1A , D 2A ‧ ‧ sub-data actually stored in the bad page P A

D1B、D2B‧‧‧實際存於壞頁PB的子資料 D 1B , D 2B ‧ ‧ sub-data actually stored in the bad page P B

Claims (10)

一種利用快閃記憶體的壞頁來存取資料的方法,該方法包括一寫入程序,用以將一頁(page)容量大小的一原始資料寫入一快閃記憶體中,該快閃記憶體至少包括一第一壞頁及一第二壞頁,其中該第一壞頁及該第二壞頁皆包括複數錯誤位元,其中該寫入程序包括以下步驟: 利用一資料分離器(data separator)將該原始資料平均拆分成一第一子資料及一第二子資料,並且將該第一子資料及該第二子資料各別複製一份,形成兩份該第一子資料及兩份該第二子資料; 利用一資料遮蔽器(data masker)將該兩份第一子資料其中之一及該兩份第二子資料其中之一轉換成兩份虛擬資料(dummy data),並且形成一第一資料組及一第二資料組,其中該第一資料組包括該兩份第一子資料其中的另一加上該兩份虛擬資料其中之一,該第二資料組包括該兩份第二子資料其中的另一加上該兩份虛擬資料其中的另一; 利用一編碼器根據該第一資料組產生一第一同位校正碼,並且根據該第二資料組產生一第二同位校正碼;以及 將該兩份第一子資料及該第一同位校正碼合併寫入該第一壞頁,並且將該兩份第二子資料及該第二同位校正碼合併寫入該第二壞頁。A method for accessing data by using a bad page of a flash memory, the method comprising a writing program for writing a piece of original data of a page size into a flash memory, the flash The memory includes at least a first bad page and a second bad page, wherein the first bad page and the second bad page both comprise a plurality of error bits, wherein the writing process comprises the following steps: using a data separator ( The data separator is divided into a first sub-data and a second sub-data, and the first sub-data and the second sub-data are separately copied to form two copies of the first sub-data and Two copies of the second sub-data; converting one of the two first sub-data and one of the two second sub-data into two dummy data by using a data masker; And forming a first data group and a second data group, wherein the first data group includes one of the two first sub-data and one of the two virtual data, the second data group includes the Two of the two second sub-data plus the two Another one of the virtual data; generating, by the encoder, a first parity correction code according to the first data set, and generating a second parity correction code according to the second data set; and generating the two first sub-data And the first parity correction code is combined to write the first bad page, and the two second sub-data and the second parity correction code are combined and written into the second bad page. 如申請專利範圍第1項所述之利用快閃記憶體的壞頁來存取資料的方法,更包括一讀取程序,其步驟包括: 將該第一壞頁上的實體儲存空間平均劃分為一第一段及一第二段; 該資料遮蔽器將儲存於該第一段的資料內容轉換成該虛擬資料; 利用一解碼器根據該第一同位校正碼對儲存於該第二段的資料內容進行校正,而將儲存於該第二段的資料內容還原為該第一子資料; 將該第二壞頁上的實體儲存空間平均劃分為一第三段及一第四段; 該資料遮蔽器將儲存於該第三段的資料內容轉換成該虛擬資料; 利用該解碼器根據該第二同位校正碼對儲存於該第四段的資料內容進行校正,而將儲存於該第四段的資料內容還原為該第二子資料;以及 利用一資料組合器(data assembler),將還原得到的該第一子資料及該第二子資料組合成該原始資料。The method for accessing data by using a bad page of a flash memory as described in claim 1 further includes a reading process, the steps comprising: dividing the physical storage space on the first bad page into an average a first segment and a second segment; the data masker converts the data content stored in the first segment into the virtual data; using a decoder to store the second segment in accordance with the first parity correction code pair Correcting the content of the data, and restoring the data content stored in the second segment to the first sub-data; dividing the physical storage space on the second bad page into a third segment and a fourth segment; The masker converts the data content stored in the third segment into the virtual data; using the decoder to correct the data content stored in the fourth segment according to the second parity correction code, and storing the data in the fourth segment The data content is restored to the second sub-data; and the first sub-data and the second sub-data obtained by the restoration are combined into the original data by using a data assembler. 如申請專利範圍第2項所述之利用快閃記憶體的壞頁來存取資料的方法,若該解碼器根據該第一同位校正碼,無法將儲存於該第二段的資料還原為該第一子資料,則該讀取程序更包括: 該資料遮蔽器判斷該第二段中的該等錯誤位元數量多於該第一段中的該等錯誤位元數量,進而重新選擇將儲存於該第二段的資料轉換成該虛擬資料,而保留儲存於該第一段的資料內容;以及 該解碼器根據該第一同位校正碼(parity)對儲存於該第一段的資料內容進行校正,而將儲存於該第一段的資料內容還原為該第一子資料。The method for accessing data by using a bad page of a flash memory as described in claim 2, if the decoder is based on the first parity correction code, the data stored in the second segment cannot be restored to The first sub-data, the reading program further comprises: the data masker determining that the number of the wrong bits in the second segment is greater than the number of the wrong bits in the first segment, and then reselecting The data stored in the second segment is converted into the virtual data, and the data content stored in the first segment is retained; and the decoder stores the data stored in the first segment according to the first parity correction code (parity) The content is corrected, and the data content stored in the first segment is restored to the first sub-data. 如申請專利範圍第2項所述之利用快閃記憶體的壞頁來存取資料的方法,若該解碼器根據該第二同位校正碼,無法將儲存於該第四段的資料還原為該第二子資料,則該讀取程序更包括: 該資料遮蔽器判斷該第四段中的該等錯誤位元數量多於該第三段中的該等錯誤位元數量,進而重新選擇將儲存於該第四段的資料轉換成該虛擬資料,而保留儲存於該第三段的資料內容;以及 該解碼器根據該第二同位校正碼對儲存於該第三段的資料內容進行校正,而將儲存於該第三段的資料內容還原為該第二子資料。The method for accessing data by using a bad page of a flash memory as described in claim 2, if the decoder is based on the second parity correction code, the data stored in the fourth segment cannot be restored to the The second sub-data, the reading program further comprises: the data masker determining that the number of the wrong bits in the fourth segment is greater than the number of the wrong bits in the third segment, and then re-selecting to store Converting the data in the fourth segment into the virtual data, and retaining the data content stored in the third segment; and the decoder corrects the data content stored in the third segment according to the second parity correction code, and The content of the data stored in the third paragraph is restored to the second sub-data. 如申請專利範圍第2項所述之利用快閃記憶體的壞頁來存取資料的方法,其應用於一快閃記憶體控制器中,該快閃記憶體控制器電性連接於該快閃記憶體,並且具有一快閃記憶體轉換層(Flash Translation Layer, FTL),其中若需要將該原始資料拆分並儲存於該第一壞頁及該第二壞頁時,該原始資料會通過該快閃記憶體轉換層而傳送至該資料分離器。A method for accessing data by using a bad page of a flash memory as described in claim 2, which is applied to a flash memory controller, wherein the flash memory controller is electrically connected to the fast Flash memory, and has a flash translation layer (FTL), wherein if the original data needs to be split and stored in the first bad page and the second bad page, the original data will Transfer to the data splitter through the flash memory conversion layer. 如申請專利範圍第5項所述之利用快閃記憶體的壞頁來存取資料的方法,其應用於一資料處理系統中,該資料處理系統包括一主機、該快閃記憶體控制器、一記憶體技術裝置(Memory Technology Device, MTD)以及該快閃記憶體,其中該主機產生該原始資料,並將該原始資料傳送至該快閃記憶體轉換層,該快閃記憶體轉換層將該原始資料輸入該資料分離器,該資料分離器輸出一包含該兩份第一子資料的資料組及一包含該兩份第二子資料的資料組,並將其傳送到該記憶體技術裝置,進而寫入該快閃記憶體中。A method for accessing data by using a bad page of a flash memory as described in claim 5, which is applied to a data processing system, the data processing system including a host, the flash memory controller, a memory technology device (MTD) and the flash memory, wherein the host generates the original data and transmits the original data to the flash memory conversion layer, and the flash memory conversion layer The source data is input to the data separator, and the data separator outputs a data group including the two first sub-data and a data group including the two second sub-data, and transmits the data group to the memory technology device And then written into the flash memory. 如申請專利範圍第6項所述之利用快閃記憶體的壞頁來存取資料的方法,更包括: 選擇該第一壞頁及該第二壞頁的位置,使其位於該快閃記憶體中的同一個晶圓(die)的相鄰兩儲存矩陣(plane)中,並且該第一壞頁及該第二壞頁在各別的該儲存矩陣上具有相同的位移。The method for accessing data by using a bad page of a flash memory as described in claim 6 further includes: selecting a location of the first bad page and the second bad page to be located in the flash memory In the adjacent two storage mates of the same die in the body, and the first bad page and the second bad page have the same displacement on the respective storage matrices. 如申請專利範圍第7項所述之利用快閃記憶體的壞頁來存取資料的方法,更包括:提供一平行指令給該記憶體技術裝置,在將該兩份第一子資料及該第一同位校正碼合併寫入該第一壞頁的同時,也將該兩份第二子資料及該第二同位校正碼合併寫入該第二壞頁。The method for accessing data by using a bad page of a flash memory as described in claim 7, further comprising: providing a parallel instruction to the memory technology device, wherein the two first sub-data and the When the first parity correction code is combined and written into the first bad page, the two second sub-data and the second parity correction code are also combined and written into the second bad page. 如申請專利範圍第1項所述之利用快閃記憶體的壞頁來存取資料的方法,更包括:提供一壞頁記錄器,以記錄該第一壞頁與該第二壞頁的實體位址。The method for accessing data by using a bad page of a flash memory as described in claim 1, further comprising: providing a bad page recorder to record the first bad page and the second bad page entity Address. 如申請專利範圍第1項所述之利用快閃記憶體的壞頁來存取資料的方法,其中該第一壞頁具有一第一備用區(spare area),並且該第二壞頁具有一第二備用區,在該寫入程序中,該第一同位校正碼被寫入該第一備用區,並且該第二同位校正碼被寫入該第二備用區。A method for accessing data by using a bad page of a flash memory as described in claim 1, wherein the first bad page has a first spare area, and the second bad page has a And a second spare area, in the writing process, the first parity correction code is written into the first spare area, and the second parity correction code is written into the second spare area.
TW104100264A 2015-01-06 2015-01-06 Method for writing into and reading from bad pages of a flash memory TWI557559B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW104100264A TWI557559B (en) 2015-01-06 2015-01-06 Method for writing into and reading from bad pages of a flash memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW104100264A TWI557559B (en) 2015-01-06 2015-01-06 Method for writing into and reading from bad pages of a flash memory

Publications (2)

Publication Number Publication Date
TW201626230A TW201626230A (en) 2016-07-16
TWI557559B true TWI557559B (en) 2016-11-11

Family

ID=56985136

Family Applications (1)

Application Number Title Priority Date Filing Date
TW104100264A TWI557559B (en) 2015-01-06 2015-01-06 Method for writing into and reading from bad pages of a flash memory

Country Status (1)

Country Link
TW (1) TWI557559B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI759370B (en) * 2017-01-23 2022-04-01 韓商愛思開海力士有限公司 Memory device, memory system, and operation method thereof

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI617917B (en) * 2017-08-28 2018-03-11 慧榮科技股份有限公司 Data storage method for optimizing data storage device and its data storage device
JP2019057172A (en) * 2017-09-21 2019-04-11 東芝メモリ株式会社 Memory system and control method
CN111831470B (en) * 2019-04-18 2024-03-08 上海川源信息科技有限公司 Data restoring method of disk array system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101339537A (en) * 2008-08-14 2009-01-07 四川登巅微电子有限公司 NAND flash memory management process using page as unit
US20090259806A1 (en) * 2008-04-15 2009-10-15 Adtron, Inc. Flash management using bad page tracking and high defect flash memory
US20120260149A1 (en) * 2011-04-06 2012-10-11 Samsung Electronics Co., Ltd. Dummy data padding and error code correcting memory controller, data processing method thereof, and memory system including the same
TW201426305A (en) * 2012-12-28 2014-07-01 Infomicro Electronics Shenzhen Ltd Virtual memory device (VMD) application/driver with dual-level interception for data-type splitting, meta-page grouping, and diversion of TEMP files to ramdisks for enhanced flash endurance

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090259806A1 (en) * 2008-04-15 2009-10-15 Adtron, Inc. Flash management using bad page tracking and high defect flash memory
CN101339537A (en) * 2008-08-14 2009-01-07 四川登巅微电子有限公司 NAND flash memory management process using page as unit
US20120260149A1 (en) * 2011-04-06 2012-10-11 Samsung Electronics Co., Ltd. Dummy data padding and error code correcting memory controller, data processing method thereof, and memory system including the same
TW201426305A (en) * 2012-12-28 2014-07-01 Infomicro Electronics Shenzhen Ltd Virtual memory device (VMD) application/driver with dual-level interception for data-type splitting, meta-page grouping, and diversion of TEMP files to ramdisks for enhanced flash endurance

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI759370B (en) * 2017-01-23 2022-04-01 韓商愛思開海力士有限公司 Memory device, memory system, and operation method thereof

Also Published As

Publication number Publication date
TW201626230A (en) 2016-07-16

Similar Documents

Publication Publication Date Title
TWI527037B (en) Data storing method, memory control circuit unit and memory storage apparatus
US8788876B2 (en) Stripe-based memory operation
US8904261B2 (en) Data management in solid state storage devices
KR101491943B1 (en) Transaction log recovery
TWI537816B (en) Non-volatile memory device and control method for controller
US10127166B2 (en) Data storage controller with multiple pipelines
TWI484334B (en) Method for region-based management of non-volatile memory
TWI537728B (en) Buffer memory management method, memory control circuit unit and memory storage device
KR101678868B1 (en) Apparatus for flash address translation apparatus and method thereof
TWI451249B (en) Data merging method for non-volatile memory and controller and stoarge apparatus using the same
CN103718162A (en) Method and apparatus for flexible raid in ssd
KR20120060236A (en) Power interrupt management
JP6696280B2 (en) Information processing apparatus, RAID control method, and RAID control program
JP5950286B2 (en) Apparatus and method for writing address conversion table
TWI557559B (en) Method for writing into and reading from bad pages of a flash memory
KR20110024832A (en) Solid state storage system with improved data merging efficiency and method of controlling the same
TWI540428B (en) Data writing method, memory controller and memory storage apparatus
TWI521346B (en) Data merging method for non-volatile memory and controller and stoarge apparatus using the same
TWI553477B (en) Memory management method, memory control circuit unit and memory storage device
TW201312351A (en) Data writing method, memory controller and memory storage apparatus
TW202211029A (en) Nonvolatile memory, memory system, and control method of nonvolatile memory
TW202145243A (en) Data storage device and data processing method
JP2021125090A (en) Memory controller and flash memory system
KR20190027279A (en) Method And Apparatus for Recovery in Flash Storage Using Selective Erasure Coding

Legal Events

Date Code Title Description
MM4A Annulment or lapse of patent due to non-payment of fees