CN101727397B - Block management and replacement method, flash memory storage system and controller thereof - Google Patents
Block management and replacement method, flash memory storage system and controller thereof Download PDFInfo
- Publication number
- CN101727397B CN101727397B CN2008101690831A CN200810169083A CN101727397B CN 101727397 B CN101727397 B CN 101727397B CN 2008101690831 A CN2008101690831 A CN 2008101690831A CN 200810169083 A CN200810169083 A CN 200810169083A CN 101727397 B CN101727397 B CN 101727397B
- Authority
- CN
- China
- Prior art keywords
- physical
- area
- block
- flash memory
- unit
- 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
Links
- 230000005055 memory storage Effects 0.000 title claims abstract description 53
- 238000000034 method Methods 0.000 title claims abstract description 27
- 239000007787 solid Substances 0.000 claims description 5
- 230000002035 prolonged effect Effects 0.000 abstract 1
- 238000007726 management method Methods 0.000 description 41
- 238000013507 mapping Methods 0.000 description 15
- 238000010586 diagram Methods 0.000 description 11
- 230000006870 function Effects 0.000 description 5
- 230000008859 change Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 238000013461 design Methods 0.000 description 2
- 238000012423 maintenance Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 230000001052 transient effect Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Landscapes
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
Description
技术领域 technical field
本发明涉及一种用于闪存的区块管理与更换方法以及使用此方法的闪存储存系统及其控制器,特别是涉及一种用于具有多区块面的闪存芯片的区块管理与更换方法以及使用此方法的闪存储存系统及其控制器。The present invention relates to a block management and replacement method for flash memory and a flash memory storage system using the method and its controller, in particular to a block management and replacement method for flash memory chips with multiple block faces And a flash memory storage system and its controller using this method.
背景技术 Background technique
数字相机、手机相机与MP3在这几年来的成长十分迅速,使得消费者对储存媒体的需求也急速增加。由于闪存(Flash Memory)具有数据非挥发性、省电、体积小与无机械结构等的特性,适合便携式应用,最适合使用于这类便携式由电池供电的产品上。固态硬盘就是一种以NAND闪存作为储存媒体的储存装置。The rapid growth of digital cameras, cell phone cameras, and MP3 players has led to a rapid increase in consumer demand for storage media. Because flash memory (Flash Memory) has the characteristics of data non-volatility, power saving, small size and no mechanical structure, it is suitable for portable applications and is most suitable for such portable battery-powered products. A solid state drive is a storage device that uses NAND flash memory as a storage medium.
一般来说,闪存储存系统的闪存芯片(chip)中的闪存晶粒(die)会划分为多个物理单元(physical unit),这些物理单元是一般可由一个物理区块或多个物理区块所组成。这些物理单元会界定为数据区(data area)与备用区(sparearea)。归类为数据区的物理单元中会储存由写入指令所写入的有效数据,而备用区中的物理单元是用以在执行写入指令时替换数据区中的物理单元。具体来说,当闪存储存系统接受到主机系统的写入指令而欲对数据区的物理单元进行写入时,闪存储存系统会从备用区中提取物理单元并且将在数据区中欲更新的物理单元中的有效旧数据与欲写入的新数据写入至从备用区中提取的物理单元并且将已写入新数据的物理单元关联为数据区,并且将原本数据区的物理单元进行擦除并关联为备用区。为了能够让主机系统能够顺利地存取以轮替方式储存数据的物理单元,闪存储存系统会配置逻辑单元以供主机系统进行存取,其中逻辑单元是根据物理单元以一个或多个物理区块的大小来配置。也就是说,闪存储存系统会建立逻辑-物理地址对映表(logical-physical address mapping table),并且在此表中记录与更新逻辑单元与数据区的物理单元之间的对映关系来反映物理单元的轮替,所以主机系统仅需要针对所提供逻辑单元进行存取而闪存储存系统会依据逻辑-物理地址对映表来对所对映的物理单元进行读取或写入数据。Generally speaking, the flash memory die in the flash memory chip (chip) of the flash memory storage system will be divided into multiple physical units (physical units), and these physical units can generally be divided into one physical block or multiple physical blocks. composition. These physical units are defined as a data area and a spare area. Valid data written by the write command is stored in the physical units classified as the data area, and the physical units in the spare area are used to replace the physical units in the data area when the write command is executed. Specifically, when the flash storage system receives a write command from the host system and intends to write the physical unit in the data area, the flash storage system will extract the physical unit from the spare area and write the physical unit to be updated in the data area. Write the valid old data in the unit and the new data to be written to the physical unit extracted from the spare area and associate the physical unit with the new data written into the data area, and erase the physical unit in the original data area And associate it as a spare area. In order to allow the host system to smoothly access the physical units that store data in a rotating manner, the flash memory storage system will configure logical units for the host system to access, wherein the logical units are divided into one or more physical blocks according to the physical units to configure the size. That is to say, the flash memory storage system will establish a logical-physical address mapping table (logical-physical address mapping table), and record and update the mapping relationship between the logical unit and the physical unit of the data area in this table to reflect the physical Unit rotation, so the host system only needs to access the provided logical unit, and the flash memory storage system will read or write data to the corresponding physical unit according to the logical-physical address mapping table.
此外,一般闪存芯片(chip)中会保留部分的物理单元作为一替代区,其是用以当数据区或备用区中的物理单元损坏时取代损坏的物理单元来继续运作。特别是,在具多区块面的闪存芯片为了能够利用提升存取速度,一般会以属于不同区块面且能够执行多区块面存取指令(multi-planes accessingcommand)的多个物理区块所组成的物理单元来进行存取。在此例子中,倘若物理单元内的其中一个物理区块损坏时,闪存储存系统会以整个物理单元为单位来更换损坏的物理单元以使其能够继续以多区块面存取指令来进行存取。此更换的动作可被执行直到替代区无可用的物理单元可来取代损坏的物理单元为止,并且此时闪存储存系统就会被宣告损毁而无法再继续使用。In addition, a part of the physical unit in the general flash memory chip (chip) is reserved as a replacement area, which is used to replace the damaged physical unit to continue operation when the physical unit in the data area or the spare area is damaged. In particular, in order to be able to use the flash memory chip with multiple block planes to improve the access speed, it generally uses multiple physical blocks belonging to different block planes and capable of executing multi-planes accessing commands. composed of physical units for access. In this example, if one of the physical blocks in the physical unit is damaged, the flash storage system will replace the damaged physical unit in units of the entire physical unit so that it can continue to store with multi-block plane access commands. Pick. This replacement operation can be performed until there is no available physical unit in the replacement area to replace the damaged physical unit, and at this time the flash memory storage system will be declared damaged and cannot be used anymore.
然而,事实上被替换的损坏物理单元中仍有未损坏的物理区块,因此以上述方式执行区块的管理与更换会导致闪存储存系统的可储存空间的浪费,并且会缩短闪存储存系统的寿命。However, in fact, there are still undamaged physical blocks in the replaced damaged physical unit, so performing block management and replacement in the above-mentioned manner will result in a waste of the storable space of the flash memory storage system and shorten the lifetime of the flash memory storage system. life.
发明内容 Contents of the invention
有鉴于此,本发明提供一种区块管理与更换方法,其能够提升闪存储存系统的数据写入效率并且延长闪存储存系统的寿命。In view of this, the present invention provides a block management and replacement method, which can improve the data writing efficiency of the flash memory storage system and prolong the life of the flash memory storage system.
此外,本发明提供一种控制器,其使用上述区块管理与更换方法来管理闪存芯片,其能够提升闪存储存系统的数据写入效率并且延长闪存储存系统的寿命。In addition, the present invention provides a controller, which uses the above-mentioned block management and replacement method to manage flash memory chips, which can improve the data writing efficiency of the flash memory storage system and prolong the life of the flash memory storage system.
再者,本发明提供一种储存系统,其使用上述区块管理与更换方法来管理闪存芯片,其能够提升闪存储存系统的数据写入效率并且延长闪存储存系统的寿命。Furthermore, the present invention provides a storage system, which uses the above-mentioned block management and replacement method to manage flash memory chips, which can improve the data writing efficiency of the flash memory storage system and prolong the life of the flash memory storage system.
本发明提出一种区块管理与更换方法,适用于闪存储存系统,其中此闪存储存系统具有多个物理区块,此区块管理与更换方法包括将物理区块划分为多个物理单元并且分组为使用区与替代区,其中每一物理单位中的物理区块可藉由使用多区块面存取(multi-planes accessing)指令来存取。此区块管理与更换方法也包括当属于使用区的物理单元内的其中一个物理区块损坏时,判断替代区中未损坏的物理单元的数目是否大于一预定阈值,其中当替代区中未损坏的物理单元的数目大于此预定阈值时,则从替代区中选择未损坏的物理单元以物理单元为单位来取代一般区中具损坏的物理区块的物理单元并且记录被取代的物理单元中未损坏或损坏的物理区块。并且,当替代区中未损坏的物理单元的数目不大于此预定阈值时,则从替代区中选择未损坏的物理区块以物理区块为单位来取代损坏的物理区块。The present invention proposes a block management and replacement method, which is suitable for flash memory storage systems, wherein the flash memory storage system has multiple physical blocks, and the block management and replacement method includes dividing the physical blocks into multiple physical units and grouping For the use area and replacement area, the physical blocks in each physical unit can be accessed by using multi-planes accessing commands. This block management and replacement method also includes when one of the physical blocks in the physical unit belonging to the use area is damaged, judging whether the number of undamaged physical units in the replacement area is greater than a predetermined threshold, wherein when there is no damage in the replacement area When the number of physical units in the general area is greater than the predetermined threshold, an undamaged physical unit is selected from the replacement area to replace a physical unit with a damaged physical block in the general area in units of physical units, and records are not included in the replaced physical unit. Damaged or damaged physical blocks. Moreover, when the number of undamaged physical units in the replacement area is not greater than the predetermined threshold, an undamaged physical block is selected from the replacement area to replace the damaged physical block in units of physical blocks.
在本发明的一实施例中,上述的区块管理与更换方法还包括将使用区区分为数据区与备用区,其中属于备用区的物理单元用以与属于数据区的物理单元轮替地储存数据。In an embodiment of the present invention, the above-mentioned block management and replacement method further includes dividing the used area into a data area and a spare area, wherein the physical units belonging to the spare area are used to alternately store the physical units belonging to the data area data.
在本发明的一实施例中,上述的每一物理区块具有一冗余区,并且上述记录被取代的物理单元中未损坏的物理区块的步骤包括在未损坏的物理区块的冗余区中记录一标记。In an embodiment of the present invention, each of the above physical blocks has a redundant area, and the step of recording the undamaged physical blocks in the replaced physical unit includes redundancy in the undamaged physical blocks A mark is recorded in the area.
在本发明的一实施例中,上述的记录被取代的物理单元中未损坏的所述物理区块的步骤包括在一更换表中记录未损坏的物理区块。In an embodiment of the present invention, the step of recording the undamaged physical blocks in the replaced physical unit includes recording the undamaged physical blocks in a replacement table.
本发明亦提供一种闪存储存系统及其控制器,此闪存储存系统包括闪存芯片、连接器以及控制器,其中闪存芯片具有多个物理区块。此控制器是电性连接至上述闪存芯片与连接器,并且此控制器包括微处理器单元以及耦接至微处理器单元的闪存接口模块、缓冲存储器、主机接口模块与存储器管理模块。特别是,此存储器管理模块具有可由微处理器单元执行的多个机器指令以对闪存完成上述区块管理与更换方法。The present invention also provides a flash memory storage system and its controller. The flash memory storage system includes a flash memory chip, a connector and a controller, wherein the flash memory chip has multiple physical blocks. The controller is electrically connected to the above-mentioned flash memory chip and the connector, and the controller includes a microprocessor unit, a flash memory interface module coupled to the microprocessor unit, a buffer memory, a host interface module and a memory management module. In particular, the memory management module has a plurality of machine instructions executable by the microprocessor unit to implement the above block management and replacement method for the flash memory.
在本发明的一实施例中,上述的闪存储存系统为随身盘、闪存卡或固态硬盘。In an embodiment of the present invention, the above-mentioned flash memory storage system is a USB flash drive, a flash memory card or a solid state hard disk.
在本发明的一实施例中,上述的物理区块是属于多个区块面,并且每一物理单元是由属于不同区块面的至少两个物理区块所组成。In an embodiment of the present invention, the above-mentioned physical block belongs to multiple block planes, and each physical unit is composed of at least two physical blocks belonging to different block planes.
在本发明的一实施例中,上述的区块面是属于一个闪存晶粒。In an embodiment of the present invention, the above-mentioned block plane belongs to a flash memory die.
在本发明的一实施例中,上述的区块面是属于多个闪存晶粒。In an embodiment of the present invention, the above-mentioned block planes belong to a plurality of flash memory dies.
在本发明的一实施例中,上述的闪存晶粒是属于多个闪存芯片。In an embodiment of the present invention, the above-mentioned flash memory dies belong to a plurality of flash memory chips.
在本发明的一实施例中,上述的闪存晶粒是属于一个闪存芯片。In an embodiment of the present invention, the above-mentioned flash memory chip belongs to a flash memory chip.
本发明所提供的方法能在替代区仍存有可以多区块面存取指令存取的物理区块所组成的物理单元时以物理单元为单位来更换已损坏的物理区块并且在替代区无可以多区块面存取指令存取的物理区块所组成的物理单元时以物理区块为单位来更换已损坏的物理区块,因此可有效地提升闪存储存系统的存取效率且延长闪存储存系统的寿命。The method provided by the present invention can replace the damaged physical block in units of physical units when the replacement area still has physical units composed of physical blocks that can be accessed by multi-block plane access instructions and in the replacement area When there is no physical unit composed of physical blocks that can be accessed by multi-block surface access instructions, the damaged physical block is replaced by the physical block, so the access efficiency of the flash memory storage system can be effectively improved and the extension can be extended. Lifespan of flash storage systems.
为使本发明的上述特征和优点能更明显易懂,下文特举较佳实施例,并结合附图详细说明如下。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
图1是根据本发明一实施例示出的闪存储存系统的概要方块图。FIG. 1 is a schematic block diagram of a flash memory storage system according to an embodiment of the present invention.
图2是根据本发明实施例示出的闪存芯片的方块图。FIG. 2 is a block diagram of a flash memory chip according to an embodiment of the present invention.
图3A是根据本发明实施例示出的闪存芯片的一般区与替代区。FIG. 3A is a general area and a replacement area of a flash memory chip according to an embodiment of the present invention.
图3B是根据本发明实施例示出的一般区与替代区进行区块更换的示意图。FIG. 3B is a schematic diagram showing block replacement between a normal area and a replacement area according to an embodiment of the present invention.
图3C是根据本发明实施例示出的一般区中物理单元的运作示意图。FIG. 3C is a schematic diagram showing the operation of physical units in a general area according to an embodiment of the present invention.
图3D是根据本发明实施例示出的图3C中物理单元的写入范例示意图。FIG. 3D is a schematic diagram showing an example of writing to the physical unit in FIG. 3C according to an embodiment of the present invention.
图4是根据本发明实施例示出的区块管理与更换步骤的流程图。Fig. 4 is a flow chart showing block management and replacement steps according to an embodiment of the present invention.
附图符号说明Description of reference symbols
100:闪存储存系统100: Flash storage system
110:控制器110: Controller
110a:微处理器单元110a: Microprocessor unit
110b:存储器管理模块110b: memory management module
110c:闪存接口模块110c: Flash Interface Module
110d:缓冲存储器110d: buffer memory
110e:主机接口模块110e: host interface module
120:连接器120: connector
130:闪存芯片130: Flash memory chip
130a:第一区块面130a: The first block surface
130b:第二区块面130b: The second block surface
200:主机系统200: host system
210-1~210-M:逻辑单元210-1~210-M: logic unit
300:总线300: bus
302:一般区302: General Area
312:替代区312: Alternative Area
304:系统区304: System area
306:数据区306: data area
308:备用区308: Spare area
310-(1)、310-(2)、310-(P)、310-(P+1)、310-(P+2)、310-(N):物理单元310-(1), 310-(2), 310-(P), 310-(P+1), 310-(P+2), 310-(N): physical units
350:替换物理单元350: Replace Physical Unit
S401、S403、S405、S407、S409、S411、S413、S415、S417:区块管理与更换步骤S401, S403, S405, S407, S409, S411, S413, S415, S417: block management and replacement steps
具体实施方式 Detailed ways
图1是根据本发明一实施例示出的闪存储存系统的概要方块图。请参照图1,闪存储存系统100包括控制器(亦称控制器系统)110、连接器120以及闪存芯片130。FIG. 1 is a schematic block diagram of a flash memory storage system according to an embodiment of the present invention. Referring to FIG. 1 , the flash
通常闪存储存系统100会与主机系统200一起使用,以使主机系统200可将数据写入至闪存储存系统100或从闪存储存系统100中读取数据。在本实施例中,闪存储存系统100为固态硬盘(Solid State Drive,SSD)。但必须了解的是,在本发明另一实施例中闪存储存系统100亦可以是存储卡或随身盘。Generally, the
控制器110会执行以硬件型式或固件型式实作的多个指令以配合连接器120与闪存芯片130来进行数据的储存、读取与擦除等运作。控制器110包括微处理器单元110a、存储器管理模块110b、闪存接口模块110c、缓冲存储器110d与主机接口模块110e。The
微处理器单元110a用以与存储器管理模块110b、闪存接口模块110c、缓冲存储器110d与主机接口模块110e等协同合作以进行闪存储存系统100的各种运作。The microprocessor unit 110 a cooperates with the
存储器管理模块110b是耦接至微处理器单元110a。存储器管理模块110b具有可由微处理器单元110a执行的多个机器指令以管理闪存芯片130,例如平均磨损、区块管理功能、维护逻辑-物理地址对映表(mapping table)功能等的机器指令。特别是,在本发明实施例中,存储器管理模块110b包含可完成根据本实施例的区块管理与更换步骤的机器指令。The
在本实施例中,存储器管理模块110b是以一固件型式实作在控制器110中,例如以程式语言撰写相关机械指令并且储存于程式存储器(例如,只读存储器(Read Only Memory,ROM))来实施存储器管理模块110b。当闪存储存系统100运作时,存储器管理模块110b的多个机器指令会间接地被载入至缓冲存储器110d中,并且由微处理器单元110a来执行或直接由微处理器单元110a来执行以完成上述平均磨损功能、坏区块管理功能、维护逻辑-物理区块对映表功能等。特别是,控制器110藉由执行存储器管理模块110b的多个机械指令来此完成根据本发明实施例的区块管理与更换步骤。In this embodiment, the
在本发明另一实施例中,存储器管理模块110b的机械指令亦可以固件型式储存于闪存芯片130的特定区域(例如,闪存中专用于存放系统数据的系统区)中。同样的,当闪存储存系统100运作时,存储器管理模块110b的多个机器指令会被载入至缓冲存储器110d中并且由微处理器单元110a来执行。此外,在本发明另一实施例中,存储器管理模块110b亦可以一硬件型式实施在控制器110中。In another embodiment of the present invention, the mechanical instructions of the
闪存接口模块110c是耦接至微处理器单元110a并且用以存取闪存芯片130。也就是,欲写入至闪存芯片130的数据会经由闪存接口模块110c转换为闪存芯片130所能接受的格式。The flash
缓冲存储器110d是耦接至微处理器单元110a并且用以暂时地储存系统数据(例如逻辑-物理地址对映表)或者主机系统200所读取或写入的数据。在本实施例中,缓冲存储器110d为静态随机存取存储器(static random accessmemory,SRAM)。然而,必须了解的是,本发明不限于此,动态随机存取存储器(Dynamic Random Access memory,DRAM)、磁阻式存储器(Magnetoresistive Random Access Memory,MRAM)、相变存储器(PhaseChange Random Access Memory,PRAM)或其他适合的存储器亦可应用于本发明。The
主机接口模块110e耦接至微处理器单元110a并且用以接收与识别主机系统200所传送的指令。也就是,主机系统200所传送的指令与数据会通过主机接口模块110e来传送至微处理器单元110a。在本实施例中,主机接口模块110e为SATA接口。然而,必须了解的是本发明不限于此,主机接口模块110e亦可以是USB接口、IEEE1394接口、PCI Express接口、MS接口、MMC接口、SD接口、CF接口、IDE接口或其他适合的数据传输接口。特别是,主机接口模块110e会与连接器120相对应。也就是,主机接口模块110e必须与连接器120互相搭配。The
此外,虽未示出的于本实施例,但控制器110可还包括错误校正模块与电源管理模块等用于控制闪存的一般功能模块。In addition, although not shown in this embodiment, the
连接器120用以通过总线300连接主机系统200。在本实施例中,连接器120为SATA连接器。然而,必须了解的是本发明不限于此,连接器120亦可以是USB连接器、IEEE1394连接器、PCI Express连接器、MS连接器、MMC连接器、SD连接器、CF连接器、IDE连接器或其他适合的连接器。The
闪存芯片130是电性连接至控制器110并且用以储存数据。在本实施中闪存芯片130为多层存储单元(Multi Level Cell,MLC)NAND闪存。然而,必须了解的是,本发明不限于此。在本发明另一实施例中,单层存储单元(Single Level Cell,SLC)NAND闪存亦可应用于本发明。The
在本实施例中闪存芯片130包括第一区块面(plane)130a与第二区块面130b,第一区块面130a与第二区块面130b中分别包括多个物理区块。特别是,第一区块面与第二区块面彼此间可为物理或虚拟的分割。In this embodiment, the
值得一提的是,虽然本实施例是以两个区块面来进行描述,然而本发明不限于此,本发明亦可应用于具有任何数目的区块面的闪存芯片。此外,在本实施例中是以闪存芯片130的一个闪存晶粒(未标示)的第一区块面130a与第二区块面130b来进行描述,然而本发明亦可应用于具多个闪存晶粒的闪存芯片。类似地,虽然本实施例是一个闪存芯片来描述,但本发明亦可应用于具有多个闪存芯片的闪存储存系统。It is worth mentioning that although this embodiment is described with two block planes, the present invention is not limited thereto, and the present invention can also be applied to a flash memory chip with any number of block planes. In addition, in this embodiment, the
在闪存中物理区块为擦除的最小单位。亦即,每一物理区块含有最小数目之一并被擦除的存储单元。每一物理区块通常会分割为多个页面地址(page)。页面地址通常为编程(program)的最小单元。但要特别说明的是于有些不同的闪存设计,最小的编程单位也可为一个扇区(sector)。也就是说,一个页面地址中有多个扇区并以一个扇区为编程的最小单元。换言之,页面地址为写入数据或读取数据的最小单元。每一页面地址通常包括使用者数据区D与冗余区R。使用者数据区用以储存使用者的数据,而冗余区用以储存系统的数据(例如,错误校正码(error correcting code,ECC))。A physical block is the smallest unit of erasing in flash memory. That is, each physical block contains a minimum number of memory cells that are erased. Each physical block is usually divided into multiple page addresses (pages). A page address is usually the smallest unit of a program. However, it should be noted that due to some different flash memory designs, the smallest programming unit can also be a sector. That is to say, there are multiple sectors in one page address and one sector is the smallest unit for programming. In other words, the page address is the minimum unit for writing data or reading data. Each page address 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 (eg, error correcting code (ECC)).
为对应于磁盘驱动器的扇区(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 address is one sector. However, multiple sectors can also form a page address. In this embodiment, a page address of a flash memory block includes 4 sectors.
一般而言,物理区块可由任意数目的页面地址所组成,例如64个页面地址、128个页面地址、256个页面地址等。此外,在第一区块面130a或第二区块面130b中的物理区块通常也可被分组为数个区域(zone),以区域来管理存储器某种程度上是彼此独立地操作以增加操作执行的平行程度且简化管理的复杂度。Generally speaking, a physical block can be composed of any number of page addresses, such as 64 page addresses, 128 page addresses, 256 page addresses and so on. In addition, the physical blocks in the
此外,控制器110会将第一区块面130a与第二区块面130b中的多个物理区块配置为一个物理单元来管理,例如一个物理单元包括两个物理区块。由于以物理单元进行管理时,控制器110是以较大的单位(即物理单元)来维护逻辑-物理地址对映表,因此可节省所需使用缓冲存储器110d的空间。In addition, the
特别是,在本实施例中由于控制器110可以多区块面存取(multi-planesaccessing)模式同时存取第一区块面130a与第二区块面130b中的特定物理区块。也就是说,在闪存芯片130中第一区块面130a中的特定物理区块与第二区块面130b的特定物理区块可同时由多区块面存取指令来操作(例如,执行写入、读取与擦除)。因此,在本实施例中控制器110更会分别将具有可同时操作关系的物理区块配置为一个物理单元。具体来说,在特定闪存芯片电路设计上会使得一些区块面可以至少一部分的动作时间重迭(或同步)的方式来存取数据以缩短存取数据所需的时间。因此,在此称这些可以部分同步方式存取数据的特定区块面为具有可同时操作关系,而以部分同步方式存取数据的存取模式称为多区块面存取模式。In particular, in this embodiment, the
图2是根据本发明实施例示出的闪存芯片的方块图。请参照图2,第一区块面130a与第二区块面130b的物理区块可分别地组成物理单元310-1~310-N。FIG. 2 is a block diagram of a flash memory chip according to an embodiment of the present invention. Referring to FIG. 2 , the physical blocks of the
图3A~3D是根据本发明实施例示出的在第一区块面130a与第二区块面130b中物理单元的运作示意图。3A-3D are schematic diagrams showing the operation of physical units in the
必须了解的是,在此描述闪存的运作时以“提取”、“搬移”、“交换”、“替换”、“轮替”、”分割”、”划分”等词来操作闪存芯片130的物理区块是逻辑上的概念。也就是说,闪存的物理区块的实际位置并未更动,而是逻辑上对闪存的物理区块进行操作。值得一提的是,下述的运作是控制器110执行存储器管理模块110b的机械指令所完成。It must be understood that words such as "extract", "remove", "exchange", "replace", "rotate", "segment", and "partition" are used to describe the physical operation of the
图3A是根据本发明实施例示出的闪存芯片的一般区与替代区。FIG. 3A is a general area and a replacement area of a flash memory chip according to an embodiment of the present invention.
请参照图3A,在本发明实施例中,为了有效率地编程(即,写入)数据,控制器110会将图2所示的物理单元在逻辑上分组为一般区302与替代区312。Referring to FIG. 3A , in the embodiment of the present invention, in order to efficiently program (ie, write) data, the
在一般区302中的物理单元310-(1)~310-(P)是闪存储存系统100正常使用的物理单元。也就是说,控制器110会将数据写入至属于一般区302的物理单元。The physical units 310 - ( 1 )˜ 310 -(P) in the general area 302 are physical units normally used by the
在替代区312中的物理单元310-(P+1)~310-(N)是替代物理单元。闪存芯片130于出厂时会预留4%的物理区块作为更换使用,也就是说,当一般区302中的物理区块损毁时,预留于替代区312中的物理区块可用以取代损坏的物理区块。因此,倘若替代区312中仍存有可用的物理区块时,当发生物理区块损毁时控制器110可从替代区312中提取可用的物理区块来更换损毁的物理区块。倘若替代区312中无可用的物理区块时,当发生物理区块损毁时闪存储存系统100将会被宣告无法再使用。一般来说,控制器110会设定判断闪存芯片130是否能继续使用的一预定阈值,倘若当替代区312中可用的物理区块的数目小于此预定阈值时则判定无法再从替代区312中提取物理区块。在本实施例中,此预定阈值是设定为0。然而,在本发明不限于此,此预定阈值可设定为1或大于1的整数。The physical units 310-(P+1)˜310-(N) in the replacement area 312 are replacement physical units. When the
特别是,在本实施例中,控制器110可从替代区312中以物理单元为单位或物理区块为单位来进行损坏物理单元或物理区块的更换。In particular, in this embodiment, the
图3B是根据本发明实施例示出的一般区与替代区进行区块更换的示意图。FIG. 3B is a schematic diagram showing block replacement between a normal area and a replacement area according to an embodiment of the present invention.
请参照图3B,当一般区302中有物理区块发生损坏时,本实施例的控制器110可以两种方式来更换损坏的物理区块。例如,假设第一区块面130a的物理区块a(1)损坏时,在第一种方式中,控制器110会以包括第一区块面130a的物理区块a(P+1)与第二区块面130b的物理区块b(P+1)的物理单元310-(P+1)来更换整个物理单元310-1(如图3B的(a)所示)。也就是说,之后当控制器110需要使用到物理单元310-(1)时,控制器110会通过读取更换的记录而使用物理单元310-(P+1)。例如,此更换记录可记录于物理单元310-1的物理区块的冗余区中。另外,在第二种方式中,控制器110仅会将已损坏的第一区块面130a的物理区块a(1)以物理区块a(P+1)更换。也就是说,当控制器110存取物理单元310-(1)时,倘若存取的地址为原本物理区块a(1)的地址时则控制器110会更改为存取物理区块a(P+1)。类似地,例如此更换记录可记录于物理区块a(1)的冗余区中。Referring to FIG. 3B , when a physical block in the general area 302 is damaged, the
值得一提的是,根据本实施例当控制器110使用第一种方式更换损坏的区块时,由于被更换的物理单元中仍有正常的物理区块(例如,图3B中所示的物理区块b(1)),因此根据本发明实施例的控制器110会特别记录此信息。例如,在本发明一实施例中会在一更换表中记录此信息,或者亦可使用物理区块b(1)的冗余区来记录此信息。It is worth mentioning that, according to this embodiment, when the
根据本发明实施例的控制器110会使用上述两种方式来更换已损坏的物理区块,其具体的运作方式将在以下结合图4详细说明。The
在本发明一实施例中,当闪存储存系统100运作时,控制器110会将闪存芯片130的一般区302中的物理单元更分组为系统区、数据区与备用区。图3C是根据本发明实施例示出的一般区中物理单元的运作示意图。请参照图3C,系统区304包括物理单元310-(1)~物理单元310-(S),数据区306包括物理单元310-(S+1)~物理单元310-(S+M),并且备用区308包括物理单元310-(S+M+1)~物理单元310-(P)。在本实施例中,上述S、M与P为正整数,其代表各区配置的物理区块数量,其可由闪存储存系统的制造商依据所使用的闪存的容量而设定。In one embodiment of the present invention, when the flash
系统区304中的物理单元用以记录系统数据,此系统数据包括关于第一区块面130a的区域数、每一区域的物理区块数、每一物理区块的页面地址数、记录逻辑地址与物理地址对映关系的逻辑-物理地址对映表等。The physical units in the
数据区306中的物理单元用以储存使用者的数据,一般来说就是主机系统200所存取的逻辑区块所对映的区块。The physical units in the
备用区308中的物理区块是用以轮替数据区306中的物理单元,因此在备用区206a中的物理区块为空或可使用的区块,即无记录数据或标记为已没用的无效数据。也就是说,数据区306与备用区308的物理区块会以轮替方式来储存主机系统200对闪存储存系统100写入的数据。The physical blocks in the
如前所述,闪存芯片130的物理单元会以轮替方式提供主机系统来储存数据,因此控制器110会提供逻辑单元210-1~210-M给主机系统200以进行数据存取,并且通过维护逻辑-物理地址对映表(logical-physical addressmapping table)来记录逻辑单元所对映的物理单元。As mentioned above, the physical units of the
图3D是根据本发明实施例示出的图3C中对物理单元执行写入指令的范例示意图。FIG. 3D is a schematic diagram illustrating an example of executing a write instruction on a physical unit in FIG. 3C according to an embodiment of the present invention.
请参照图3D,例如,当主机系统欲写入数据至逻辑单元210-1时,控制器110会通过逻辑-物理地址对映表得知逻辑单元目前是对映数据区306中的物理单元310-(S+1)。因此,闪存储存系统100将对物理单元310-(S+1)中的数据进行更新,期间,控制器110会从备用区308中提取物理单元310-(S+M+1)来轮替数据区306的物理单元310-(S+1)。然而,当将新数据写入至物理单元310-(S+M+1)的同时,不会立刻将物理单元310-(S+1)中的所有有效数据搬移至物理单元310-(S+M+1)而擦除物理单元310-(S+1)。具体来说,控制器110会将物理单元310-(S+1)中欲写入页面地址之前的有效数据(即,页P0与P1)复制至物理单元310-(S+M+1)(如图3D的(a)),并且将新数据(即,物理单元310-(S+M+1)的页P2与P3)写入至物理单元310-(S+M+1)(如图3D的(b))。此时,将含有部分的有效旧数据与所写入新数据的物理单元310-(S+M+1)暂时地关联为替换物理单元350。此是因为物理单元310-(S+1)中的有效数据有可能在下个操作(例如,写入指令)中变成无效,因此立刻将物理单元310-(S+1)中的所有有效数据搬移至替换物理单元310-(S+M+1)可能会造成无谓的搬移。在此实施例中,物理单元310-(S+1)与替换物理单元310-(S+M+1)的内容整合起来才是所对映逻辑单元210-1的完整内容。这种母子关系(即,物理单元310-(S+1)与替换物理单元310-(S+M+1))的暂态关系可依据控制器110中缓冲存储器110d的大小而定,例如在本实施例中是使用五组来实施。暂时地维持此种暂态关系的动作一般可称为开启(open)母子区块。Please refer to FIG. 3D. For example, when the host system intends to write data to the logical unit 210-1, the
之后,当需要将物理单元310-(S+1)与替换物理单元310-(S+M+1)的内容真正合并时,控制器110才会将物理单元310-(S+1)与替换物理单元310-(S+M+1)整并为一个物理单元,由此提升区块的使用效率,此合并的动作又可称为关闭(close)母子区块。例如,如图3D的(c)所示,当进行关闭母子区块时,控制器110会将物理单元310-(S+1)中剩余的有效数据(即,页P4~PN)复制至替换物理单元310-(S+M+1),然后将物理单元310-(S+1)擦除并关联为备用区308,同时,将替换物理单元310-(S+M+1)关联为数据区306,并且在逻辑-物理地址对映表中将逻辑单元210-1的对映更改为物理单元310-(S+M+1),由此完成关闭母子区块的动作。Afterwards, when the contents of the physical unit 310-(S+1) and the replacement physical unit 310-(S+M+1) need to be actually merged, the
值得一提的是,由于在本实施例中每一物理单元是由属于不同区块面的物理区块所组成。因此,当对物理单元中的多个物理区块进行存取时,一般来说控制器110必须以多次方式分别对每一物理区块执行单区块面存取(single-plane accessing)指令来完成写入或读取。此种依次仅存取一个物理区块的模式称为单区块面存取模式。然而,如上所述由于在存储单元制造过程的电路布图(lay out)时,属于不同区块面的物理区块之间会有可同时操作关系,因此倘若依据此可同时操作关系将对应的物理区块分组为一个物理单元时,则当对此物理单元中的多个物理区块进行存取时,控制器110就可同时对其中的物理区块执行多区块面存取指令来完成写入或读取以提升存取的效率。此种同时对多个物理区块进行存取的方式称为多区块面存取模式。It is worth mentioning that in this embodiment, each physical unit is composed of physical blocks belonging to different block planes. Therefore, when accessing a plurality of physical blocks in a physical unit, generally speaking, the
因此,在本实施例中当闪存芯片130发生物理区块损坏时,控制器110会从替代区312中优先选择能够执行多区块面存取的一个物理单元来更换具损坏物理区块的物理单元(如图3B的(a)所示),由此确保闪存储存系统100在进行坏区块更换后仍可以较有效率的多区块面存取模式来执行数据的存取。Therefore, in this embodiment, when a physical block of the
图4是根据本发明实施例示出的区块管理与更换步骤的流程图,其中这些步骤是控制器110的微处理器单元110a执行存储器管理模块110b的机械指令所完成。必须了解的是,本发明所提出的区块管理步骤不限于图4所示的执行顺序,本领域技术人员可根据本发明的精神任意更动区块管理步骤的顺序。FIG. 4 is a flowchart showing block management and replacement steps according to an embodiment of the present invention, wherein these steps are completed by the microprocessor unit 110 a of the
请参照图4,当闪存储存系统100连接至主机系统200并且开机时,控制器110会进行初始化,其中会将在第一区块面130a与第二区块面130b中可藉由使用多区块面存取指令来存取的物理区块各别地分组为多个物理单元并且区分为使用区302与替代区312(步骤S401),特别是在本实施例中,控制器110还会将使用区302区分为系统区304、数据区306与备用区308。Please refer to FIG. 4 , when the flash
接着,在闪存储存系统100的运作过程中,控制器110会持续地判断在一般区302中是否有物理区块损坏(步骤S403)。具体地说,在写入数据的例子中控制器110会确定写入状态是否正常,而在读出数据的例子中控制器110会确定数据读出值是否正确,由此来决定所存取的物理区块是否损坏。倘若当控制器110发现有物理区块损坏时,则在步骤S405中控制器110会判断替代区312中未损坏的物理单元的数目是否大于预定阈值(在本实施例中此预定阈值为0,其中此预定阈值可由使用者自行设定为其他值,例如1、2或其他适当整数值),其中所谓未损坏的物理单元表示此物理单元中的所有物理区块皆为正常并且可通过多区块面存取模式对其进行存取。具体来说,步骤S405是判断替代区312中是否存有足够的未损坏的物理单元。Next, during the operation of the flash
倘若在替代区312中未损坏的物理单元的数目大于预定阈值(即,替代区312中存有足够的未损坏的物理单元的情况)时,则在步骤S407中控制器110会选择未损坏的物理单元的其中之一并且以整个物理单元为单位来取代已损坏的物理单元,并且在步骤S409中控制器110会在更换表(未示出的)中记录相关的信息。例如,在本发明一实施例中在更换表中会记录此被取代的物理单元中仍正常的物理区块。例如,在本发明另一实施例中是在更换表中记录被更换的物理单元,然后通过每一物理区块中冗余区内的一标记来辨识仍可使用的物理区块。此外,除了使用上述更换表之外,在本发明另一实施例中步骤S409亦可在不使用上述更换表下仅利用在未损坏的物理区块的冗余区中记录一标记来注记此为正常的物理区块或在损毁物理区块冗余区中记录一标记来注记此为损坏的物理区块,亦或在两区块中皆加以标记,并且当控制器100于闪存储存系统100每次开机而执行初始化时可通过扫描与读取物理区块的冗余区而得知物理区块的状态。If the number of undamaged physical units in the replacement area 312 is greater than a predetermined threshold (that is, there are enough undamaged physical units in the replacement area 312), the
倘若在替代区312中未损坏的物理单元的数目不大于预定阈值(即,替代区312中无存有足够的未损坏的物理单元的情况)时,则在步骤S411中控制器110会通过更换表的记录来判断替代区312中是否存有未损坏的物理区块。If the number of undamaged physical units in the replacement area 312 is not greater than the predetermined threshold (that is, there are not enough undamaged physical units in the replacement area 312), then in step S411, the
倘若在步骤S411中判断替代区312中存有未损坏的物理区块时,则在步骤S413中会选择其中一个未损坏的物理区块并且以物理区块为单位来取代已损坏的物理区块,并且在步骤S415中控制器110会在更换表的记录中删除所选择的物理区块。倘若在步骤S411中判断替代区312中无存有未损坏的物理区块时,则在步骤S417中控制器110会发出错误讯息告知主机系统200闪存储存系统100已无法再储存数据。If it is determined in step S411 that there are undamaged physical blocks in the replacement area 312, then in step S413 one of the undamaged physical blocks will be selected and the damaged physical block will be replaced in units of physical blocks , and in step S415, the
虽未示出的于图4中,但本领域的技术人员可轻易了解图4的区块管理与更换步骤除了在以无法更换损坏的物理区块时会结束图4的程序外,在接收到关机或电源中断指令时亦会结束图4的程序。Although not shown in FIG. 4, those skilled in the art can easily understand that the block management and replacement steps in FIG. 4 will end the program in FIG. 4 when the damaged physical block cannot be replaced. The program in Fig. 4 will also end when the shutdown or power interruption command is issued.
综上所述,本发明是在闪存储存系统初始化时将具有可以多区块面存取模式进行存取的物理区块分组为物理单元,由此以多区块面存取模式来对闪存芯片进行存取来提升存取效率。此外,当发生物理区块损坏时,在替代区存有可以多区块面存取模式进行存取的物理单元时本发明是以物理单元为单位来更换具所损坏物理区块的物理单元,而能够继续以多区块面存取模式进行存取。此外,本发明会记录被更换的物理单元中仍可使用的物理区块并且当发生物理区块损坏而替代区无正常的物理单元时,本发明会将所记录仍可使用的物理区块来更换所损坏的物理区块,由此延长闪存储存系统的寿命。To sum up, the present invention groups the physical blocks that can be accessed in the multi-block plane access mode into physical units when the flash memory storage system is initialized, thereby using the multi-block plane access mode to store the flash memory chip Access to improve access efficiency. In addition, when a physical block is damaged, when there are physical units that can be accessed in a multi-block plane access mode in the replacement area, the present invention uses the physical unit as a unit to replace the physical unit with the damaged physical block, Instead, it can continue to access in the multi-block surface access mode. In addition, the present invention will record the usable physical block in the replaced physical unit and when the physical block is damaged and the replacement area has no normal physical unit, the present invention will record the usable physical block to Replace damaged physical blocks, thereby extending the life of the flash storage system.
虽然本发明已以较佳实施例揭示如上,然其并非用以限定本发明,本领域的技术人员在不脱离本发明的精神和范围的前提下可作若干的更动与润饰,因此本发明的保护范围以本发明的权利要求为准。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. Therefore, the present invention The scope of protection is based on the claims of the present invention.
Claims (18)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2008101690831A CN101727397B (en) | 2008-10-20 | 2008-10-20 | Block management and replacement method, flash memory storage system and controller thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2008101690831A CN101727397B (en) | 2008-10-20 | 2008-10-20 | Block management and replacement method, flash memory storage system and controller thereof |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101727397A CN101727397A (en) | 2010-06-09 |
CN101727397B true CN101727397B (en) | 2012-06-27 |
Family
ID=42448315
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2008101690831A Active CN101727397B (en) | 2008-10-20 | 2008-10-20 | Block management and replacement method, flash memory storage system and controller thereof |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101727397B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102456401B (en) * | 2010-10-26 | 2015-04-22 | 群联电子股份有限公司 | Block management method, memory controller and memory storage device |
CN103713969A (en) * | 2013-12-30 | 2014-04-09 | 华为技术有限公司 | Method and device for improving reliability of solid state disk |
CN108038065B (en) * | 2017-12-22 | 2021-11-12 | 湖南国科微电子股份有限公司 | Method, device and system for improving Block utilization rate |
KR102420955B1 (en) * | 2017-12-29 | 2022-07-15 | 마이크론 테크놀로지, 인크. | Uncorrectable ecc |
CN110364216B (en) * | 2018-04-09 | 2022-03-01 | 合肥沛睿微电子股份有限公司 | Solid state disk and operation method thereof |
CN113207225A (en) * | 2021-03-16 | 2021-08-03 | 合肥致存微电子有限责任公司 | Chip-replaceable storage device and chip replacement, verification and manufacturing method thereof |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6591330B2 (en) * | 2001-06-18 | 2003-07-08 | M-Systems Flash Disk Pioneers Ltd. | System and method for flexible flash file |
CN1967504A (en) * | 2005-11-18 | 2007-05-23 | 凌阳科技股份有限公司 | Device and method for controlling flash memory |
CN101198939A (en) * | 2005-05-12 | 2008-06-11 | 晟碟以色列有限公司 | Flash memory management method that is resistant to data corruption by power loss |
-
2008
- 2008-10-20 CN CN2008101690831A patent/CN101727397B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6591330B2 (en) * | 2001-06-18 | 2003-07-08 | M-Systems Flash Disk Pioneers Ltd. | System and method for flexible flash file |
CN101198939A (en) * | 2005-05-12 | 2008-06-11 | 晟碟以色列有限公司 | Flash memory management method that is resistant to data corruption by power loss |
CN1967504A (en) * | 2005-11-18 | 2007-05-23 | 凌阳科技股份有限公司 | Device and method for controlling flash memory |
Also Published As
Publication number | Publication date |
---|---|
CN101727397A (en) | 2010-06-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI385669B (en) | Wear leveling method and storage system and controller using the same | |
US9098395B2 (en) | Logical block management method for a flash memory and control circuit storage system using the same | |
US8332576B2 (en) | Data reading method for flash memory and controller and storage system using the same | |
US8275931B2 (en) | Block management method for flash memory, and storage system and controller using the same | |
US8214578B2 (en) | Method of storing data into flash memory according to usage patterns of addresses and data storage system using the same | |
US9213629B2 (en) | Block management method, memory controller and memory stoarge apparatus | |
CN101640069B (en) | Average wear method and average wear system for flash memory | |
CN101788955B (en) | Flash memory data access method, storage system and controller system | |
TWI381393B (en) | Block management and replacement method, flash memory storage system and controller using the same | |
CN101625897B (en) | Data writing method, storage system and controller for flash memory | |
US8037236B2 (en) | Flash memory writing method and storage system and controller using the same | |
CN101630233B (en) | Data access method, storage system and controller for flash memory | |
CN101661431B (en) | Block management method for flash memory, flash storage system and controller | |
CN102073600B (en) | Data backup method, flash memory controller and flash memory storage system | |
US20130275655A1 (en) | Memory management method and memory controller and memory storage device using the same | |
TWI459198B (en) | Memory storage device, memory controller thereof, and method for identifying valid data | |
CN101944386A (en) | Control circuit for identifying error data in flash memory, storage system and method | |
CN101667157A (en) | Flash memory data transmission method, flash memory storage system and controller | |
CN101727397B (en) | Block management and replacement method, flash memory storage system and controller thereof | |
TW201508748A (en) | Data writing method, memory controller and memory storage apparatus | |
US8943264B2 (en) | Data storing method, and memory controller and memory storage apparatus using the same | |
CN102890655A (en) | Memory storage device, its memory controller and effective data identification method | |
CN101866320B (en) | Data management method and flash memory storage system and controller using the same | |
CN102446137B (en) | Data writing method, memory controller and memory storage device | |
CN101944384B (en) | Data writing method for flash memory and its control circuit and storage system |
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 |