CN101408864B - Data protection method for power failure and controller using the method - Google Patents

Data protection method for power failure and controller using the method Download PDF

Info

Publication number
CN101408864B
CN101408864B CN2007101629951A CN200710162995A CN101408864B CN 101408864 B CN101408864 B CN 101408864B CN 2007101629951 A CN2007101629951 A CN 2007101629951A CN 200710162995 A CN200710162995 A CN 200710162995A CN 101408864 B CN101408864 B CN 101408864B
Authority
CN
China
Prior art keywords
data
relationship
block
physical
update information
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN2007101629951A
Other languages
Chinese (zh)
Other versions
CN101408864A (en
Inventor
朱健华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Phison Electronics Corp
Original Assignee
Phison Electronics Corp
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 Phison Electronics Corp filed Critical Phison Electronics Corp
Priority to CN2007101629951A priority Critical patent/CN101408864B/en
Publication of CN101408864A publication Critical patent/CN101408864A/en
Application granted granted Critical
Publication of CN101408864B publication Critical patent/CN101408864B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

本发明提出一种数据保护方法,其适用于非易失性存储器中逻辑区块所对映的多个物理区块,此数据保护方法包括:在每一个物理区块中记录数据更新信息,数据更新信息用以识别物理区块中数据的更新关系;以及依据数据更新信息重新获得物理区块的更新关系,其中数据更新信息由具有循环关系的多个字符所组成,并且所述字符的个数大于这所述物理区块的个数,其中在每一个物理区块中记录数据更新信息是依据更新关系与循环关系来依序地记录的。

Figure 200710162995

The present invention proposes a data protection method, which is applicable to multiple physical blocks mapped by logical blocks in a non-volatile memory. The data protection method includes: recording data update information in each physical block, the data update information is used to identify the update relationship of data in the physical block; and re-obtaining the update relationship of the physical block based on the data update information, wherein the data update information is composed of multiple characters with a cyclic relationship, and the number of the characters is greater than the number of the physical blocks, wherein the data update information is recorded in each physical block in sequence based on the update relationship and the cyclic relationship.

Figure 200710162995

Description

用于断电时的数据保护方法及使用此方法的控制器Data protection method for power failure and controller using the method

技术领域technical field

本发明涉及一种数据保护方法,且特别是涉及一种用于断电时的数据保护方法及使用此方法的控制器。The invention relates to a data protection method, and in particular to a data protection method used for power failure and a controller using the method.

背景技术Background technique

数字相机、手机相机与MP3在这几年来的成长十分迅速,使得消费者对储存媒体的需求也急速增加,由于闪速存储器(Flash Memory)具有数据非易失性、省电、体积小与无机械结构等的特性,适合便携式应用,最适合使用于这类便携式由电池供电的产品上。除了便携式产品内建存储器需要之外,对于小型存储卡与随身盘等外接式产品来说,每个人可能同时拥有多个随身盘与小型存储卡,所以市场规模比那些设备更大。因此,近年闪速存储器产业成为电子产业中相当热门的一种。The rapid growth of digital cameras, cell phone cameras, and MP3 players over the past few years has led to a rapid increase in consumers' demand for storage media. Because flash memory (Flash Memory) has data non-volatility, power saving, small size and no Features such as mechanical structure are suitable for portable applications, and are most suitable for use in such portable battery-powered products. In addition to the built-in storage needs of portable products, for external products such as small memory cards and flash drives, each person may have multiple flash drives and small memory cards at the same time, so the market size is larger than those devices. Therefore, the flash memory industry has become a very popular type in the electronics industry in recent years.

闪速存储器的管理一般是以区块(block)为单位,倘若在单一逻辑区块对映多个物理区块的情况下并且不正常断电发生在数据进行写入时,则有可能造成数据的不正确或不稳定的现象。也就是说,在重新恢复电力后系统无法辨识原始数据物理区块与新的数据物理区块。Flash memory is generally managed in units of blocks. If a single logical block maps multiple physical blocks and an abnormal power failure occurs when data is being written, it may cause data loss. incorrect or unstable phenomena. That is to say, the system cannot distinguish between the original data physical block and the new data physical block after the power is restored.

为解决上述问题,传统上会在物理区块每一页的冗余区的一个字节中标记相关信息。例如,以3个物理区块对映1个逻辑区块为例,利用闪速存储器每个位可由1变0的特性,在所选定的字节中以分多次写入方式加注不同的标记,例如以FF代表在第一阶段时所记录、将FF改为0F表示在第二阶段时所记录以及将0F改为00表示在第三阶段时所记录。也就是,若此标记为FF时表示是最新的数据、而0F表示次旧的数据并且00表示最旧的数据。To solve the above problems, traditionally, relevant information is marked in one byte of the redundant area of each page of the physical block. For example, taking 3 physical blocks corresponding to 1 logical block as an example, using the feature that each bit of the flash memory can change from 1 to 0, the selected byte is written in multiple times to add different For example, FF means recorded in the first stage, FF is changed to 0F to represent recorded in the second stage, and 0F is changed to 00 to represent recorded in the third stage. That is, if the flag is FF, it means the newest data, while 0F means the second oldest data and 00 means the oldest data.

然而,已知技术存在下述问题。当所使用的存储器为多层存储单元(Multi Level Cell,MLC)与非(NAND)闪速存储器时,由于此类闪速存储器只能写入一次,因此无法使用上述分多次写入的方法来标记。也就是说,在MLC与非闪速存储器的案例中,此标记一经写入后就无法再改变。However, the known technology has the following problems. When the memory used is multi-level memory unit (Multi Level Cell, MLC) and non-(NAND) flash memory, since this type of flash memory can only be written once, it is impossible to use the above method of writing multiple times to mark. That is, in the case of MLC and non-flash memory, once the mark is written, it cannot be changed.

基于此,有必要发展一种数据保护方法,以有效地在断电之后重新区别区块的更新关系。Based on this, it is necessary to develop a data protection method to effectively re-distinguish the update relationship of blocks after a power failure.

发明内容Contents of the invention

本发明提供一种用于非易失性存储器的数据保护方法,有效地在断电之后重新区别新旧数据。The invention provides a data protection method for a non-volatile memory, which can effectively re-distinguish old and new data after power off.

本发明提供一种控制器,其可执行用于非易失性存储器的数据保护方法,其可有效地在断电之后重新区别新旧数据。The present invention provides a controller that can execute a data protection method for a nonvolatile memory, which can effectively re-distinguish old and new data after power off.

本发明提出一种数据保护方法,其适用于非易失性存储器中逻辑区块所对映的多个物理区块,此数据保护方法包括:在每一个物理区块中记录数据更新信息,数据更新信息用以识别物理区块中数据的更新关系;以及依据数据更新信息重新建立物理区块的更新关系,其中数据更新信息是由具有循环关系的多个字符所组成,并且所述字符的个数大于所述物理区块的个数,其中在每一个物理区块中记录数据更新信息是依据更新关系与循环关系来依序地记录。The present invention proposes a data protection method, which is applicable to a plurality of physical blocks corresponding to logical blocks in a non-volatile memory. The data protection method includes: recording data update information in each physical block, data The update information is used to identify the update relationship of the data in the physical block; and re-establish the update relationship of the physical block according to the data update information, wherein the data update information is composed of a plurality of characters with a cyclic relationship, and each of the characters The number is greater than the number of the physical blocks, wherein the data update information recorded in each physical block is recorded sequentially according to the update relationship and the cycle relationship.

在本发明的一实施例中,上述的字符为多个数字或多个文字。In an embodiment of the present invention, the above-mentioned characters are a plurality of numbers or a plurality of characters.

在本发明的一实施例中,上述的重建更新关系包括依据循环关系以来使用的字符的下一个字符来识别包含下一个字符的数据更新信息的物理区块为具有最旧数据的物理区块,并且依据循环关系依序地识别其它物理区块的更新关系。In an embodiment of the present invention, the above-mentioned reconstruction and update relationship includes identifying the physical block containing the data update information of the next character as the physical block with the oldest data according to the next character of the character used since the cyclic relationship, And sequentially identify the update relationship of other physical blocks according to the cycle relationship.

在本发明的一实施例中,上述的重建更新关系包括依据循环关系以未使用的字符的下一个字符来识别包含下一个字符的数据更新信息的物理区块为具有最新数据的物理区块,并且依据循环关系依序地识别其它物理区块的更新关系。In an embodiment of the present invention, the above-mentioned reconstruction and update relationship includes identifying the physical block containing the data update information of the next character as the physical block with the latest data by using the next character of the unused character according to the cyclic relationship, And sequentially identify the update relationship of other physical blocks according to the cycle relationship.

在本发明的一实施例中,上述的在每一个物理区块中记录数据更新信息是将数据更新信息记录在每一个物理区块的冗余区。In an embodiment of the present invention, the aforementioned recording of data update information in each physical block is recording the data update information in a redundant area of each physical block.

在本发明的一实施例中,上述的非易失性存储器为一页只能编程(Program)一次的闪速存储器。In an embodiment of the present invention, the above-mentioned non-volatile memory is a flash memory whose page can only be programmed once.

在本发明的一实施例中,上述的闪速存储器为SLC(Single Level Cell)或MLC(Multi Level Cell)与非(NAND)闪速存储器。In an embodiment of the present invention, the above-mentioned flash memory is SLC (Single Level Cell) or MLC (Multi Level Cell) NAND flash memory.

本发明提供一种数据保护装置,其适用于一非易失性存储器中一逻辑区块所对映的多个物理区块,该数据保护装置包括:A模块,其在每一个所述 物理区块中记录一数据更新信息,该数据更新信息用以识别所述物理区块中数据的更新关系;B模块,其判断所述物理区块之中是否存有无法识别新旧关系的物理区块;以及C模块,其在B模块判断存有无法辨识新旧关系的物理区块时依据所述数据更新信息获得无法辨识新旧关系的物理区块的该更新关系,其中所述数据更新信息由具有一循环关系的多个字符所组成,并且所述字符的个数大于所述物理区块的个数,其中在每一个所述物理区块中记录该数据更新信息的A模块是依据该更新关系与该循环关系来依序地记录。The present invention provides a data protection device, which is suitable for a plurality of physical blocks corresponding to a logical block in a non-volatile memory. The data protection device includes: A module, which is located in each of the physical areas A data update information is recorded in the block, and the data update information is used to identify the update relationship of the data in the physical block; the B module judges whether there is a physical block that cannot identify the old and new relationship among the physical blocks; And the C module, which obtains the update relationship of the physical block whose new-old relationship cannot be identified according to the data update information when the B module judges that there is a physical block whose old-new relationship cannot be identified, wherein the data update information consists of a cycle relationship, and the number of the characters is greater than the number of the physical blocks, wherein the A module that records the data update information in each of the physical blocks is based on the update relationship and the Circular relationship to record sequentially.

本发明提出一种数据保护方法,其可有效地记录一对多区块的数据更新信息并且在不正常断电之后从数据更新信息中获取区块的更新关系,由此避免数据在不正常断电之后遗失。The present invention proposes a data protection method, which can effectively record the data update information of one-to-many blocks and obtain the update relationship of the blocks from the data update information after an abnormal power failure, thereby avoiding Lost after power on.

为使本发明的上述特征和优点能更明显易懂,下文特举较佳实施例,并结合附图详细说明如下。In order to make the above-mentioned features and advantages of the present invention more comprehensible, preferred embodiments are specifically cited below and described in detail with reference to the accompanying drawings.

附图说明Description of drawings

图1A是根据本发明实施例绘示使用非易失性存储器储存装置的主机。FIG. 1A illustrates a host using a non-volatile memory storage device according to an embodiment of the present invention.

图1B示出了图1A所示非易失性存储器储存装置的详细方块图。FIG. 1B shows a detailed block diagram of the non-volatile memory storage device shown in FIG. 1A.

图1C是根据本发明另一实施例绘示控制器的方块图。FIG. 1C is a block diagram illustrating a controller according to another embodiment of the present invention.

图2A与2B是根据本发明实施例绘示非易失性存储器及其运作的详细方块图。2A and 2B are detailed block diagrams illustrating a non-volatile memory and its operation according to an embodiment of the present invention.

图3是根据本发明实施例绘示图1B中页的冗余区R的详细方块图。FIG. 3 is a detailed block diagram illustrating the redundant region R of the page in FIG. 1B according to an embodiment of the present invention.

图4A是根据本发明实施例绘示一个逻辑区块对三个物理区块时数据更 新信息的示意图。4A is a schematic diagram illustrating data update information when one logical block corresponds to three physical blocks according to an embodiment of the present invention.

图4B是根据图4A绘示另一数据更新信息的示意图。FIG. 4B is a schematic diagram illustrating another data update information according to FIG. 4A .

图5是根据本发明第一实施例绘示数据保护方法的流程图。FIG. 5 is a flowchart illustrating a data protection method according to a first embodiment of the present invention.

图6是根据本发明第二实施例绘示数据保护方法的流程图。FIG. 6 is a flowchart illustrating a data protection method according to a second embodiment of the present invention.

图7是绘示本发明实施例的平均磨损方法可应用的装置的示意图。FIG. 7 is a schematic diagram illustrating a device to which the wear leveling method of the embodiment of the present invention is applicable.

附图符号说明Description of reference symbols

100:主机100: Host

102:微处理器102: Microprocessor

104:随机存取存储器104: random access memory

106:输入/输出装置106: Input/Output Device

108:系统总线108: System bus

110:数据传输接口110: data transmission interface

120:非易失性存储器储存装置120: Non-volatile memory storage device

122、122’:控制器122, 122': Controller

122a:存储器管理模块122a: Memory management module

122b:非易失性存储器接口122b: Non-volatile memory interface

122c:主机传输接口122c: host transmission interface

122d:缓冲存储器122d: buffer memory

122e:编程存储器122e: Program memory

122f:错误校正模块122f: Error correction module

122g:电源管理模块122g: power management module

122h:微处理单元122h: Microprocessing unit

124:非易失性存储器124: Non-volatile memory

124-0、124-1、124-2、124-N:区块124-0, 124-1, 124-2, 124-N: blocks

202:系统区202: System area

204:数据区204: data area

206:备用区206: Spare area

208:替换区208: Replacement area

210:瞬时区210: Momentary Zone

M、C、T:区块M, C, T: blocks

302:寻址标记302: Addressing tag

304:更新关系标记304: Update relationship marker

306:区块状态标记306: block status flag

308:其它标记308: Other tags

310:储存系统信息的字节310: bytes for storing system information

320:储存错误校正码(error correcting code)的字节320: Byte to store error correcting code

401:逻辑区块401: logical block

402、403、404:物理区块402, 403, 404: physical blocks

S501、S503、S505、S507、S509:步骤S501, S503, S505, S507, S509: steps

S601、S603、S605、S607、S609:步骤S601, S603, S605, S607, S609: steps

702:USB闪速盘702: USB flash drive

704:数位相机704: Digital camera

704a:SD卡704a: SD card

704b:MMC卡704b: MMC card

704c:CF卡704c: CF card

704d:存储棒704d: memory stick

706:固态硬盘706: SSD

具体实施方式Detailed ways

非易失性存储器储存系统一般而言包括非易失性存储器与控制器(控制芯片)。通常非易失性存储器储存系统会与主机系统一起使用,以使主机系统可将数据写入至非易失性存储器储存系统或从非易失性存储器储存系统中读取数据。另外,亦有非易失性存储器储存系统是包括嵌入式非易失性存储器与可执行于主机系统上以实质地作为此嵌入式闪速存储器的控制器的软件。A non-volatile memory storage system generally includes a non-volatile memory and a controller (control chip). Typically, a non-volatile memory storage system is used with a host system so that the host system can write data to or read data from the non-volatile memory storage system. In addition, there is also a non-volatile memory storage system that includes an embedded non-volatile memory and software executable on a host system that essentially acts as a controller for the embedded flash memory.

图1A是根据本发明实施例绘示使用非易失性存储器储存装置的主机。FIG. 1A illustrates a host using a non-volatile memory storage device according to an embodiment of the present invention.

请参考图1A,主机100一般包括微处理器102、随机存取存储器(randomaccess memory,RAM)104、输入/输出(input/output,I/O)装置106、系统总线108以及数据传输接口110。必须了解的是,主机100可还包括其它组件,例如显示器装置或网络装置等。1A, the host 100 generally includes a microprocessor 102, a random access memory (random access memory, RAM) 104, an input/output (input/output, I/O) device 106, a system bus 108 and a data transmission interface 110. It must be understood that the host 100 may further include other components, such as a display device or a network device.

主机100可以是计算机、数字相机、摄影机、通信装置、音频播放器或 视讯播放器等系统。一般而言,主机100可实质地为可储存数据的任意系统。The host 100 may be a system such as a computer, a digital camera, a camcorder, a communication device, an audio player or a video player. In general, host 100 can be virtually any system that can store data.

在本发明实施例中非易失性存储器储存装置120通过数据传输接口110与主机100的其它组件电连接。通过微处理器102、随机存取存储器104与输入/输出装置106的处理可将数据写入至非易失性存储器储存装置120或从非易失性存储器储存装置120中读取数据。非易失性存储器储存装置120包括随身盘、存储卡或固态硬盘(Solid State Drive,SSD)。In the embodiment of the present invention, the non-volatile memory storage device 120 is electrically connected with other components of the host 100 through the data transmission interface 110 . Through the processing of the microprocessor 102 , the random access memory 104 and the input/output device 106 , data can be written into the non-volatile memory storage device 120 or read from the non-volatile memory storage device 120 . The non-volatile memory storage device 120 includes a pen drive, a memory card or a solid state drive (Solid State Drive, SSD).

图1B示出了图1A所示非易失性存储器储存装置的详细方块图。FIG. 1B shows a detailed block diagram of the non-volatile memory storage device shown in FIG. 1A.

请参考图1B,非易失性存储器储存装置120一般包括控制器122与非易失性存储器124。Please refer to FIG. 1B , the nonvolatile memory storage device 120 generally includes a controller 122 and a nonvolatile memory 124 .

控制器122用以控制非易失性存储器储存装置120的整体运作,例如数据的储存、读取与擦除等。控制器122包括存储器管理模块122a、非易失性存储器接口122b、缓冲存储器122d与微处理单元122h。The controller 122 is used to control the overall operation of the non-volatile memory storage device 120 , such as data storage, reading and erasing. The controller 122 includes a memory management module 122a, a non-volatile memory interface 122b, a buffer memory 122d and a micro-processing unit 122h.

存储器管理模块122a用以管理非易失性存储器124,例如执行平均磨损(wear leveling)方法、坏区块管理、维护对映表(mapping table)等。The memory management module 122a is used for managing the non-volatile memory 124, such as implementing wear leveling (wear leveling) method, bad block management, maintaining mapping table (mapping table) and so on.

非易失性存储器接口122b用以存取非易失性存储器124,也就是主机100要写入至的数据会经由非易失性存储器接口122b转换为非易失性存储器124所能接受的格式。The non-volatile memory interface 122b is used to access the non-volatile memory 124, that is, the data to be written by the host 100 will be converted into a format acceptable to the non-volatile memory 124 through the non-volatile memory interface 122b .

缓冲存储器122d用以暂时地储存系统数据(例如对映表)或者主机所读取或写入的数据。在本实施例中,缓冲存储器122d为静态随机存取存储器(static random access memory,SRAM)。然而,必须了解的是,本发明不限于此,动态随机存取存储器(DRAM)、磁阻式存储器(MRAM)、相变化存储器(PRAM)或其它适合的存储器也可应用于本发明。The buffer memory 122d is used for temporarily storing system data (such as a mapping table) or data read or written by the host. In this embodiment, the buffer memory 122d is a static random access memory (static random access memory, SRAM). However, it must be understood that the present invention is not limited thereto, and dynamic random access memory (DRAM), magnetoresistive memory (MRAM), phase change memory (PRAM) or other suitable memories can also be applied to the present invention.

微处理单元122h用以控制控制器122的整体运作。The micro-processing unit 122h is used to control the overall operation of the controller 122 .

在本发明另一实施例中,请参考图1C,控制器122’还包括主机传输接口122c、编程存储器122e、错误校正模块122f与电源管理模块122g。In another embodiment of the present invention, please refer to FIG. 1C , the controller 122' further includes a host transmission interface 122c, a programming memory 122e, an error correction module 122f and a power management module 122g.

主机传输接口122c用以与主机100通讯,主机传输接口122c可以是USB接口、IEEE 1394接口、SATA接口、PCI Express接口、MS接口、MMC接口、SD卡接口、CF卡接口或IDE接口。Host transmission interface 122c is in order to communicate with host computer 100, and host transmission interface 122c can be USB interface, IEEE 1394 interface, SATA interface, PCI Express interface, MS interface, MMC interface, SD card interface, CF card interface or IDE interface.

编程存储器122e用以储存控制器所执行用以控制非易失性存储器储存装置120的编程代码。The programming memory 122e is used for storing the programming code executed by the controller to control the non-volatile memory storage device 120 .

错误校正模块122f用以计算错误校正码(error correcting code)来 检查与校正主机所读取或写入的数据。The error correction module 122f is used to calculate an error correcting code (error correcting code) to check and correct the data read or written by the host.

电源管理模块122g用以管理非易失性存储器储存装置120的电源。The power management module 122g is used for managing the power of the non-volatile memory storage device 120 .

非易失性存储器124用以储存数据。在本实施中非易失性存储器124为闪速存储器,更具体来说,非易失性存储器124为多层存储单元(Multi LevelCell,MLC)与非(NAND)闪速存储器。但必须了解的是,本发明不限于此,例如非易失性存储器124也可为单层存储单元(Single Level Cell,SLC)与非闪速存储器。The non-volatile memory 124 is used for storing data. In this implementation, the nonvolatile memory 124 is a flash memory, more specifically, the nonvolatile memory 124 is a multi-level memory cell (Multi LevelCell, MLC) and non-volatile (NAND) flash memory. But it must be understood that the present invention is not limited thereto, for example, the non-volatile memory 124 may also be a single-level cell (Single Level Cell, SLC) and a non-flash memory.

非易失性存储器124通常实质上分割为多个物理区块(physical block)124-0至124-N,为方便说明以下将物理区块简称为区块。一般而言,在闪速存储器中区块为擦除的最小单位。亦即,每一区块含有最小数目的一并被擦除的存储单元。每一区块通常会分割为多个页(page)。页通常为编程(program)的最小单元,但要特别说明的是于有些不同的闪速存储器设计,最小的编程单位也可为一个扇区(sector)大小,即一页中有多个扇区并以一扇区为编程的最小单元。换言之,页为写入数据会读取数据的最小单元。每一页通常包括使用者数据区D与冗余区R。使用者数据区用以储存使用者的数据,而冗余区用以储存系统的数据(例如,上述的ECC code)。The non-volatile memory 124 is generally divided into a plurality of physical blocks (physical blocks) 124-0 to 124-N, and the physical blocks are referred to as blocks for convenience below. Generally speaking, a block is the smallest unit of erasing in a flash memory. That is, each block contains a minimum number of memory cells that are erased together. Each block is usually divided into multiple pages. A page is usually the smallest unit of programming, but it should be noted that for some different flash memory designs, the smallest programming unit can also be the size of a sector, that is, there are multiple sectors in a page And a sector is the smallest unit of programming. In other words, a page is the smallest unit from which data is written and data is read. Each page generally includes a user data area D and a redundant area R. The user data area is used to store user data, and the redundant area is used to store system data (for example, the above-mentioned ECC code).

为对应于磁盘驱动器的扇区(sector)大小,一般而言,使用者数据区D通常为512字节,而冗余区R通常为16字节。也就是,一页为一个扇区。然而,也可以多个扇区形成一页,例如一页包括4个扇区。To correspond to the sector size of a disk drive, generally speaking, the user data area D is usually 512 bytes, and the redundancy area R is usually 16 bytes. That is, one page is one sector. However, a plurality of sectors may form one page, for example, one page includes four sectors.

一般而言,区块可由任意数目的页所组成,例如64页、128页、256页等。区块124-0至124-N通常也可被分组为多个区域(zone),以区域来管理存储器某种程度上是彼此独立地操作以增加操作执行的平行程度且简化管理的复杂度。Generally speaking, a block can be composed of any number of pages, such as 64 pages, 128 pages, 256 pages, and so on. The blocks 124 - 0 to 124 -N can also be generally grouped into multiple zones. The zones are used to manage the memory and operate independently of each other to increase the parallelism of operation execution and simplify the management complexity.

以下将根据本发明并结合附图详细说明非易失性存储器的运作。必须了解的是,在以下描述中使用“提取”、“搬移”、“交换”等词来操作闪速存储器区块是逻辑上的概念。也就是说,闪速存储器区块的实际位置并未更动,而是逻辑上对闪速存储器区块进行操作。The operation of the non-volatile memory will be described in detail below according to the present invention and with reference to the accompanying drawings. It must be understood that the use of words like "extract", "move", "swap" in the following descriptions to manipulate flash memory blocks is a logical concept. That is to say, the actual location of the flash memory block is not changed, but the flash memory block is logically operated.

图2A与2B是根据本发明实施例绘示非易失性存储器124及其运作的详细方块图。2A and 2B are detailed block diagrams illustrating the non-volatile memory 124 and its operation according to an embodiment of the present invention.

请参考图2A,在本发明实施例中,为了有效率地编程(即写入与擦除)非易失性存储器124,非易失性存储器124的区块124-1至124-N会在逻辑 上分组为一系统区202、一数据区204与一备用区206。一般来说,非易失性存储器124中属于数据区204的区块会占90%以上,剩下的才是系统区202与备用区206。Please refer to FIG. 2A. In an embodiment of the present invention, in order to efficiently program (ie, write and erase) the nonvolatile memory 124, blocks 124-1 to 124-N of the nonvolatile memory 124 will be It is logically divided into a system area 202, a data area 204 and a spare area 206. Generally speaking, the blocks belonging to the data area 204 in the non-volatile memory 124 account for more than 90%, and the rest are the system area 202 and the spare area 206 .

系统区202中的区块用以记录系统数据,系统数据例如是关于非易失性存储器124的区域数、每一区域的区块数、每一区块的页数、逻辑物理对映表等。The blocks in the system area 202 are used to record system data, such as the number of areas of the non-volatile memory 124, the number of blocks in each area, the number of pages in each block, logical-physical mapping tables, etc. .

数据区204中的区块用以储存使用者的数据,一般来说就是主机100所操作的逻辑区块地址所对应的区块。The blocks in the data area 204 are used to store user data, generally speaking, they are blocks corresponding to logical block addresses operated by the host 100 .

备用区206中的区块是用以替换数据区204中的区块,因此在备用区206中的区块为空或可使用的区块,即无记录数据或标记为已没用的无效数据。具体来说,由于若要对已写过数据位置再次写入数据时,必须先执行擦除的操作。然而,如前所述闪速存储器写入单位为页,而擦除单位为区块。一个擦除的单位大于写入的单位,这表示若要执行区块擦除操作,必须先将要擦除区块中的有效页复制至其它区块后才可进行。因此,当要在数据区204中已写过数据位置的区块M中写入新数据时,一般会在备用区206中提取一区块C,然后将区块M中的有效数据复制至区块C且将新数据写入区块C后,将区块M擦除后搬移至备用区206同时将区块C搬移至数据区204。必须了解的是,将区块M擦除后搬移至备用区206同时将区块C搬移至数据区204是逻辑上将区块M关联于备用区206而将区块C关联于数据区204。其中本领域技术人员皆能了解数据区204中区块的逻辑关系可由逻辑物理对映表来维护。The blocks in the spare area 206 are used to replace the blocks in the data area 204, so the blocks in the spare area 206 are empty or usable blocks, that is, no recorded data or invalid data marked as useless . Specifically, when data is to be written again to an already written data position, an erase operation must be performed first. However, as mentioned above, the writing unit of the flash memory is a page, and the erasing unit is a block. An erasing unit is greater than a writing unit, which means that to perform a block erase operation, the valid pages in the block to be erased must first be copied to other blocks before proceeding. Therefore, when new data is to be written in the block M where the data position has been written in the data area 204, a block C is generally extracted in the spare area 206, and then the valid data in the block M is copied to the spare area 206. After block C and new data is written into block C, block M is erased and moved to the spare area 206 while block C is moved to the data area 204 . It must be understood that moving the block M to the spare area 206 after erasing and moving the block C to the data area 204 is logically associating the block M with the spare area 206 and the block C with the data area 204 . Those skilled in the art can understand that the logical relationship of the blocks in the data area 204 can be maintained by a logical-physical mapping table.

在本发明实施例中,为了更有效率地使用非易失性存储器124,区块124-1至124-N在逻辑上还分为一替换区208与一瞬时区210。In the embodiment of the present invention, in order to use the nonvolatile memory 124 more efficiently, the blocks 124 - 1 to 124 -N are logically divided into a replacement area 208 and a transient area 210 .

请参考图2B,替换区208是用以暂时存放准备替换数据区204的区块的区块。更详细地说,当上述备用区206的区块C被提取来取代数据区204的区块M时,在本发明实施例中会将新数据写入至区块C,但不会立刻将区块M中的有效数据搬移至区块C而擦除区块M。这是因为,区块M中的有效数据有可能在下个操作中变成无效,因此立刻将区块M中的有效数据搬移至物理区块C会造成无谓的搬移。在本发明实施例中,会将写入新数据的区块C暂时地关联为替换区,并且在逻辑区块地址与物理区块地址的对映上会记录多个物理区块地址对应到一个逻辑区块地址的情况,也就是区块M与区块 C的内容整合起来才是所对映逻辑区块的内容,由此提升区块的使用效率。此等母子区块(区块M与区块C)的关系可依据控制器122中缓冲存储器122d的大小而定,在本发明实施例中是以五组来实作。Please refer to FIG. 2B , the replacement area 208 is a block for temporarily storing the block to be replaced in the data area 204 . In more detail, when the block C of the spare area 206 is extracted to replace the block M of the data area 204, new data will be written into the block C in the embodiment of the present invention, but the block C will not be written immediately. Valid data in block M is moved to block C and block M is erased. This is because the valid data in the block M may become invalid in the next operation, so moving the valid data in the block M to the physical block C immediately will cause unnecessary transfer. In the embodiment of the present invention, the block C in which new data is written will be temporarily associated as a replacement area, and multiple physical block addresses corresponding to one In the case of the logical block address, that is, the content of the block M and the block C is integrated to be the content of the corresponding logical block, thereby improving the efficiency of the use of the block. The relationship between these parent and sub-blocks (block M and block C) can be determined according to the size of the buffer memory 122d in the controller 122. In the embodiment of the present invention, five groups are implemented.

瞬时区210的功能与替换区208类似。如上所述,在本发明实施例中是使用MLC NAND闪速存储器。此MLC NAND闪速存储器为多层存储单元,其1页中可包括4个扇区,即1页中有4个512 bytes的扇区,共2048 bytes。如上所述,闪速存储器在写入时是以页为单位,因此在使用MLC NAND闪速存储器的情况下每次必须编程4个扇区,因此当写入不满一页的小量数据时会造成资源的浪费。在本发明实施例中,瞬时区210是用以暂时存放此类小量数据。具体来说,如上所述当要写入替换区208的区块C的数据为不满一页的小量数据时,会从备用区206中提取一区块T,然后将此小量数据写入至区块T并且将区块T关联为瞬时区210。之后,当后续写入的数据量足够写入一页时再将所述数据写入至区块C,然后再将区块T擦除且从瞬时区210中搬移至备用区206。The function of the transient area 210 is similar to that of the replacement area 208 . As mentioned above, MLC NAND flash memory is used in the embodiment of the present invention. This MLC NAND flash memory is a multi-layer storage unit, and one page can include 4 sectors, that is, there are 4 sectors of 512 bytes in one page, a total of 2048 bytes. As mentioned above, flash memory is written in page units, so in the case of using MLC NAND flash memory, 4 sectors must be programmed each time, so when writing a small amount of data that is less than one page, it will cause waste of resources. In the embodiment of the present invention, the transient area 210 is used to temporarily store such a small amount of data. Specifically, as mentioned above, when the data of the block C to be written into the replacement area 208 is a small amount of data less than one page, a block T will be extracted from the spare area 206, and then the small amount of data will be written into to block T and associate block T as the transient region 210 . Afterwards, when the amount of data subsequently written is enough to write one page, the data is written into the block C, and then the block T is erased and moved from the transient area 210 to the spare area 206 .

如上所述,为了避免频繁的擦除区块,会使用区块C与区块T来进行区块M的数据的更新。然而,当非易失性存储器储存装置120运作期间系统处于存有区块M、C与T的瞬时下,倘若发生不正常断电时,则区块M、C与T之间的更新关系将会遗失。具体来说,在非易失性存储器储存装置120运作期间,区块M、C与T的瞬时关系会储存在控制器122的缓冲存储器122d中,当非易失性存储器储存装置120不正常断电时,缓冲存储器122d中的数据将会遗失。因此,在非易失性存储器储存装置120重新恢复电力后,控制器122虽然可从重新建立的逻辑物理对映表中获得区块M、C与T对映同一个逻辑区块的信息,但却无法辨别区块M、C与T的更新关系。As mentioned above, in order to avoid frequently erasing blocks, block C and block T are used to update the data of block M. However, when the system is storing the blocks M, C, and T during the operation of the nonvolatile memory storage device 120, if an abnormal power failure occurs, the update relationship between the blocks M, C, and T will be changed. will be lost. Specifically, during the operation of the non-volatile memory storage device 120, the instantaneous relationship of the blocks M, C and T will be stored in the buffer memory 122d of the controller 122. When the non-volatile memory storage device 120 is abnormally shut down When the power is turned off, the data in the buffer memory 122d will be lost. Therefore, after the power of the non-volatile memory storage device 120 is restored, although the controller 122 can obtain the information that the blocks M, C, and T map to the same logical block from the re-established logical-physical mapping table, the However, it is impossible to distinguish the update relationship of blocks M, C, and T.

为了解决上述的问题,本发明在区块的页的冗余区中标记关于此区块更新关系的信息。图3是根据本发明实施例绘示图1B中页的冗余区R的详细方块图。In order to solve the above problems, the present invention marks the information about the update relationship of the block in the redundant area of the page of the block. FIG. 3 is a detailed block diagram illustrating the redundant region R of the page in FIG. 1B according to an embodiment of the present invention.

如上所述,冗余区R一般为16个字节,其中分为储存系统信息的6个字节310和储存错误校正码(error correcting code)的10个字节320。而储存系统信息的字节310包括寻址标记302、更新关系标记304、区块状态标记306与其它标记308。As mentioned above, the redundant area R is generally 16 bytes, which is divided into 6 bytes 310 for storing system information and 10 bytes 320 for storing error correcting codes. The byte 310 storing system information includes an addressing flag 302 , an update relation flag 304 , a block status flag 306 and other flags 308 .

寻址标记302包括3个字节,其中2个字节用以标记此区块所属的区域 (zone),1个字节用以标记此区块对映的逻辑区块。The address tag 302 includes 3 bytes, wherein 2 bytes are used to mark the area (zone) to which this block belongs, and 1 byte is used to mark the logical block corresponding to this block.

更新关系标记304包括1个字节,其用以在存有区块M、C与T的瞬时关系的状态下标记此区块数据的数据更新信息,而此数据更新信息可表示区块的更新关系(即新旧关系)。The update relationship flag 304 includes 1 byte, which is used to mark the data update information of the block data in the state where the instantaneous relationship between the blocks M, C and T exists, and the data update information can represent the update of the block Relationships (i.e. new and old relationships).

根据本发明,当系统中存有区块M、C与T的瞬时关系时,存储器管理模块122a会在更新关系标记304中记录数据更新信息。数据更新信息是由具有一循环关系的多个字符所组成,并且所述字符的个数是大于组成此瞬时关系的区块的个数,也就是说,倘若组成此瞬时关系的区块有n个时,则表示数据更新信息的字符必须至少有n+1个。此外,在每一个物理区块中记录数据更新信息是依据区块的更新关系与字符的循环关系来依序地记录。According to the present invention, when the instantaneous relationship between the blocks M, C and T exists in the system, the memory management module 122a will record data update information in the update relationship flag 304 . The data update information is composed of a plurality of characters having a cyclic relationship, and the number of characters is greater than the number of blocks forming the instant relationship, that is, if there are n blocks forming the instant relationship When there are at least n+1 characters representing data update information. In addition, the data update information recorded in each physical block is recorded sequentially according to the update relationship of the block and the cyclic relationship of characters.

图4A是根据本发明实施例绘示一个逻辑区块对三个物理区块时数据更新信息的示意图。FIG. 4A is a schematic diagram illustrating data update information when one logical block corresponds to three physical blocks according to an embodiment of the present invention.

请参考图4A,逻辑区块401对映物理区块402、403与404。其中物理区块402存有最旧的数据,物理区块403存有次旧的数据,并且物理区块404存有最新的数据。Please refer to FIG. 4A , the logical block 401 maps to the physical blocks 402 , 403 and 404 . The physical block 402 stores the oldest data, the physical block 403 stores the second-oldest data, and the physical block 404 stores the newest data.

在图4A中是以循环数字0-3作为表示数据更新信息的字符。假设物理区块402的更新关系标记为0时,当有较新的物理区块产生时物理区块403的更新关系会被标记为1且当再有更新的物理区块404产生时,物理区块404的更新关系会被标记为2。在非易失性存储器储存装置120不正常断电之后控制器122可依据数据更新信息识别未使用的字符为3,而0-3的循环中字符3的下一个字符为0,因此具有最旧数据的区块为物理区块402,并且依此循环识别物理区块403存有次旧的数据,并且识别物理区块404存有最新的数据。In FIG. 4A, cyclic numbers 0-3 are used as characters representing data update information. Assuming that the update relation of the physical block 402 is marked as 0, when a newer physical block is generated, the update relation of the physical block 403 will be marked as 1 and when an updated physical block 404 is generated, the physical block The update relation of block 404 will be marked as 2. After the non-volatile memory storage device 120 is abnormally powered off, the controller 122 can identify the unused character as 3 according to the data update information, and the next character of character 3 in the cycle of 0-3 is 0, so it has the oldest The block of data is the physical block 402 , and according to this cycle, it is identified that the physical block 403 stores the second oldest data, and the physical block 404 stores the latest data.

图4B是根据图4A绘示另一数据更新信息的示意图。FIG. 4B is a schematic diagram illustrating another data update information according to FIG. 4A .

请参考图4B,同样是以循环数字0-3作为表示数据更新信息的字符。假设物理区块402的更新关系标记为2时,当有较新的物理区块产生时物理区块403的更新关系会被标记为3且当再有更新的物理区块404产生时,物理区块404的更新关系会被标记为0。在非易失性存储器储存装置120不正常断电之后控制器122可依据数据更新信息识别未使用的字符为1,而0-3的循环中字符1的下一个字符为2,因此具有最旧数据的区块为物理区块402,并且依此循环识别物理区块403存有次旧的数据,并且识别物理区块 404存有最新的数据。Please refer to FIG. 4B , which also uses cyclic numbers 0-3 as characters representing data update information. Assuming that the update relation of the physical block 402 is marked as 2, when a newer physical block is generated, the update relation of the physical block 403 will be marked as 3 and when an updated physical block 404 is generated, the physical block The update relation of block 404 will be marked as 0. After the non-volatile memory storage device 120 is abnormally powered off, the controller 122 can identify the unused character as 1 according to the data update information, and the next character of character 1 in the cycle of 0-3 is 2, so it has the oldest The block of data is the physical block 402, and according to this, it is cyclically identified that the physical block 403 has the second oldest data, and the physical block 404 is identified that the latest data is stored.

本实施例是以数字作为数据更新信息,然而,本发明不限于此,其它符号也可应用于本发明,例如使用具循环关系的文字(例如A、B、C、D…)。In this embodiment, numbers are used as data to update information. However, the present invention is not limited thereto, and other symbols can also be applied to the present invention, such as using letters with a circular relationship (such as A, B, C, D . . . ).

在本实施例中是以数据更新信息中未使用字符的下一个字符作为标示具最旧数据的区块,然而,在本发另一实施例中是将数据更新信息中未使用字符的下一个字符作为标示具最新数据的区块。In this embodiment, the next character of the unused character in the data update information is used as the block with the oldest data. However, in another embodiment of the present invention, the next character of the unused character in the data update information is character as a block with the latest data.

请在参考图3,区块状态标记306包括1个字节,其用以标记此区块是否为正常区块或损坏区块。Please refer to FIG. 3 , the block status flag 306 includes 1 byte, which is used to mark whether the block is a normal block or a damaged block.

其它标记308包括1个字节,其用以标记其它系统信息。Other Flags 308 includes 1 byte, which is used to flag other system information.

本实施例是以16个字节的冗余区及其字节配置来解释本发明。但必需了解的是,本发明不限于此,其它字节数目的冗余区或其它字节配置方式也可适用于本发明。This embodiment explains the present invention by using a 16-byte redundant area and its byte configuration. However, it must be understood that the present invention is not limited thereto, and redundant regions with other numbers of bytes or other byte configurations are also applicable to the present invention.

图5是根据本发明第一实施例绘示数据保护方法的流程图,其是由控制器122的存储器管理模块122a来执行,以在不正常断电之后重新获取上述瞬时区块M、C与T之间的关系。FIG. 5 is a flow chart illustrating a data protection method according to the first embodiment of the present invention, which is executed by the memory management module 122a of the controller 122 to re-acquire the above-mentioned instantaneous blocks M, C, and The relationship between T.

请参考图5,数据保护方法分为两个部分,在图5的(a)中步骤S501会在发生一对多(即1个逻辑区块对映多个物理区块)的每一个物理区块中记录一数据更新信息。数据更新信息的组成与方式已详细描述如前,在此不再赘述。Please refer to Figure 5. The data protection method is divided into two parts. In Figure 5 (a), step S501 will generate one-to-many (that is, one logical block corresponds to multiple physical blocks) in each physical area A data update information is recorded in the block. The composition and manner of the data update information have been described in detail above, and will not be repeated here.

在图5的(b)中,当发生不正常断电后,会判断逻辑物理对映表中是否存有无法识别新旧关系的多个物理区块(步骤S503)。倘若在步骤S503中判断具有无法辨识的物理区块时,则在步骤S505中从所述物理区块的页的冗余区中读取更新关系标记。之后,在步骤S507中依据从更新关系标记中所读取数据更新信息的字符来判断具有最旧(或最新)数据的区块。判断最旧(或最新)数据的区块的方式以结合图4A与图4B描述如前,在此不再赘述。之后,在步骤S509中依数据更新信息的循环关系识别其它无法辨识的物理区块的更新关系。In (b) of FIG. 5 , when an abnormal power failure occurs, it is judged whether there are multiple physical blocks whose relationship between old and new cannot be identified in the logical-physical mapping table (step S503 ). If it is determined in step S503 that there is an unidentifiable physical block, then in step S505 the update relation flag is read from the redundant area of the page of the physical block. Afterwards, in step S507, the block with the oldest (or newest) data is determined according to the character of the data update information read from the update relation tag. The manner of determining the block with the oldest (or newest) data is described above in conjunction with FIG. 4A and FIG. 4B , and will not be repeated here. Afterwards, in step S509 , the update relationship of other unidentifiable physical blocks is identified according to the cycle relationship of the data update information.

图6是根据本发明第二实施例绘示数据保护方法的流程图。执行第二实施例的数据保护方法的控制器硬件结构是相同于第一实施例,在此不再重复说明。FIG. 6 is a flowchart illustrating a data protection method according to a second embodiment of the present invention. The hardware structure of the controller implementing the data protection method of the second embodiment is the same as that of the first embodiment, and will not be repeated here.

请参考图6,数据保护方法也是分为两个部分,在图6的(a)中步骤S601 会在物理区块写入数据同时对发生一对多(即1个逻辑区块对映多个物理区块)的每一个物理区块中记录一数据更新信息。数据更新信息的组成与方式已详细描述如前,在此不再赘述。Please refer to Figure 6. The data protection method is also divided into two parts. In Figure 6 (a), step S601 will write data in the physical block and generate one-to-many at the same time (that is, one logical block corresponds to multiple A piece of data update information is recorded in each physical block. The composition and manner of the data update information have been described in detail above, and will not be repeated here.

在本发明另一实施例中,物理区块中的数据更新信息只可以写入一次。也就是说,在一页只能编程(Program)一次的闪速存储器的案例中,数据只可以写入一次,当必须再编程时必须先擦除后才能再编程。In another embodiment of the present invention, the data update information in the physical block can only be written once. That is to say, in the case of a flash memory that can only be programmed once, the data can only be written once, and when it must be reprogrammed, it must be erased before reprogramming.

在图6的(b)中,当发生不正常断电后,会判断逻辑物理对映表中是否存有无法识别新旧关系的多个物理区块(步骤S603)。倘若在步骤S603中判断具有无法辨识的物理区块时,则在步骤S605中从所述物理区块的页的冗余区中读取更新关系标记。之后,在步骤S607中依据从更新关系标记中所读取数据更新信息的多个循环字符来判断具有最旧(或最新)数据的区块,例如,循环字符的个数介于3-5。判断最旧(或最新)数据的区块的方式已配合图4A与图4B描述如前,在此不再赘述。之后,在步骤S609中依数据更新信息的循环字符识别其它无法辨识的物理区块的更新关系。In (b) of FIG. 6 , when an abnormal power failure occurs, it is determined whether there are multiple physical blocks whose relationship between the old and the new cannot be identified in the logical-physical mapping table (step S603 ). If it is determined in step S603 that there is an unidentifiable physical block, then in step S605 the update relation flag is read from the redundant area of the page of the physical block. Afterwards, in step S607, the block with the oldest (or newest) data is determined according to the number of cyclic characters of the data update information read from the update relation tag, for example, the number of cyclic characters is between 3-5. The manner of determining the block with the oldest (or newest) data has been described above with reference to FIG. 4A and FIG. 4B , and will not be repeated here. Afterwards, in step S609, the update relationship of other unidentifiable physical blocks is identified according to the cycle character of the data update information.

在根据本发明所提出的数据保护方法是适用于非易失性存储器,因此本发明所提出的数据保护方法可应用各种以非易失性存储器作为储存媒体的装置。例如图7所示的USB闪速盘702、数字相机(摄影机)704所使用的SD卡704a、MMC卡704b、CF卡704c与存储棒(memory stick)704d以及固态硬盘706等。The data protection method proposed by the present invention is suitable for non-volatile memory, so the data protection method proposed by the present invention can be applied to various devices using non-volatile memory as storage media. For example, the SD card 704a, the MMC card 704b, the CF card 704c, the memory stick (memory stick) 704d and the solid state hard drive 706 etc. used by the USB flash disk 702 shown in Figure 7, digital camera (video camera) 704.

综上所述,本发明所提出用于非易失性存储器的数据保护方法可有效地在不正常断电后获取一对多区块的更新关系。由此,避免不正常断电后数据的遗失。To sum up, the data protection method for non-volatile memory proposed by the present invention can effectively obtain the update relationship of one-to-many blocks after abnormal power failure. Thus, data loss after an abnormal power failure is avoided.

虽然本发明已以较佳实施例披露如上,然其并非用以限定本发明,本领域技术人员,在不脱离本发明的精神和范围的前提下,当可作若干的更改与修饰,因此本发明的保护范围应以本发明的权利要求为准。Although the present invention has been disclosed above with preferred embodiments, it is not intended to limit the present invention. Those skilled in the art can make some changes and modifications without departing from the spirit and scope of the present invention. The scope of protection of the invention should be based on the claims of the present invention.

Claims (14)

1.一种数据保护方法,其适用于一非易失性存储器中一逻辑区块所对映的多个物理区块,该数据保护方法包括:1. A data protection method, which is applicable to a plurality of physical blocks mapped to a logical block in a nonvolatile memory, the data protection method comprising: 在每一个所述物理区块中记录一数据更新信息,该数据更新信息用以识别所述物理区块中数据的更新关系;Recording a piece of data update information in each of the physical blocks, the data update information is used to identify the update relationship of data in the physical block; 判断所述物理区块之中是否存有无法识别新旧关系的物理区块;以及judging whether there is a physical block whose old-new relationship cannot be identified among the physical blocks; and 当判断存有无法辨识新旧关系的物理区块时依据所述数据更新信息获得无法辨识新旧关系的物理区块的该更新关系,When it is judged that there is a physical block whose old-new relationship cannot be identified, the update relationship of the physical block whose old-new relationship cannot be identified is obtained according to the data update information, 其中所述数据更新信息由具有一循环关系的多个字符所组成,并且所述字符的个数大于所述物理区块的个数,Wherein the data update information is composed of a plurality of characters having a cyclic relationship, and the number of the characters is greater than the number of the physical blocks, 其中在每一个所述物理区块中记录该数据更新信息是依据该更新关系与该循环关系来依序地记录。The data update information recorded in each of the physical blocks is recorded sequentially according to the update relationship and the cycle relationship. 2.如权利要求1所述的数据保护方法,其中所述字符为多个数字或多个文字。2. The data protection method according to claim 1, wherein the characters are a plurality of numbers or a plurality of characters. 3.如权利要求1所述的数据保护方法,其中获得该更新关系包括依据该循环关系以未使用的所述字符的下一个字符来识别包含该下一个字符的该数据更新信息的物理区块为具有最旧数据的物理区块,并且依据该循环关系依序地识别其它所述物理区块的该更新关系。3. The data protection method according to claim 1, wherein obtaining the update relationship comprises identifying the physical block containing the data update information of the next character with the next character of the unused character according to the cyclic relationship is the physical block with the oldest data, and sequentially identify the update relationship of the other physical blocks according to the cycle relationship. 4.如权利要求1所述的数据保护方法,其中获得该更新关系包括依据该循环关系以未使用的所述字符的下一个字符来识别包含该下一个字符的该数据更新信息的物理区块为具有最新数据的物理区块,并且依据该循环关系依序地识别其它所述物理区块的该更新关系。4. The data protection method according to claim 1, wherein obtaining the update relationship comprises identifying the physical block containing the data update information of the next character with the next character of the unused character according to the cyclic relationship It is the physical block with the latest data, and the updating relationship of the other physical blocks is sequentially identified according to the cyclic relationship. 5.如权利要求1所述的数据保护方法,其中在每一个所述物理区块中记录该数据更新信息是将该数据更新信息记录在每一个所述物理区块的一冗余区。5. The data protection method according to claim 1, wherein recording the data update information in each of the physical blocks is recording the data update information in a redundant area of each of the physical blocks. 6.如权利要求1所述的数据保护方法,其中该非易失性存储器为一页只能编程一次的闪速存储器。6. The data protection method as claimed in claim 1, wherein the non-volatile memory is a flash memory whose page can only be programmed once. 7.如权利要求6所述的数据保护方法,其中该闪速存储器为一SLC与非闪速存储器或一MLC与非闪速存储器。7. The data protection method as claimed in claim 6, wherein the flash memory is an SLC and non-flash memory or an MLC and non-flash memory. 8.一种数据保护装置,其适用于一非易失性存储器中一逻辑区块所对映的多个物理区块,该数据保护装置包括:8. A data protection device, which is applicable to a plurality of physical blocks corresponding to a logical block in a non-volatile memory, the data protection device comprising: A模块,其在每一个所述物理区块中记录一数据更新信息,该数据更新信息用以识别所述物理区块中数据的更新关系;A module, which records a data update information in each of the physical blocks, and the data update information is used to identify the update relationship of the data in the physical blocks; B模块,其判断所述物理区块之中是否存有无法识别新旧关系的物理区块;以及B module, which judges whether there is a physical block that cannot identify the old and new relationship among the physical blocks; and C模块,其在B模块判断存有无法辨识新旧关系的物理区块时依据所述数据更新信息获得无法辨识新旧关系的物理区块的该更新关系,C module, which obtains the update relationship of the physical block whose new-old relationship cannot be identified according to the data update information when the B module judges that there is a physical block whose new-old relationship cannot be identified, 其中所述数据更新信息由具有一循环关系的多个字符所组成,并且所述字符的个数大于所述物理区块的个数,Wherein the data update information is composed of a plurality of characters having a cyclic relationship, and the number of the characters is greater than the number of the physical blocks, 其中在每一个所述物理区块中记录该数据更新信息的A模块是依据该更新关系与该循环关系来依序地记录。The A modules recording the data update information in each of the physical blocks are recorded sequentially according to the update relationship and the cycle relationship. 9.如权利要求8所述的数据保护装置,其中所述字符为多个数字或多个文字。9. The data protection device according to claim 8, wherein the characters are a plurality of numbers or a plurality of letters. 10.如权利要求8所述的数据保护装置,其中获得该更新关系的C模块依据该循环关系以未使用的所述字符的下一个字符来识别包含该下一个字符的该数据更新信息的物理区块为具有最旧数据的物理区块,并且依据该循环关系依序地识别其它所述物理区块的该更新关系。10. The data protection device as claimed in claim 8, wherein the C module for obtaining the update relationship identifies the physical address of the data update information containing the next character with the next character of the unused character according to the cyclic relationship. The block is the physical block with the oldest data, and the updating relationship of other said physical blocks is sequentially identified according to the circular relationship. 11.如权利要求8所述的数据保护装置,其中获得该更新关系的C模块依据该循环关系以未使用的所述字符的下一个字符来识别包含该下一个字符的该数据更新信息的物理区块为具有最新数据的物理区块,并且依据该循环关系依序地识别其它所述物理区块的该更新关系。11. The data protection device as claimed in claim 8, wherein the C module for obtaining the update relation identifies the physical character of the data update information comprising the next character with the next character of the unused character according to the cyclic relation. A block is a physical block with the latest data, and the updating relationship of other said physical blocks is sequentially identified according to the cyclic relationship. 12.如权利要求8所述的数据保护装置,其中在每一个所述物理区块中记录该数据更新信息的A模块将该数据更新信息记录在每一个所述物理区块的一冗余区。12. The data protection device as claimed in claim 8, wherein the A module that records the data update information in each of the physical blocks records the data update information in a redundant area of each of the physical blocks . 13.如权利要求8所述的数据保护装置,其中该非易失性存储器为一页只能编程一次的闪速存储器。13. The data protection device as claimed in claim 8, wherein the non-volatile memory is a flash memory whose page can only be programmed once. 14.如权利要求13所述的数据保护装置,其中该闪速存储器为一SLC与非闪速存储器或一MLC与非闪速存储器。14. The data protection device of claim 13, wherein the flash memory is an SLC and non-flash memory or an MLC and non-flash memory.
CN2007101629951A 2007-10-09 2007-10-09 Data protection method for power failure and controller using the method Active CN101408864B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2007101629951A CN101408864B (en) 2007-10-09 2007-10-09 Data protection method for power failure and controller using the method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2007101629951A CN101408864B (en) 2007-10-09 2007-10-09 Data protection method for power failure and controller using the method

Publications (2)

Publication Number Publication Date
CN101408864A CN101408864A (en) 2009-04-15
CN101408864B true CN101408864B (en) 2011-08-24

Family

ID=40571884

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2007101629951A Active CN101408864B (en) 2007-10-09 2007-10-09 Data protection method for power failure and controller using the method

Country Status (1)

Country Link
CN (1) CN101408864B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102110121B (en) * 2009-12-24 2015-09-23 阿里巴巴集团控股有限公司 A kind of data processing method and system thereof
CN102375779B (en) * 2010-08-16 2015-08-19 深圳市朗科科技股份有限公司 A kind of data processing method and data processing module
CN103678162B (en) * 2012-09-12 2020-02-28 群联电子股份有限公司 System data storage method, memory controller and memory storage device
TWI520153B (en) * 2013-11-05 2016-02-01 威盛電子股份有限公司 Non-volatile memory device and operation method thereof
CN105630404A (en) * 2015-04-02 2016-06-01 上海磁宇信息科技有限公司 Solid-state drive using MRAM and read-write method
CN105630704A (en) * 2015-06-10 2016-06-01 上海磁宇信息科技有限公司 Storage device and read-write method applying block-based logic physical address comparison table
CN105608016B (en) * 2015-08-05 2018-11-23 上海磁宇信息科技有限公司 Solid state hard disk of the DRAM in conjunction with MRAM and the storage card using MRAM
CN107092563B (en) * 2017-04-20 2021-02-26 新华三信息技术有限公司 Method and device for recycling garbage

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1290014A (en) * 1999-09-29 2001-04-04 三星电子株式会社 Flash memory and control method
CN1567256A (en) * 2003-06-20 2005-01-19 深圳市朗科科技有限公司 Protection method for data in flash memory media

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1290014A (en) * 1999-09-29 2001-04-04 三星电子株式会社 Flash memory and control method
CN1567256A (en) * 2003-06-20 2005-01-19 深圳市朗科科技有限公司 Protection method for data in flash memory media

Also Published As

Publication number Publication date
CN101408864A (en) 2009-04-15

Similar Documents

Publication Publication Date Title
US8037232B2 (en) Data protection method for power failure and controller using the same
US8775771B2 (en) Block management method for a flash memory and flash memory controller and storage system using the same
US9037782B2 (en) Method of programming memory cells and reading data, memory controller and memory storage apparatus using the same
US20180260317A1 (en) Method for managing the copying and storing of data in garbage collection, memory storage device and memory control circuit unit using the same
US10037153B2 (en) Memory device, electronic system, and methods associated with modifying data and a file of a memory device
US8055873B2 (en) Data writing method for flash memory, and controller and system using the same
US8516184B2 (en) Data updating using mark count threshold in non-volatile memory
CN101408864B (en) Data protection method for power failure and controller using the method
CN104750625A (en) Data storage device and flash memory control method
CN102157202B (en) Method and Controller for Preventing Read Disturbance from Non-Volatile Memory
US9268688B2 (en) Data management method, memory controller and memory storage apparatus
CN106557432B (en) Buffer memory management method, memory control circuit unit and storage device
TW201712549A (en) Buffer memory management method, memory control circuit unit and memory storage device
CN101419834B (en) Wear Averaging Method and Controller Using It
CN101414282B (en) Wear Averaging Method and Controller Using It
US8607123B2 (en) Control circuit capable of identifying error data in flash memory and storage system and method thereof
US9383929B2 (en) Data storing method and memory controller and memory storage device using the same
CN101425338B (en) Writing method of non-volatile memory and controller using this method
CN102890655A (en) Memory storage device, its memory controller and effective data identification method
TW201303584A (en) Memory storage device, memory controller thereof, and method for identifying valid data
CN102567221B (en) Data management method, memory controller and memory storage device
CN101409108B (en) Wear Averaging Method and Controller Using It
JP2012068765A (en) Memory controller, flash memory system with memory controller, and control method of flash memory
CN102779551B (en) Data writing method, memory controller and memory storage device
JP4000124B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM PROVIDED WITH MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant