CN102968385B - Data writing method, memory controller and storage device - Google Patents
Data writing method, memory controller and storage device Download PDFInfo
- Publication number
- CN102968385B CN102968385B CN201110256271.XA CN201110256271A CN102968385B CN 102968385 B CN102968385 B CN 102968385B CN 201110256271 A CN201110256271 A CN 201110256271A CN 102968385 B CN102968385 B CN 102968385B
- Authority
- CN
- China
- Prior art keywords
- logical
- logical block
- data
- those
- physical
- 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
- 238000000034 method Methods 0.000 title claims abstract description 69
- 239000000284 extract Substances 0.000 claims description 32
- 238000013507 mapping Methods 0.000 claims description 27
- 230000005055 memory storage Effects 0.000 description 46
- 238000012937 correction Methods 0.000 description 10
- 238000010586 diagram Methods 0.000 description 10
- 230000005540 biological transmission Effects 0.000 description 3
- 238000007596 consolidation process Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 239000007787 solid Substances 0.000 description 3
- 230000002093 peripheral effect Effects 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000000758 substrate Substances 0.000 description 1
Landscapes
- Read Only Memory (AREA)
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
Description
技术领域 technical field
本发明是有关于一种用于可复写式非易失性存储器的数据写入方法及使用此方法的存储器控制器与存储器储存装置。The invention relates to a data writing method for a rewritable non-volatile memory, a memory controller and a memory storage device using the method.
背景技术 Background technique
数字相机、手机与MP3在这几年来的成长十分迅速,使得消费者对储存媒体的需求也急速增加。由于可复写式非易失性存储器(rewritablenon-volatilememory)具有数据非易失性、省电、体积小、无机械结构、读写速度快等特性,最适于可携式电子产品,例如笔记本型计算机。固态硬盘就是一种以闪存作为储存媒体的存储器储存装置。因此,近年闪存产业成为电子产业中相当热门的一环。The rapid growth of digital cameras, mobile phones, and MP3 players has led to a rapid increase in consumer demand for storage media. Because rewritable non-volatile memory (rewritable non-volatile memory) has the characteristics of data non-volatility, power saving, small size, no mechanical structure, fast read and write speed, etc., it is most suitable for portable electronic products, such as notebook type computer. A solid state drive is a memory storage device that uses flash memory as a storage medium. Therefore, the flash memory industry has become a very popular part of the electronics industry in recent years.
闪存模块具有多个物理区块且每一物理区块具有多个物理页面(physicalpage),其中在物理区块中写入数据时必须依据物理页面的顺序依序地写入数据。此外,已被写入数据的物理页面并需先被抹除后才能再次用于写入数据。特别是,物理区块为抹除的最小单位,并且物理页面为可编程(亦称写入)的最小单元。因此,在闪存模块的管理中,物理区块会被区分为数据区与闲置区。The flash memory module has a plurality of physical blocks and each physical block has a plurality of physical pages. When writing data in the physical blocks, the data must be written sequentially according to the order of the physical pages. In addition, the physical pages that have been written with data need to be erased before they can be used to write data again. In particular, a physical block is the smallest unit of erasing, and a physical page is the smallest unit of programming (also known as writing). Therefore, in the management of the flash memory module, the physical block is divided into a data area and an idle area.
数据区的物理区块是用以储存主机系统所储存的数据。具体来说,存储器储存装置中的存储器管理电路会将主机系统所存取的逻辑存取地址转换为逻辑区块的逻辑页面并且将逻辑区块的逻辑页面映射至数据区的物理区块的物理页面。也就是说,闪存模块的管理上数据区的物理区块是被视为已被使用的物理区块(例如,已储存主机系统所写入的数据)。例如,存储器管理电路会使用逻辑-物理地址映射表来记载逻辑区块与数据区的物理区块的映射关系,其中逻辑区块中的逻辑页面是依序的对应所映射的物理区块的物理页面。The physical blocks of the data area are used to store data stored in the host system. Specifically, the memory management circuit in the memory storage device converts the logical access address accessed by the host system into the logical page of the logical block and maps the logical page of the logical block to the physical page of the physical block of the data area. page. That is to say, the physical blocks in the management data area of the flash memory module are regarded as used physical blocks (for example, the data written by the host system has been stored). For example, the memory management circuit will use the logical-physical address mapping table to record the mapping relationship between the logical block and the physical block of the data area, wherein the logical pages in the logical block are sequentially corresponding to the physical blocks of the mapped physical blocks. page.
闲置区的物理区块是用以轮替数据区中的物理区块。具体来说,如上所述,已写入数据的物理区块必须被抹除后才可再次用于写入数据,因此,闲置区的物理区块是被设计用于写入更新数据以替换映射逻辑区块的物理区块。基此,在闲置区中的物理区块为空或可使用的物理区块,即无记录数据或标记为已没用的无效数据。The physical blocks in the spare area are used to alternate the physical blocks in the data area. Specifically, as mentioned above, the physical block that has written data must be erased before it can be used to write data again. Therefore, the physical block in the spare area is designed to write update data to replace the mapping The physical block of the logical block. Based on this, the physical blocks in the spare area are empty or usable physical blocks, that is, no recorded data or invalid data marked as useless.
也就是说,数据区与闲置区的物理区块的物理页面是以轮替方式来映射逻辑区块的逻辑页面,以储存主机系统所写入的数据。例如,存储器储存装置的存储器管理电路会从闲置区中提取一个或多个物理区块作为全局随机物理区块,并且当主机系统欲写入更新数据的逻辑存取地址是对应储存装置的某一逻辑单元的某一逻辑页面时,储存装置的存储器管理电路会将此更新数据写入至全局随机物理区块的物理页面中。That is to say, the physical pages of the physical blocks in the data area and the free area map the logical pages of the logical blocks in an alternate manner to store data written by the host system. For example, the memory management circuit of the memory storage device will extract one or more physical blocks from the free area as a global random physical block, and when the logical access address of the host system to write update data is a corresponding storage device When a certain logical page of the logical unit is selected, the memory management circuit of the storage device writes the updated data into the physical page of the global random physical block.
此外,当更新数据被写入至全局随机物理区块的物理页面中,存储器管理电路必须在一全局随机区搜寻表中记录关于已被更新的逻辑页面的更新信息。也就是说,在全局随机区搜寻表中会记录已更新逻辑页面的更新数据被写入至那些全局随机物理区块的物理页面中。在此,在全局随机区搜寻表中用以储存一个已更新逻辑页面的更新信息的记录称为登录(entry)。每一个登录中包含用以记录已更新逻辑页面的地址的字段、用以记录在全局随机物理区块中储存属于此已更新逻辑页面的数据的物理页面的地址的字段以及用以标记此登录是否有效的字段。由于任何一个逻辑页面的数据都有可能暂存至全局随机区中,因此,在全局随机区搜寻表中用以记录已更新逻辑页面的地址的字段必须包含较多的位,才能够储存足够识别所有逻辑页面地址的信息。In addition, when update data is written into the physical pages of the global random physical block, the memory management circuit must record update information about the updated logical pages in a global random area lookup table. That is to say, it is recorded in the global random area search table that the updated data of the updated logical pages is written into the physical pages of those global random physical blocks. Here, the record used to store the update information of an updated logical page in the global random area search table is called an entry. Each entry contains a field for recording the address of the updated logical page, a field for recording the address of the physical page that stores data belonging to the updated logical page in the global random physical block, and a field for marking whether the entry is valid fields. Since the data of any logical page may be temporarily stored in the global random area, the field used to record the address of the updated logical page in the global random area search table must contain more bits to store enough identification Information about all logical page addresses.
在存储器储存装置运作期间,全局随机区搜寻表必须被加载至缓冲存储器中,以利于存取。然而,对于配置小容量的缓冲存储器的存储器储存装置来说,上述全局随机区搜寻表将无法被加载至缓冲存储器。因此,开发一种数据写入方法,以使得在此类配置小容量的缓冲存储器的存储器储存装置中仍可使用全局随机物理区块来储存数据,是有其必要的。During the operation of the memory storage device, the GRAM table must be loaded into the buffer memory for easy access. However, for a memory storage device configured with a small-capacity buffer memory, the global random area search table cannot be loaded into the buffer memory. Therefore, it is necessary to develop a data writing method so that global random physical blocks can still be used to store data in such a memory storage device configured with a small-capacity buffer memory.
发明内容 Contents of the invention
本发明提供一种数据写入方法、存储器控制器、存储器控制器与存储器储存装置,其能够在有限的缓冲存储器容量下使用全局随机物理区块来储存数据。The invention provides a data writing method, a memory controller, a memory controller and a memory storage device, which can use global random physical blocks to store data under limited buffer memory capacity.
本发明范例实施例提出一种用于可复写式非易失性存储器模块的数据写入方法,其中此可复写式非易失性存储器模块具有多个物理区块,每一物理区块具有多个物理页面,此些物理区块至少分组为数据区与闲置区,属于数据区与闲置区的物理区块被分组为多个物理单元,闲置区的物理单元用以替换数据区的物理单元以写入数据,多个逻辑单元被配置以映射数据区的物理单元,并且每一逻辑单元具有多个逻辑页面。本数据写入方法包括从闲置区中提取至少一个物理单元作为全局随机区,其中全局随机区暂存属于多个已更新逻辑页面的数据,并且此些已更新逻辑页面属于上述逻辑单元之中的多个已更新逻辑单元。本数据写入方法也包括建立全局随机区搜寻表以记录在全局随机区中对应此些已更新逻辑页面的多个更新信息。本数据写入方法还包括接收写入指令与对应此写入指令的更新数据,其中此更新数据是属于第一逻辑页面并且第一逻辑页面属于第一逻辑单元。本数据写入方法亦包括判断全局随机区是否储存有属于第一逻辑单元的数据;以及当全局随机区未储存有属于第一逻辑单元的数据时,还判断此些已更新逻辑单元的数目是否小于预设数目,其中此预设数小于逻辑单元的总数。本数据写入方法还包括,当此些已更新逻辑单元的数目小于预设数目时,为第一逻辑单元配置第一索引编号,将更新数据写入至全局随机区中并且使用对应第一逻辑单元的第一索引编号在全局随机区搜寻表中记录对应第一逻辑页面的更新信息。An exemplary embodiment of the present invention provides a data writing method for a rewritable non-volatile memory module, wherein the rewritable non-volatile memory module has multiple physical blocks, and each physical block has multiple These physical blocks are at least grouped into a data area and an idle area, and the physical blocks belonging to the data area and the idle area are grouped into multiple physical units, and the physical units in the idle area are used to replace the physical units in the data area to To write data, a plurality of logical units are configured to map physical units of the data area, and each logical unit has a plurality of logical pages. This data writing method includes extracting at least one physical unit from the spare area as a global random area, wherein the global random area temporarily stores data belonging to a plurality of updated logical pages, and these updated logical pages belong to the above logical units Multiple updated logical units. The data writing method also includes establishing a global random area search table to record a plurality of update information corresponding to the updated logical pages in the global random area. The data writing method further includes receiving a write command and update data corresponding to the write command, wherein the update data belongs to the first logical page and the first logical page belongs to the first logical unit. The data writing method also includes judging whether the data belonging to the first logical unit is stored in the global random area; less than a preset number, where the preset number is less than the total number of logical units. The data writing method also includes, when the number of these updated logical units is less than the preset number, configuring a first index number for the first logical unit, writing the updated data into the global random area and using the corresponding first logical unit The first index number of the unit records update information corresponding to the first logical page in the global random area search table.
在本发明的一实施例中,上述的数据写入方法还包括,当全局随机区储存有属于第一逻辑单元的数据时,将更新数据写入至全局随机区中并且使用对应第一逻辑单元的第一索引编号在全局随机区搜寻表中记录对应第一逻辑页面的更新信息。In an embodiment of the present invention, the above-mentioned data writing method further includes, when the data belonging to the first logic unit is stored in the global random area, writing update data into the global random area and using the corresponding first logical unit The update information corresponding to the first logical page is recorded in the global random area search table with the first index number.
在本发明的一实施例中,上述的数据写入方法还包括,当此些已更新逻辑单元的数目非小于预设数目时,从闲置区中提取第一物理单元作为对应第一逻辑单元的子物理单元并且将更新数据写入至对应第一逻辑单元的子物理单元中,其中此子物理单元只用以储存属于第一逻辑单元的数据。In an embodiment of the present invention, the above data writing method further includes, when the number of the updated logical units is not less than the preset number, extracting the first physical unit from the spare area as the corresponding first logical unit and write update data into the sub-physical unit corresponding to the first logical unit, wherein the sub-physical unit is only used to store data belonging to the first logical unit.
在本发明的一实施例中,上述的数据写入方法还包括:记录对应每一逻辑单元的写入次数;以及根据对应逻辑单元的写入次数将逻辑单元区分为热逻辑区与冷逻辑区。In an embodiment of the present invention, the above-mentioned data writing method further includes: recording the writing times corresponding to each logical unit; and distinguishing the logical units into hot logical areas and cold logical areas according to the writing times of the corresponding logical units .
在本发明的一实施例中,上述的数据写入方法还包括,在判断全局随机区是否储存有属于第一逻辑单元的数据之前更判断第一逻辑单元是否属于冷逻辑区;以及仅当第一逻辑单元非属于冷逻辑区时,才执行上述判断全局随机区是否储存有属于第一逻辑单元的数据的步骤。In an embodiment of the present invention, the above-mentioned data writing method further includes, before judging whether the data belonging to the first logical unit is stored in the global random area, further determining whether the first logical unit belongs to the cold logical area; and only when the second When a logical unit does not belong to the cold logical area, the above step of judging whether the data belonging to the first logical unit is stored in the global random area is executed.
在本发明的一实施例中,上述的数据写入方法还包括,当第一逻辑单元属于冷逻辑区时,从闲置区的物理单元之中提取第一物理单元作为对应第一逻辑单元的子物理单元并且将更新数据写入至对应第一逻辑单元的子物理单元中。In an embodiment of the present invention, the above-mentioned data writing method further includes, when the first logical unit belongs to the cold logical area, extracting the first physical unit from the physical units in the spare area as the child corresponding to the first logical unit the physical unit and write the update data into the sub-physical unit corresponding to the first logical unit.
本发明范例实施例提出一种用于可复写式非易失性存储器模块的数据写入方法,其中此可复写式非易失性存储器模块具有多个物理区块,每一物理区块具有多个物理页面,此些物理区块至少分组为数据区与闲置区,属于数据区与闲置区的物理区块被分组为多个物理单元,闲置区的物理单元用以替换数据区的物理单元以写入数据,多个逻辑单元被配置以映射数据区的物理单元,并且每一逻辑单元具有多个逻辑页面。本数据写入方法包括从闲置区的中提取至少一个物理单元作为第一全局随机区且从闲置区的物理单元中提取至少一个物理单元作为第二全局随机区,其中第一全局随机区暂存属于多个第一已更新逻辑页面的数据,第二全局随机区暂存属于多个第二已更新逻辑页面的数据,第一已更新逻辑页面属于多个第一已更新逻辑单元,并且第二已更新逻辑页面属于多个第二已更新逻辑单元。本数据写入方法也包括建立第一全局随机区搜寻表以记录在第一全局随机区中对应第一已更新逻辑页面的多个更新信息和建立第二全局随机区搜寻表以记录在第二全局随机区中对应第二已更新逻辑页面的多个更新信息。本数据写入方法还包括接收写入指令与对应写入指令的更新数据,其中更新数据是属于第一逻辑页面并且第一逻辑页面属于一第一逻辑单元。本数据写入方法亦包括判断第一全局随机区或第二全局随机区是否储存有属于第一逻辑单元的数据;以及当第一全局随机区与第二全局随机区皆未储存有属于第一逻辑单元的数据时,判断第一已更新逻辑单元的数目是否小于预设数目,其中此预设数小于逻辑单元的总数。本数据写入方法也包括,当第一已更新逻辑单元的数目小于预设数目时,为第一逻辑单元配置第一索引编号,将更新数据写入至第一全局随机区中并且使用对应第一逻辑单元的第一索引编号在第一全局随机区搜寻表中记录对应第一逻辑页面的更新信息。此外,本数据写入方法还包括,当第一已更新逻辑单元的数目非小于预设数目时,判断第二已更新逻辑单元的数目是否小于预设数目。本数据写入方法还包括,当第二已更新逻辑单元的数目小于预设数目时,为第一逻辑单元配置一第二索引编号,将更新数据写入至第二全局随机区中并且使用对应第一逻辑单元的第二索引编号在第二全局随机区搜寻表中记录对应第一逻辑页面的更新信息。An exemplary embodiment of the present invention provides a data writing method for a rewritable non-volatile memory module, wherein the rewritable non-volatile memory module has multiple physical blocks, and each physical block has multiple These physical blocks are at least grouped into a data area and an idle area, and the physical blocks belonging to the data area and the idle area are grouped into multiple physical units, and the physical units in the idle area are used to replace the physical units in the data area to To write data, a plurality of logical units are configured to map physical units of the data area, and each logical unit has a plurality of logical pages. The data writing method includes extracting at least one physical unit from the idle area as the first global random area and extracting at least one physical unit from the physical units in the idle area as the second global random area, wherein the first global random area is temporarily stored data belonging to a plurality of first updated logical pages, the second global random area temporarily stores data belonging to a plurality of second updated logical pages, the first updated logical page belongs to a plurality of first updated logical units, and the second The updated logical page belongs to a plurality of second updated logical units. The data writing method also includes establishing a first global random area search table to record a plurality of update information corresponding to the first updated logical page in the first global random area and establishing a second global random area search table to record in the second A plurality of update information corresponding to the second updated logical page in the global random area. The data writing method further includes receiving a write command and update data corresponding to the write command, wherein the update data belongs to a first logical page and the first logical page belongs to a first logical unit. The data writing method also includes judging whether the first global random area or the second global random area stores data belonging to the first logic unit; and when neither the first global random area nor the second global random area stores data belonging to the first When the data of the logic unit is obtained, it is judged whether the number of the first updated logic unit is less than a preset number, wherein the preset number is less than the total number of logic units. The data writing method also includes, when the number of the first updated logical unit is less than the preset number, configuring the first index number for the first logical unit, writing the updated data into the first global random area and using the corresponding The first index number of a logical unit records update information corresponding to the first logical page in the first global random area search table. In addition, the data writing method further includes, when the number of the first updated logical units is not less than the preset number, judging whether the number of the second updated logical units is less than the preset number. The data writing method further includes, when the number of the second updated logical unit is less than the preset number, configuring a second index number for the first logical unit, writing the updated data into the second global random area and using the corresponding The second index number of the first logical unit records update information corresponding to the first logical page in the second global random area search table.
本发明范例实施例提出一种存储器控制器,用于控制可复写式非易失性存储器模块,其中此可复写式非易失性存储器模块具有多个物理区块,并且每一物理区块具有多个物理页面。存储器控制器包括主机接口、存储器接口与存储器管理电路。主机接口用以电性连接至主机系统。存储器接口用以电性连接至可复写式非易失性存储器模块。存储器管理电路电性连接至主机接口与存储器接口,并且用以将此些物理区块至少分组为数据区与闲置区。此外,存储器管理电路将属于数据区与闲置区的物理区块分组为多个物理单元,其中闲置区的物理单元用以替换数据区的物理单元以写入数据。另外,存储器管理电路配置多个逻辑单元以映射数据区的物理单元,其中每一逻辑单元具有多个逻辑页面。存储器管理电路从闲置区的物理单元中提取至少一个物理单元作为全局随机区,其中全局随机区暂存属于多个已更新逻辑页面的数据,并且此些已更新逻辑页面属于此些逻辑单元之中的多个已更新逻辑单元。存储器管理电路建立全局随机区搜寻表以记录在全局随机区中对应此些已更新逻辑页面的多个更新信息。存储器管理电路接收写入指令与对应此写入指令的更新数据,其中此更新数据是属于第一逻辑页面并且第一逻辑页面属于此些逻辑单元之中的第一逻辑单元。存储器管理电路判断全局随机区是否储存有属于第一逻辑单元的数据。当全局随机区未储存有属于第一逻辑单元的数据时,存储器管理电路还判断此些已更新逻辑单元的数目是否小于预设数目,其中预设数小于逻辑单元的总数。当此些已更新逻辑单元的数目小于预设数目时,存储器管理电路为第一逻辑单元配置第一索引编号,将更新数据写入至全局随机区中并且使用对应第一逻辑单元的第一索引编号在全局随机区搜寻表中记录对应第一逻辑页面的更新信息。An exemplary embodiment of the present invention provides a memory controller for controlling a rewritable nonvolatile memory module, wherein the rewritable nonvolatile memory module has a plurality of physical blocks, and each physical block has multiple physical pages. The memory controller includes a host interface, a memory interface and a memory management circuit. The host interface is used to electrically connect to the host system. The memory interface is used for electrically connecting to the rewritable non-volatile memory module. The memory management circuit is electrically connected to the host interface and the memory interface, and is used to at least group the physical blocks into a data area and an idle area. In addition, the memory management circuit groups the physical blocks belonging to the data area and the spare area into multiple physical units, wherein the physical units in the spare area are used to replace the physical units in the data area to write data. In addition, the memory management circuit configures a plurality of logical units to map physical units of the data area, wherein each logical unit has a plurality of logical pages. The memory management circuit extracts at least one physical unit from the physical units in the spare area as a global random area, wherein the global random area temporarily stores data belonging to a plurality of updated logical pages, and these updated logical pages belong to these logical units Multiple updated logical units of . The memory management circuit establishes a global random area search table to record a plurality of update information corresponding to the updated logical pages in the global random area. The memory management circuit receives a write command and update data corresponding to the write command, wherein the update data belongs to a first logical page and the first logical page belongs to a first logical unit among the logical units. The memory management circuit judges whether the global random area stores data belonging to the first logic unit. When the global random area does not store data belonging to the first logic unit, the memory management circuit also judges whether the number of the updated logic units is less than a preset number, wherein the preset number is less than the total number of logic units. When the number of these updated logical units is less than the preset number, the memory management circuit configures a first index number for the first logical unit, writes the updated data into the global random area and uses the first index corresponding to the first logical unit The number records the update information corresponding to the first logical page in the global random area search table.
在本发明的一实施例中,当全局随机区储存有属于第一逻辑单元的数据时,上述的存储器管理电路将更新数据写入至全局随机区中并且使用对应第一逻辑单元的第一索引编号在全局随机区搜寻表中记录对应第一逻辑页面的更新信息。In an embodiment of the present invention, when the data belonging to the first logical unit is stored in the global random area, the above-mentioned memory management circuit writes the updated data into the global random area and uses the first index corresponding to the first logical unit The number records the update information corresponding to the first logical page in the global random area search table.
在本发明的一实施例中,当已更新逻辑单元的数目非小于预设数目时,存储器管理电路从闲置区的物理单元之中提取第一物理单元作为对应第一逻辑单元的子物理单元并且将更新数据写入至对应第一逻辑单元的子物理单元中。In an embodiment of the present invention, when the number of updated logical units is not less than the preset number, the memory management circuit extracts the first physical unit from the physical units in the spare area as a sub-physical unit corresponding to the first logical unit and The update data is written into the sub-physical unit corresponding to the first logical unit.
在本发明的一实施例中,上述的存储器管理电路记录对应每一逻辑单元的写入次数并且根据对应逻辑单元的写入次数将逻辑单元区分为热逻辑区与冷逻辑区。In an embodiment of the present invention, the above-mentioned memory management circuit records the writing times corresponding to each logic unit and divides the logic units into hot logic areas and cold logic areas according to the writing times corresponding to the logic units.
在本发明的一实施例中,上述的存储器管理电路还判断第一逻辑单元是否属于冷逻辑区,并且仅当第一逻辑单元非属于冷逻辑区时,存储器管理电路才判断全局随机区是否储存有属于第一逻辑单元的数据。In an embodiment of the present invention, the above-mentioned memory management circuit also judges whether the first logic unit belongs to the cold logic area, and only when the first logic unit does not belong to the cold logic area, the memory management circuit judges whether the global random area stores There is data belonging to the first logical unit.
在本发明的一实施例中,当第一逻辑单元属于冷逻辑区时,存储器管理电路从闲置区的物理单元之中提取一第一物理单元作为对应第一逻辑单元的子物理单元并且将更新数据写入至对应第一逻辑单元的子物理单元中。In an embodiment of the present invention, when the first logical unit belongs to the cold logical area, the memory management circuit extracts a first physical unit from the physical units in the spare area as a sub-physical unit corresponding to the first logical unit and updates Data is written into the sub-physical unit corresponding to the first logical unit.
本发明范例实施例提出一种存储器储存装置,其包括连接器连接器、可复写式非易失性存储器模块与存储器控制器。连接器用以电性连接至主机系统。可复写式非易失性存储器模块具有多个物理区块并且每一物理区块具有多个物理页面。存储器控制器电性连接至连接器与可复写式非易失性存储器模块,并且用以将此些物理区块至少分组为数据区与闲置区。此外,存储器控制器将属于数据区与闲置区的物理区块分组为多个物理单元,其中闲置区的物理单元用以替换数据区的物理单元以写入数据。另外,存储器控制器配置多个逻辑单元以映射数据区的物理单元,其中每一逻辑单元具有多个逻辑页面。存储器控制器从闲置区的物理单元中提取至少一个物理单元作为全局随机区,其中全局随机区暂存属于多个已更新逻辑页面的数据,并且此些已更新逻辑页面属于此些逻辑单元之中的多个已更新逻辑单元。存储器控制器建立全局随机区搜寻表以记录在全局随机区中对应此些已更新逻辑页面的多个更新信息。存储器控制器接收写入指令与对应此写入指令的更新数据,其中此更新数据是属于第一逻辑页面并且第一逻辑页面属于此些逻辑单元之中的第一逻辑单元。存储器控制器判断全局随机区是否储存有属于第一逻辑单元的数据。当全局随机区未储存有属于第一逻辑单元的数据时,存储器控制器还判断此些已更新逻辑单元的数目是否小于预设数目,其中此预设数小于逻辑单元的总数。当此些已更新逻辑单元的数目小于预设数目时,存储器控制器为第一逻辑单元配置第一索引编号,将更新数据写入至全局随机区中并且使用对应第一逻辑单元的第一索引编号在全局随机区搜寻表中记录对应第一逻辑页面的更新信息。An exemplary embodiment of the present invention provides a memory storage device, which includes a connector, a rewritable non-volatile memory module, and a memory controller. The connector is used to electrically connect to the host system. The rewritable non-volatile memory module has multiple physical blocks and each physical block has multiple physical pages. The memory controller is electrically connected to the connector and the rewritable non-volatile memory module, and is used to at least group these physical blocks into a data area and an idle area. In addition, the memory controller groups the physical blocks belonging to the data area and the free area into multiple physical units, wherein the physical units in the spare area are used to replace the physical units in the data area to write data. In addition, the memory controller configures a plurality of logical units to map physical units of the data area, wherein each logical unit has a plurality of logical pages. The memory controller extracts at least one physical unit from the physical units in the spare area as a global random area, wherein the global random area temporarily stores data belonging to a plurality of updated logical pages, and the updated logical pages belong to the logical units Multiple updated logical units of . The memory controller establishes a global random area search table to record a plurality of update information corresponding to the updated logical pages in the global random area. The memory controller receives a write command and update data corresponding to the write command, wherein the update data belongs to a first logical page and the first logical page belongs to a first logical unit among the logical units. The memory controller determines whether the global random area stores data belonging to the first logic unit. When the global random area does not store data belonging to the first logic unit, the memory controller also judges whether the number of the updated logic units is less than a preset number, wherein the preset number is less than the total number of logic units. When the number of these updated logical units is less than the preset number, the memory controller configures the first index number for the first logical unit, writes the updated data into the global random area and uses the first index corresponding to the first logical unit The number records the update information corresponding to the first logical page in the global random area search table.
在本发明的一实施例中,当全局随机区储存有属于第一逻辑单元的数据时,上述的存储器控制器将更新数据写入至全局随机区中并且使用对应第一逻辑单元的第一索引编号在全局随机区搜寻表中记录对应第一逻辑页面的更新信息。In an embodiment of the present invention, when the data belonging to the first logical unit is stored in the global random area, the above-mentioned memory controller writes the update data into the global random area and uses the first index corresponding to the first logical unit The number records the update information corresponding to the first logical page in the global random area search table.
在本发明的一实施例中,当已更新逻辑单元的数目非小于预设数目时,存储器控制器从闲置区的物理单元之中提取第一物理单元作为对应第一逻辑单元的子物理单元并且将更新数据写入至对应第一逻辑单元的子物理单元中,其中子物理单元只用以储存属于第一逻辑单元的数据。In an embodiment of the present invention, when the number of updated logical units is not less than the preset number, the memory controller extracts the first physical unit from the physical units in the spare area as a sub-physical unit corresponding to the first logical unit and The update data is written into the sub-physical unit corresponding to the first logical unit, wherein the sub-physical unit is only used to store data belonging to the first logical unit.
在本发明的一实施例中,上述的存储器控制器记录对应每一逻辑单元的写入次数并且根据对应逻辑单元的写入次数将逻辑单元区分为热逻辑区与冷逻辑区。In an embodiment of the present invention, the above-mentioned memory controller records the writing times corresponding to each logical unit and divides the logical units into hot logical areas and cold logical areas according to the writing times of the corresponding logical units.
在本发明的一实施例中,上述的存储器控制器还判断第一逻辑单元是否属于冷逻辑区,并且仅当第一逻辑单元非属于冷逻辑区时,存储器控制器才判断全局随机区是否储存有属于第一逻辑单元的数据。In an embodiment of the present invention, the above-mentioned memory controller also judges whether the first logical unit belongs to the cold logical area, and only when the first logical unit does not belong to the cold logical area, the memory controller judges whether the global random area stores There is data belonging to the first logical unit.
在本发明的一实施例中,当第一逻辑单元属于冷逻辑区时,存储器控制器从闲置区的物理单元之中提取一第一物理单元作为对应第一逻辑单元的子物理单元并且将更新数据写入至对应第一逻辑单元的子物理单元中。In an embodiment of the present invention, when the first logical unit belongs to the cold logical area, the memory controller extracts a first physical unit from the physical units in the spare area as a sub-physical unit corresponding to the first logical unit and updates Data is written into the sub-physical unit corresponding to the first logical unit.
本发明范例实施例提出一种用于可复写式非易失性存储器模块的数据写入方法,其中可复写式非易失性存储器模块具有多个物理区块,每一物理区块具有多个物理页面,这些物理区块至少分组为数据区与闲置区,属于数据区与闲置区的物理区块被分组为多个物理单元,闲置区的物理单元用以替换数据区的物理单元以写入数据,多个逻辑单元被配置以映射数据区的该些物理单元,并且每一逻辑单元具有多个逻辑页面。本数据写入方法包括从闲置区的物理单元中提取至少一个物理单元作为全局随机区,其中全局随机区用以暂存属于多个已更新逻辑页面的数据,并且这些已更新逻辑页面属于此些逻辑单元之中的多个已更新逻辑单元。本数据写入方法也包括接收写入指令与对应此写入指令的更新数据,其中此更新数据是属于第一逻辑页面并且第一逻辑页面属于这些逻辑单元之中的第一逻辑单元。本数据写入方法还包括判断全局随机区是否储存有属于第一逻辑单元的数据。本数据写入方法包括:当全局随机区储存有属于第一逻辑单元的数据时,将更新数据写入至全局随机区;以及当全局随机区未储存有属于第一逻辑单元的数据时,判断此些已更新逻辑单元的数目是否小于预设数目,其中预设数小于逻辑单元的总数。本数据写入方法还包括:当此些已更新逻辑单元的数目小于预设数目时,将更新数据写入至全局随机区中;以及当此些已更新逻辑单元的数目非小于预设数目时,从闲置区的物理单元之中提取第一物理单元作为对应第一逻辑单元的子物理单元并且将更新数据写入至对应第一逻辑单元的子物理单元中,其中子物理单元只用以储存对应第一逻辑单元的数据。An exemplary embodiment of the present invention provides a data writing method for a rewritable non-volatile memory module, wherein the rewritable non-volatile memory module has multiple physical blocks, and each physical block has multiple Physical pages, these physical blocks are at least grouped into a data area and an idle area, the physical blocks belonging to the data area and the idle area are grouped into multiple physical units, and the physical units in the idle area are used to replace the physical units in the data area for writing For data, multiple logical units are configured to map the physical units of the data area, and each logical unit has multiple logical pages. This data writing method includes extracting at least one physical unit from the physical units in the spare area as a global random area, wherein the global random area is used to temporarily store data belonging to a plurality of updated logical pages, and these updated logical pages belong to these A number of updated logical units within the logical unit. The data writing method also includes receiving a write command and update data corresponding to the write command, wherein the update data belongs to the first logical page and the first logical page belongs to the first logical unit among the logical units. The data writing method further includes judging whether the global random area stores data belonging to the first logical unit. The data writing method includes: when the global random area stores data belonging to the first logical unit, writing update data into the global random area; and when the global random area does not store data belonging to the first logical unit, judging Whether the number of the updated logical units is less than a preset number, wherein the preset number is less than the total number of logical units. The data writing method further includes: when the number of the updated logical units is less than the preset number, writing the update data into the global random area; and when the number of the updated logical units is not less than the preset number , extracting the first physical unit from the physical units in the spare area as a sub-physical unit corresponding to the first logical unit and writing update data into the sub-physical unit corresponding to the first logical unit, wherein the sub-physical unit is only used for storing Data corresponding to the first logical unit.
本发明范例实施例提出一种存储器储存装置,其包括连接器连接器、可复写式非易失性存储器模块与存储器控制器。连接器用以电性连接至主机系统。可复写式非易失性存储器模块具有多个物理区块并且每一物理区块具有多个物理页面。存储器控制器电性连接至连接器与可复写式非易失性存储器模块,并且用以将此些物理区块至少分组为数据区与闲置区。此外,存储器控制器将属于数据区与闲置区的物理区块分组为多个物理单元,其中闲置区的物理单元用以替换数据区的物理单元以写入数据。另外,存储器控制器配置多个逻辑单元以映射数据区的物理单元,其中每一逻辑单元具有多个逻辑页面。存储器控制器从闲置区的物理单元中提取至少一个物理单元作为全局随机区,其中全局随机区暂存属于多个已更新逻辑页面的数据,并且此些已更新逻辑页面属于这些逻辑单元之中的多个已更新逻辑单元。再者,存储器控制器接收写入指令与对应写入指令的更新数据,其中更新数据是属于第一逻辑页面并且第一逻辑页面属于这些逻辑单元之中的一第一逻辑单元。并且,存储器控制器判断全局随机区是否储存有属于第一逻辑单元的数据。当全局随机区未储存有属于第一逻辑单元的数据时,存储器控制器判断此些已更新逻辑单元的数目是否小于预设数目,其中预设数小于逻辑单元的总数。当这些已更新逻辑单元的数目小于预设数目时,存储器控制器将更新数据写入至全局随机区中。此外,当全局随机区储存有属于第一逻辑单元的数据时,存储器控制器将更新数据写入至全局随机区中。当此些已更新逻辑单元的数目非小于该预设数目时,存储器控制器从闲置区的物理单元之中提取第一物理单元作为对应第一逻辑单元的子物理单元并且将更新数据写入至对应第一逻辑单元的子物理单元中,其中子物理单元只用以储存属于第一逻辑单元的数据。An exemplary embodiment of the present invention provides a memory storage device, which includes a connector, a rewritable non-volatile memory module, and a memory controller. The connector is used to electrically connect to the host system. The rewritable non-volatile memory module has multiple physical blocks and each physical block has multiple physical pages. The memory controller is electrically connected to the connector and the rewritable non-volatile memory module, and is used to at least group these physical blocks into a data area and an idle area. In addition, the memory controller groups the physical blocks belonging to the data area and the free area into multiple physical units, wherein the physical units in the spare area are used to replace the physical units in the data area to write data. In addition, the memory controller configures a plurality of logical units to map physical units of the data area, wherein each logical unit has a plurality of logical pages. The memory controller extracts at least one physical unit from the physical units in the spare area as a global random area, wherein the global random area temporarily stores data belonging to a plurality of updated logical pages, and the updated logical pages belong to the logical units Multiple updated logical units. Furthermore, the memory controller receives the write command and the update data corresponding to the write command, wherein the update data belongs to the first logical page and the first logical page belongs to a first logical unit among the logical units. Moreover, the memory controller judges whether the global random area stores data belonging to the first logic unit. When the global random area does not store data belonging to the first logic unit, the memory controller judges whether the number of the updated logic units is less than a preset number, wherein the preset number is less than the total number of logic units. When the number of the updated logical units is less than the preset number, the memory controller writes the updated data into the global random area. In addition, when the data belonging to the first logic unit is stored in the global random area, the memory controller writes update data into the global random area. When the number of these updated logical units is not less than the preset number, the memory controller extracts the first physical unit from the physical units in the spare area as a sub-physical unit corresponding to the first logical unit and writes the update data into Among the sub-physical units corresponding to the first logical unit, the sub-physical units are only used to store data belonging to the first logical unit.
基于上述,在本发明范例实施例的数据写入方法、存储器控制器、存储器控制器与存储器储存装置中,全局随机区最多仅会储存属于预定数目的逻辑单元的更新数据,因此,用以在全局随机区搜寻表中用以记录对应更新逻辑页面的更新信息的登录可有效地被缩小,由此全局随机区搜寻表可顺利地载入至缓冲存储器中。Based on the above, in the data writing method, the memory controller, the memory controller, and the memory storage device of the exemplary embodiments of the present invention, the global random area can only store update data belonging to a predetermined number of logical units at most. The entry in the global random area search table for recording the update information corresponding to the updated logical page can be effectively reduced, so that the global random area search table can be successfully loaded into the buffer memory.
为让本发明的上述特征和优点能更明显易懂,下文特举实施例,并配合所附图式作详细说明如下。In order to make the above-mentioned features and advantages of the present invention more comprehensible, the following specific embodiments are described in detail together with the accompanying drawings.
附图说明 Description of drawings
图1A是根据第一范例实施例所绘示的主机系统与存储器储存装置。FIG. 1A is a diagram illustrating a host system and a memory storage device according to a first exemplary embodiment.
图1B是根据本发明范例实施例所绘示的计算机、输入/输出装置与存储器储存装置的示意图。FIG. 1B is a schematic diagram of a computer, an input/output device and a memory storage device according to an exemplary embodiment of the present invention.
图1C是根据本发明范例实施例所绘示的主机系统与存储器储存装置的示意图。FIG. 1C is a schematic diagram of a host system and a memory storage device according to an exemplary embodiment of the present invention.
图2是绘示图1A所示的存储器储存装置的概要方块图。FIG. 2 is a schematic block diagram illustrating the memory storage device shown in FIG. 1A .
图3是根据第一范例实施例所绘示的存储器控制器的概要方块图。FIG. 3 is a schematic block diagram of a memory controller according to the first exemplary embodiment.
图4A与图4B是根据第一范例实施例所绘示的管理物理区块的范例示意图。FIG. 4A and FIG. 4B are exemplary schematic diagrams of managing physical blocks according to the first exemplary embodiment.
图5A~5G是绘示使用全局随机区写入数据的简化范例。5A-5G are simplified examples of writing data using the global random area.
图6是根据图5G所绘示的全局随机区搜寻表的简化范例。FIG. 6 is a simplified example of the global random region search table shown in FIG. 5G.
图7A与7B是绘示使用全局随机区写入数据与执行数据合并程序的简化范例。7A and 7B are simplified examples of writing data and performing data merging procedures using the global random area.
图8是根据第一范例实施例所绘示的索引编号映射表的范例。FIG. 8 is an example of an index number mapping table according to the first exemplary embodiment.
图9~图11是绘示的使用子物理单元来写入更新数据的范例。9 to 11 illustrate examples of using sub-physical units to write update data.
图12A与图12B是根据第一范例实施例所绘示的数据写入方法的流程图。12A and 12B are flowcharts of the data writing method according to the first exemplary embodiment.
图13是根据第二范例实施例所绘示的写入更新数据的流程图。FIG. 13 is a flow chart of writing update data according to the second exemplary embodiment.
图14是根据第三范例实施例所绘示的配置全局随机区的范例。FIG. 14 is an example of configuring the global random zone according to the third exemplary embodiment.
图15A与图15B是根据第三范例实施例所绘示的数据写入方法的流程图。15A and 15B are flowcharts of a data writing method according to a third exemplary embodiment.
[主要元件标号说明][Description of main component labels]
1000:主机系统1100:计算机1000: host system 1100: computer
1102:微处理器1104:随机存取存储器1102: Microprocessor 1104: Random Access Memory
1106:输入/输出装置1108:系统总线1106: input/output device 1108: system bus
1110:数据传输接口1202:鼠标1110: data transmission interface 1202: mouse
1204:键盘1206:显示器1204: keyboard 1206: monitor
1208:打印机1212:随身盘1208: Printer 1212: Pen drive
1214:存储卡1216:固态硬盘1214: memory card 1216: solid state drive
1310:数字相机1312:SD卡1310: digital camera 1312: SD card
1314:MMC卡1316:存储棒1314: MMC card 1316: memory stick
1318:CF卡1320:嵌入式储存装置1318: CF card 1320: Embedded storage device
100:存储器储存装置102:连接器100: memory storage device 102: connector
104:存储器控制器106:可复写式非易失性存储器模块104: memory controller 106: rewritable non-volatile memory module
202:存储器管理电路204:主机接口202: memory management circuit 204: host interface
206:存储器接口252:缓冲存储器206: memory interface 252: buffer memory
254:电源管理电路256:错误检查与校正电路254: Power management circuit 256: Error checking and correction circuit
410(0)~410(N):物理区块502:系统区410(0)~410(N): physical block 502: system area
504:数据区506:闲置区504: data area 506: idle area
508:取代区550:全局随机区508: Replacement area 550: Global random area
610(0)~610(K):物理单元710(0)~710(H):逻辑单元610(0)~610(K): physical unit 710(0)~710(H): logical unit
800:全局随机区搜寻表810(0)~810(4):根单元800: global random area search table 810 (0) ~ 810 (4): root unit
902:第一字段904:第二字段902: first field 904: second field
906:第三字段900:索引编号映射表906: third field 900: index number mapping table
S1201、S1203、S1211、S1213、S1215、S1217、S1219、S1221:数据写入方法的步骤S1201, S1203, S1211, S1213, S1215, S1217, S1219, S1221: steps of data writing method
S1301、S1303:数据写入方法的步骤S1301, S1303: Steps of the data writing method
550-1:第一全局随机区550-1: First Global Random Zone
550-2:第二全局随机区550-2: Second Global Random Area
S1501、S1503、S1511、S1513、S11515、S1517、S1519、S1521、S1523、S1525、S1527:数据写入方法的步骤S1501, S1503, S1511, S1513, S11515, S1517, S1519, S1521, S1523, S1525, S1527: steps of data writing method
具体实施方式 detailed description
[第一范例实施例][First Exemplary Embodiment]
一般而言,存储器储存装置(亦称,存储器储存系统)包括可复写式非易失性存储器模块与控制器(亦称,控制电路)。通常存储器储存装置是与主机系统一起使用,以使主机系统可将数据写入至存储器储存装置或从存储器储存装置中读取数据。Generally speaking, a memory storage device (also called a memory storage system) includes a rewritable non-volatile memory module and a controller (also called a control circuit). Typically memory storage devices are used with a host system so that the host system can write data to or read data from the memory storage device.
图1A是根据第一范例实施例所绘示的主机系统与存储器储存装置。FIG. 1A is a diagram illustrating a host system and a memory storage device according to a first exemplary embodiment.
请参照图1A,主机系统1000一般包括计算机1100与输入/输出(input/output,I/O)装置1106。计算机1100包括微处理器1102、随机存取存储器(randomaccessmemory,RAM)1104、系统总线1108与数据传输接口1110。输入/输出装置1106包括如图1B的鼠标1202、键盘1204、显示器1206与打印机1208。必须了解的是,图1B所示的装置非限制输入/输出装置1106,输入/输出装置1106可还包括其它装置。Referring to FIG. 1A , the host system 1000 generally includes a computer 1100 and an input/output (I/O) device 1106 . The computer 1100 includes a microprocessor 1102 , a random access memory (random access memory, RAM) 1104 , a system bus 1108 and a data transmission interface 1110 . The input/output device 1106 includes a mouse 1202, a keyboard 1204, a monitor 1206 and a printer 1208 as shown in FIG. 1B. It must be understood that the device shown in FIG. 1B is not limited to the I/O device 1106, and the I/O device 1106 may also include other devices.
在本发明实施例中,存储器储存装置100是通过数据传输接口1110与主机系统1000的其它元件电性连接。通过微处理器1102、随机存取存储器1104与输入/输出装置1106的运作可将数据写入至存储器储存装置100或从存储器储存装置100中读取数据。例如,存储器储存装置100可以是如图1B所示的随身盘1212、存储卡1214或固态硬盘(SolidStateDrive,SSD)1216等的可复写式非易失性存储器储存装置。In the embodiment of the present invention, the memory storage device 100 is electrically connected with other components of the host system 1000 through the data transmission interface 1110 . Data can be written into the memory storage device 100 or read from the memory storage device 100 through the operation of the microprocessor 1102 , the random access memory 1104 and the input/output device 1106 . For example, the memory storage device 100 may be a rewritable non-volatile memory storage device such as a pen drive 1212 , a memory card 1214 or a solid state drive (SSD) 1216 as shown in FIG. 1B .
一般而言,主机系统1000为可实质地与存储器储存装置100配合以储存数据的任意系统。虽然在本范例实施例中,主机系统1000是以计算机系统来作说明,然而,在本发明另一范例实施例中主机系统1000可以是数字相机、摄影机、通信装置、音频播放器或视频播放器等系统。例如,在主机系统为数字相机(摄影机)1310时,可复写式非易失性存储器储存装置则为其所使用的SD卡1312、MMC卡1314、存储棒(memorystick)1316、CF卡1318或嵌入式储存装置1320(如图1C所示)。嵌入式储存装置1320包括嵌入式多媒体卡(EmbeddedMMC,eMMC)。值得一提的是,嵌入式多媒体卡是直接电性连接于主机系统的基板上。In general, the host system 1000 is any system that can substantially cooperate with the memory storage device 100 to store data. Although in this exemplary embodiment, the host system 1000 is illustrated as a computer system, however, in another exemplary embodiment of the present invention, the host system 1000 may be a digital camera, video camera, communication device, audio player or video player and other systems. For example, when the host system is a digital camera (video camera) 1310, the rewritable non-volatile memory storage device is the SD card 1312, MMC card 1314, memory stick (memorystick) 1316, CF card 1318 or embedded type storage device 1320 (as shown in FIG. 1C ). The embedded storage device 1320 includes an embedded multimedia card (EmbeddedMMC, eMMC). It is worth mentioning that the embedded multimedia card is directly electrically connected to the substrate of the host system.
图2是绘示图1A所示的存储器储存装置的概要方块图。FIG. 2 is a schematic block diagram illustrating the memory storage device shown in FIG. 1A .
请参照图2,存储器储存装置100包括连接器102、存储器控制器104与可复写式非易失性存储器模块106。Referring to FIG. 2 , the memory storage device 100 includes a connector 102 , a memory controller 104 and a rewritable non-volatile memory module 106 .
在本范例实施例中,连接器102是相容于序列先进附件(SerialAdvancedTechnologyAttachment,SATA)标准。然而,必须了解的是,本发明不限于此,连接器102亦可以是符合并列先进附件(ParellelAdvancedTechnologyAttachment,PATA)标准、电气和电子工程师协会(InstituteofElectricalandElectronicEngineers,IEEE)1394标准、高速外围零件连接接口(PeripheralComponentInterconnectExpress,PCIExpress)标准、通用序列总线(UniversalSerialBus,USB)标准、安全数字(SecureDigital,SD)接口标准、存储棒(MemoryStick,MS)接口标准、多媒体储存卡(MultiMediaCard,MMC)接口标准、小型快闪(CompactFlash,CF)接口标准、集成式驱动电子接口(IntegratedDeviceElectronics,IDE)标准或其它适合的标准。In this exemplary embodiment, the connector 102 is compatible with the Serial Advanced Technology Attachment (SATA) standard. However, it must be understood that the present invention is not limited thereto, and the connector 102 may also be in accordance with the Parallel Advanced Technology Attachment (PATA) standard, the Institute of Electrical and Electronics Engineers (Institute of Electrical and Electronic Engineers, IEEE) 1394 standard, the high-speed peripheral component connection interface (Peripheral Component Interconnect Express , PCIExpress) standard, Universal Serial Bus (Universal Serial Bus, USB) standard, Secure Digital (SecureDigital, SD) interface standard, Memory Stick (MemoryStick, MS) interface standard, MultiMediaCard (MultiMediaCard, MMC) interface standard, small flash ( CompactFlash (CF) interface standard, Integrated Device Electronics (IDE) standard or other suitable standards.
存储器控制器104用以执行以硬件型式或固件型式实作的多个逻辑门或控制指令,并且根据主机系统1000的指令在可复写式非易失性存储器模块106中进行数据的写入、读取与抹除等运作。The memory controller 104 is used to execute a plurality of logic gates or control instructions implemented in hardware or firmware, and write and read data in the rewritable non-volatile memory module 106 according to the instructions of the host system 1000. Fetch and erase operations.
可复写式非易失性存储器模块106是电性连接至存储器控制器104,并且用以储存主机系统1000所写入的数据。可复写式非易失性存储器模块106具有物理区块410(0)~410(N)。例如,物理区块410(0)~410(N)可属于同一个存储器晶粒(die)或者属于不同的存储器晶粒。每一物理区块分别具有多个物理页面,并且每一物理页面具有至少一物理扇区,其中属于同一个物理区块的物理页面可被独立地写入且被同时地抹除。例如,每一物理区块是由128个物理页面所组成,并且每一物理页面具有8个物理扇区(sector)。也就是说,在每一物理扇区为512字节(byte)的例子中,每一物理页面的容量为4千字节(Kilobyte,K)。然而,必须了解的是,本发明不限于此,每一物理区块是可由64个物理页面、256个物理页面或其它任意个物理页面所组成。The rewritable non-volatile memory module 106 is electrically connected to the memory controller 104 and used for storing data written by the host system 1000 . The rewritable non-volatile memory module 106 has physical blocks 410(0)˜410(N). For example, the physical blocks 410(0)˜410(N) may belong to the same memory die or belong to different memory dies. Each physical block has a plurality of physical pages, and each physical page has at least one physical sector, wherein the physical pages belonging to the same physical block can be written independently and erased simultaneously. For example, each physical block is composed of 128 physical pages, and each physical page has 8 physical sectors. That is to say, in an example where each physical sector is 512 bytes (byte), the capacity of each physical page is 4 kilobytes (Kilobyte, K). However, it must be understood that the present invention is not limited thereto, and each physical block may be composed of 64 physical pages, 256 physical pages or any other number of physical pages.
更详细来说,物理区块为抹除的最小单位。亦即,每一物理区块含有最小数目的一并被抹除的存储单元。物理页面为可编程的最小单元。即,物理页面为写入数据的最小单元。然而,必须了解的是,在本发明另一范例实施例中,写入数据的最小单位亦可以是物理扇区或其它大小。每一物理页面通常包括数据位区与冗余位区。数据位区用以储存使用者的数据,而冗余位区用以储存系统的数据(例如,错误检查与校正码)。In more detail, a physical block is the smallest unit of erasure. That is, each physical block contains a minimum number of memory cells that are erased together. A physical page is the smallest unit of programming. That is, a physical page is the minimum unit for writing data. However, it must be understood that, in another exemplary embodiment of the present invention, the smallest unit of writing data may also be a physical sector or other sizes. Each physical page generally includes a data bit field and a redundant bit field. The data bit area is used to store user data, and the redundant bit area is used to store system data (eg, error checking and correction code).
在本范例实施例中,可复写式非易失性存储器模块106为多层存储单元(MultiLevelCell,MLC)NAND闪存模块。然而,本发明不限于此,可复写式非易失性存储器模块106亦可是单层存储单元(SingleLevelCell,SLC)NAND闪存模块、其它闪存模块或其它具有相同特性的存储器模块。In this exemplary embodiment, the rewritable non-volatile memory module 106 is a multi-level cell (MultiLevelCell, MLC) NAND flash memory module. However, the present invention is not limited thereto, and the rewritable non-volatile memory module 106 can also be a Single Level Cell (SLC) NAND flash memory module, other flash memory modules or other memory modules with the same characteristics.
图3是根据第一范例实施例所绘示的存储器控制器的概要方块图。FIG. 3 is a schematic block diagram of a memory controller according to the first exemplary embodiment.
请参照图3,存储器控制器104包括存储器管理电路202、主机接口204与存储器接口206。Referring to FIG. 3 , the memory controller 104 includes a memory management circuit 202 , a host interface 204 and a memory interface 206 .
存储器管理电路202用以控制存储器控制器104的整体运作。具体来说,存储器管理电路202具有多个控制指令,并且在存储器储存装置100运作时,此些控制指令会被执行以进行数据的写入、读取与抹除等运作。The memory management circuit 202 is used to control the overall operation of the memory controller 104 . Specifically, the memory management circuit 202 has a plurality of control commands, and when the memory storage device 100 is operating, these control commands are executed to perform operations such as writing, reading, and erasing data.
在本范例实施例中,存储器管理电路202的控制指令是以固件型式来实作。例如,存储器管理电路202具有微处理器单元(未绘示)与只读存储器(未绘示),并且此些控制指令是被烧录至此只读存储器中。当存储器储存装置100运作时,此些控制指令会由微处理器单元来执行以进行数据的写入、读取与抹除等运作。In this exemplary embodiment, the control commands of the memory management circuit 202 are implemented in the form of firmware. For example, the memory management circuit 202 has a microprocessor unit (not shown) and a ROM (not shown), and these control instructions are burned into the ROM. When the memory storage device 100 is in operation, these control instructions will be executed by the microprocessor unit to perform operations such as writing, reading, and erasing data.
在本发明另一范例实施例中,存储器管理电路202的控制指令亦可以程序码型式储存于可复写式非易失性存储器模块106的特定区域(例如,存储器模块中专用于存放系统数据的系统区)中。此外,存储器管理电路202具有微处理器单元(未绘示)、只读存储器(未绘示)及随机存取存储器(未绘示)。特别是,此只读存储器具有驱动码,并且当存储器控制器104被致能时,微处理器单元会先执行此驱动码段来将储存于可复写式非易失性存储器模块106中的控制指令加载至存储器管理电路202的随机存取存储器中。之后,微处理器单元会运转此些控制指令以进行数据的写入、读取与抹除等运作。此外,在本发明另一范例实施例中,存储器管理电路202的控制指令亦可以一硬件型式来实作。In another exemplary embodiment of the present invention, the control instructions of the memory management circuit 202 can also be stored in a specific area of the rewritable non-volatile memory module 106 in the form of program codes (for example, a system dedicated to storing system data in the memory module) area). In addition, the memory management circuit 202 has a microprocessor unit (not shown), a read only memory (not shown) and a random access memory (not shown). In particular, the ROM has driver code, and when the memory controller 104 is enabled, the microprocessor unit will first execute the driver code segment to store the control code stored in the rewritable non-volatile memory module 106. The instructions are loaded into random access memory of the memory management circuit 202 . Afterwards, the microprocessor unit will execute these control instructions to perform operations such as writing, reading and erasing data. In addition, in another exemplary embodiment of the present invention, the control instructions of the memory management circuit 202 can also be implemented in a hardware form.
主机接口204是电性连接至存储器管理电路202并且用以接收与识别主机系统1000所传送的指令与数据。也就是说,主机系统1000所传送的指令与数据会通过主机接口204来传送至存储器管理电路202。在本范例实施例中,主机接口204是兼容于SATA标准。然而,必须了解的是本发明不限于此,主机接口204亦可以是兼容于PATA标准、IEEE1394标准、PCIExpress标准、USB标准、SD标准、MS标准、MMC标准、CF标准、IDE标准或其它适合的数据传输标准。The host interface 204 is electrically connected to the memory management circuit 202 and used for receiving and identifying commands and data transmitted by the host system 1000 . That is to say, the commands and data transmitted by the host system 1000 are transmitted to the memory management circuit 202 through the host interface 204 . In this exemplary embodiment, the host interface 204 is compatible with the SATA standard. However, it must be understood that the present invention is not limited thereto, and the host interface 204 may also be compatible with the PATA standard, IEEE1394 standard, PCIExpress standard, USB standard, SD standard, MS standard, MMC standard, CF standard, IDE standard or other suitable Data transfer standard.
存储器接口206是电性连接至存储器管理电路202并且用以存取可复写式非易失性存储器模块106。也就是说,欲写入至可复写式非易失性存储器模块106的数据会经由存储器接口206转换为可复写式非易失性存储器模块106所能接受的格式。The memory interface 206 is electrically connected to the memory management circuit 202 and used for accessing the rewritable non-volatile memory module 106 . That is to say, the data to be written into the rewritable nonvolatile memory module 106 will be converted into a format acceptable to the rewritable nonvolatile memory module 106 via the memory interface 206 .
在本发明一范例实施例中,存储器控制器104还包括缓冲存储器252、电源管理电路254与错误检查与校正电路256。缓冲存储器252是电性连接至存储器管理电路202并且用以暂存来自于主机系统1000的数据与指令或来自于可复写式非易失性存储器模块106的数据。In an exemplary embodiment of the present invention, the memory controller 104 further includes a buffer memory 252 , a power management circuit 254 and an error checking and correction circuit 256 . The buffer memory 252 is electrically connected to the memory management circuit 202 and used for temporarily storing data and instructions from the host system 1000 or data from the rewritable non-volatile memory module 106 .
电源管理电路254是电性连接至存储器管理电路202并且用以控制存储器储存装置100的电源。The power management circuit 254 is electrically connected to the memory management circuit 202 and used to control the power of the memory storage device 100 .
错误检查与校正电路256是电性连接至存储器管理电路202并且用以执行错误检查与校正程序以确保数据的正确性。具体来说,当存储器管理电路202从主机系统1000中接收到写入指令时,错误检查与校正电路256会为对应此写入指令的数据产生对应的错误检查与校正码(ErrorCheckingandCorrectingCode,ECCCode),并且存储器管理电路202会将对应此写入指令的数据与对应的错误检查与校正码写入至可复写式非易失性存储器模块106中。之后,当存储器管理电路202从可复写式非易失性存储器模块106中读取数据时会同时读取此数据对应的错误检查与校正码,并且错误检查与校正电路256会依据此错误检查与校正码对所读取的数据执行错误检查与校正程序。The error checking and correcting circuit 256 is electrically connected to the memory management circuit 202 and used for executing error checking and correcting procedures to ensure the correctness of data. Specifically, when the memory management circuit 202 receives a write command from the host system 1000, the error checking and correction circuit 256 will generate a corresponding error checking and correcting code (Error Checking and Correcting Code, ECCC Code) for the data corresponding to the write command, And the memory management circuit 202 will write the data corresponding to the write command and the corresponding ECC code into the rewritable non-volatile memory module 106 . Afterwards, when the memory management circuit 202 reads data from the rewritable non-volatile memory module 106, it will simultaneously read the error checking and correction code corresponding to the data, and the error checking and correction circuit 256 will read the error checking and correction code according to the error checking and correction code. The correction code performs error checking and correction procedures on the read data.
图4A与图4B是根据第一范例实施例所绘示的管理物理区块的范例示意图。FIG. 4A and FIG. 4B are exemplary schematic diagrams of managing physical blocks according to the first exemplary embodiment.
请参照图4A,存储器控制器104的存储器管理电路202会将物理区块410(0)~410-(N)逻辑地分组为数据区502、闲置区504、系统区506与取代区508。Referring to FIG. 4A , the memory management circuit 202 of the memory controller 104 logically groups the physical blocks 410 ( 0 )˜410 −(N) into a data area 502 , an idle area 504 , a system area 506 and a replacement area 508 .
逻辑上属于数据区502与闲置区504的物理区块是用以储存来自于主机系统1000的数据。具体来说,数据区502的物理区块是被视为已储存数据的物理区块,而闲置区504的物理区块是用以替换数据区502的物理区块。也就是说,当从主机系统1000接收到写入指令与欲写入的数据时,存储器管理电路202会从闲置区504中提取物理区块,并且将数据写入至所提取的物理区块中,以替换数据区502的物理区块。The physical blocks logically belonging to the data area 502 and the spare area 504 are used to store data from the host system 1000 . Specifically, the physical blocks in the data area 502 are considered as stored data, and the physical blocks in the spare area 504 are used to replace the physical blocks in the data area 502 . That is to say, when receiving the write command and the data to be written from the host system 1000, the memory management circuit 202 will extract the physical block from the spare area 504, and write the data into the extracted physical block , to replace the physical blocks of the data area 502.
逻辑上属于系统区506的物理区块是用以记录系统数据。例如,系统数据包括关于可复写式非易失性存储器模块的制造商与型号、可复写式非易失性存储器模块的物理区块数、每一物理区块的物理页面数等。The physical blocks logically belonging to the system area 506 are used to record system data. For example, the system data includes the manufacturer and model of the rewritable nonvolatile memory module, the number of physical blocks of the rewritable nonvolatile memory module, the number of physical pages per physical block, and the like.
逻辑上属于取代区508中的物理区块是用于坏物理区块取代程序,以取代损坏的物理区块。具体来说,倘若取代区508中仍存有正常的物理区块并且数据区502的物理区块损坏时,存储器管理电路202会从取代区508中提取正常的物理区块来更换损坏的物理区块。Physical blocks that logically belong to the replacement area 508 are used in the bad physical block replacement process to replace damaged physical blocks. Specifically, if there are still normal physical blocks in the replacement area 508 and the physical blocks in the data area 502 are damaged, the memory management circuit 202 will extract normal physical blocks from the replacement area 508 to replace the damaged physical blocks piece.
请参照图4B,存储器管理电路202会将数据区502与闲置区504的物理区块410(0)~410(S-1)分组为物理单元610(0)~610(K),并且以物理单元为单位来管理物理区块。在本范例实施例中,每一物理单元是由1个物理区块所组成。然而,必须了解的是,本发明不限于此。在另一范例实施例中,每一物理单元亦可由属于同一存储器子模块或属于不同存储器子模块中的至少2个物理区块所组成。Please refer to FIG. 4B, the memory management circuit 202 will group the physical blocks 410(0)-410(S-1) of the data area 502 and the spare area 504 into physical units 610(0)-610(K), and Units are used to manage physical blocks. In this exemplary embodiment, each physical unit is composed of one physical block. However, it must be understood that the present invention is not limited thereto. In another exemplary embodiment, each physical unit may also be composed of at least two physical blocks belonging to the same memory sub-module or belonging to different memory sub-modules.
此外,存储器管理电路202会配置逻辑单元710(0)~710(H)以映射数据区502的物理单元,其中每一逻辑单元具有多个逻辑页面以依序地映射对应的物理单元的物理页面。在本范例实施例中,每一物理单元是由1个物理区块所组成,每一逻辑页面是映射1个物理页面(即,每一逻辑页面的容量为1个物理页面的容量)。然而,在每一物理单元是由多个物理区块所组成的例子中,每一逻辑页面亦可映射多个物理页面(即,每一逻辑页面的容量为多个物理页面的容量)。In addition, the memory management circuit 202 configures the logical units 710(0)˜710(H) to map the physical units of the data area 502, wherein each logical unit has a plurality of logical pages to sequentially map the physical pages of the corresponding physical unit . In this exemplary embodiment, each physical unit is composed of one physical block, and each logical page is mapped to one physical page (that is, the capacity of each logical page is the capacity of one physical page). However, in an example where each physical unit is composed of multiple physical blocks, each logical page can also map multiple physical pages (ie, the capacity of each logical page is the capacity of multiple physical pages).
在本范例实施例中,存储器管理电路202会维护逻辑单元-物理单元映射表(logicalunit-physicalunitmappingtable)以记录逻辑单元710(0)~710(H)与数据区502的物理单元的映射关系。例如,当主机系统1000欲存取某一逻辑存取地址时,存储器管理电路202可将主机系统1000所存取的逻辑存取地址转换为以对应的逻辑单元、逻辑页面与逻辑扇区所构成的地址,并且通过逻辑单元-物理单元映射表于对应的物理单元的物理页面中存取数据。In this exemplary embodiment, the memory management circuit 202 maintains a logical unit-physical unit mapping table to record the mapping relationship between the logical units 710 ( 0 )˜710 (H) and the physical units of the data area 502 . For example, when the host system 1000 intends to access a certain logical access address, the memory management circuit 202 can convert the logical access address accessed by the host system 1000 into a corresponding logical unit, logical page, and logical sector. address, and access data in the physical page of the corresponding physical unit through the logical unit-physical unit mapping table.
在本范例实施例中,存储器管理电路202会从闲置区504中提取物理单元作为全局随机区,并且将包含于来自主机系统1000的写入指令中的数据(亦称为更新数据)写入至全局随机区的物理单元(亦称为全局随机物理单元)中。在本范例实施例中,全局随机物理单元是设计来储存分别对应于不同逻辑单元的数据。In this exemplary embodiment, the memory management circuit 202 extracts physical units from the spare area 504 as a global random area, and writes the data (also called update data) included in the write command from the host system 1000 into In the physical unit of the global random area (also called the global random physical unit). In this exemplary embodiment, the global random physical unit is designed to store data respectively corresponding to different logical units.
具体来说,当存储器储存装置100从主机系统1000接收到写入指令时,来自于主机系统1000的写入指令中的数据可被依序地写入至全局随机区的物理单元中。并且,当此全局随机区的物理单元已被写满时,存储器管理电路202会再从闲置区504中提取物理单元作为另一个全局随机物理单元,以继续写入对应来自于主机系统1000的写入指令的更新数据。直到作为全局随机区的物理单元的数目已到达一上限值时,存储器管理电路202会执行数据合并程序,以使储存于全局随机物理单元中的数据成为无效数据,并且之后将所储存的数据皆为无效数据的全局随机物理单元关联回闲置区504。Specifically, when the memory storage device 100 receives a write command from the host system 1000, the data in the write command from the host system 1000 can be sequentially written into the physical units of the global random area. And, when the physical unit of the global random area is full, the memory management circuit 202 will extract the physical unit from the idle area 504 as another global random physical unit, so as to continue to write the corresponding write from the host system 1000 Update data for incoming instructions. When the number of the physical units serving as the global random area reaches an upper limit, the memory management circuit 202 will execute the data merging program, so that the data stored in the global random physical units become invalid data, and then the stored data The global random physical units that are all invalid data are associated back to the spare area 504 .
图5A~5G是绘示使用全局随机区写入数据的简化范例。5A-5G are simplified examples of writing data using the global random area.
为方便说明,在此假设数据区502具有5个物理单元,闲置区504具有4个物理单元,每一物理单元具有实3个物理页面,欲写入至每一物理单元的数据必须依照物理页面的顺序来被写入,并且作为全局随机物理单元的物理单元数的上限值为3。For the convenience of description, it is assumed that the data area 502 has 5 physical units, the free area 504 has 4 physical units, each physical unit has 3 physical pages, and the data to be written to each physical unit must be in accordance with the physical page to be written in order, and the upper limit value of the number of physical units as a global random physical unit is 3.
请参照图5A,在存储器储存装置100的初始状态中,逻辑单元710(0)~710(4)的逻辑页面可依序地映射数据区502的物理单元610(0)~610(4)的物理页面,并且闲置区504具有物理单元610(5)~610(8)。也就是说,存储器管理电路202会在逻辑单元-物理单元映射表中记录逻辑单元710(0)~710(4)与物理单元610(0)~610(4)之间的映射关系,并且将物理单元610(0)~610(4)的物理页面视为已储存属于逻辑单元710(0)~710(4)的逻辑页面的数据(即,初始数据ID1~ID15)。必须了解的是,在存储器储存装置100刚出厂时,初始数据ID1~ID15可能为空数据。此外,存储器管理电路202会记录闲置区504中可用的物理单元610(5)~610(8)。Please refer to FIG. 5A, in the initial state of the memory storage device 100, the logical pages of the logical units 710(0)-710(4) can be sequentially mapped to the physical units 610(0)-610(4) of the data area 502. physical pages, and the spare area 504 has physical units 610(5)-610(8). That is to say, the memory management circuit 202 will record the mapping relationship between the logical units 710(0)-710(4) and the physical units 610(0)-610(4) in the logical unit-physical unit mapping table, and will The physical pages of the physical units 610(0)-610(4) are considered to have stored the data belonging to the logical pages of the logical units 710(0)-710(4) (ie, initial data ID1-ID15). It must be understood that, when the memory storage device 100 is just shipped from the factory, the initial data ID1-ID15 may be empty data. In addition, the memory management circuit 202 records the available physical units 610 ( 5 )˜ 610 ( 8 ) in the spare area 504 .
请参照图5B,假设欲编程更新数据UD1并且更新数据UD1是属于逻辑单元710(0)的第1个逻辑页面时,存储器管理电路202会从闲置区504中提取物理单元610(5)作为全局随机区550的物理单元并且下达编程指令以将此更新数据UD1写入至物理单元610(5)的第0个物理页面。Please refer to FIG. 5B , assuming that the update data UD1 is to be programmed and the update data UD1 belongs to the first logical page of the logical unit 710(0), the memory management circuit 202 will extract the physical unit 610(5) from the spare area 504 as the global The physical unit of the random area 550 and a programming command is issued to write the update data UD1 into the 0th physical page of the physical unit 610(5).
请参照图5C,接续图5B,假设欲再编程更新数据UD2并且更新数据UD2是属于逻辑单元710(1)的第0个逻辑页面时,存储器管理电路202会下达编程指令以将此更新数据UD2写入至物理单元610(5)的第1个物理页面。Please refer to FIG. 5C , continuing FIG. 5B , assuming that the update data UD2 is to be reprogrammed and the update data UD2 belongs to the 0th logical page of the logic unit 710 (1), the memory management circuit 202 will issue a program instruction to update the update data UD2 Write to physical page 1 of physical unit 610(5).
请参照图5D,接续图5C,假设欲再编程更新数据UD3并且更新数据UD3是属于逻辑单元710(2)的第1个逻辑页面时,存储器管理电路202会下达编程指令以将此更新数据UD3写入至物理单元610(5)的第2个物理页面。Please refer to FIG. 5D , continuing to FIG. 5C , assuming that the update data UD3 is to be reprogrammed and the update data UD3 belongs to the first logical page of the logic unit 710(2), the memory management circuit 202 will issue a program instruction to update the update data UD3 Write to physical page 2 of physical unit 610(5).
请参照图5E,接续图5D,假设欲再编程更新数据UD4并且更新数据UD4是属于逻辑单元710(3)的第0个逻辑页面时,由于全局随机物理单元610(5)已无储存空间,因此,存储器管理电路202会从闲置区504中提取物理单元610(6)作为全局随机区550的物理单元并且下达编程指令以将此更新数据UD4写入至物理单元610(6)的第0个物理页面。Please refer to FIG. 5E , continuing FIG. 5D , assuming that the update data UD4 is to be reprogrammed and the update data UD4 belongs to the 0th logical page of the logical unit 710(3), since the global random physical unit 610(5) has no storage space, Therefore, the memory management circuit 202 will extract the physical unit 610(6) from the spare area 504 as the physical unit of the global random area 550 and issue a programming instruction to write the update data UD4 into the 0th physical unit 610(6) physical page.
请参照图5F,接续图5E,假设欲再编程更新数据UD5并且更新数据UD5是属于逻辑单元710(3)的第1个逻辑页面时,存储器管理电路202会下达编程指令以将此更新数据UD5写入至物理单元610(6)的第1个物理页面。Please refer to FIG. 5F , continuing to FIG. 5E , assuming that the update data UD5 is to be reprogrammed and the update data UD5 belongs to the first logical page of the logic unit 710 (3), the memory management circuit 202 will issue a program instruction to update the update data UD5 Write to physical page 1 of physical unit 610(6).
请参照图5G,接续图5F,假设欲再编程更新数据UD6并且更新数据UD6是属于逻辑单元710(0)的第2个逻辑页面时,存储器管理电路202会下达编程指令以将此更新数据UD6写入至物理单元610(6)的第2个物理页面。Please refer to FIG. 5G , continuing FIG. 5F , assuming that the update data UD6 is to be reprogrammed and the update data UD6 belongs to the second logical page of the logic unit 710 (0), the memory management circuit 202 will issue a program instruction to update the update data UD6 Write to physical page 2 of physical unit 610(6).
为了能够识别储存于全局随机区的物理单元中的数据是属于那个逻辑单元(亦称为已更新逻辑单元)的那个逻辑页面(亦称为已更新逻辑页面),在本范例实施例中,存储器管理电路202会建立全局随机区搜寻表,以利有效数据的搜寻。在此,暂存于全局随机区中的更新数据所属的逻辑页面称为已更新逻辑页面并且已更新逻辑页面所属的逻辑单元区块称为已更新逻辑单元。在全局随机区搜寻表中,存储器管理电路202会建立多个根单元并且为每一根单元配置一登录链接。特别是,存储器管理电路202会将逻辑单元的逻辑页面分组来分别地对应至其中一个根单元,并且将已更新逻辑页面的更新信息记录在对应的根单元的登录链接上。基此,当欲在全局随机物理单元中搜寻特定逻辑单元的更新数据时,仅需搜寻对应的根单元的登录链接。In order to be able to identify that the data stored in the physical unit of the global random area belongs to that logical page (also called updated logical page) of that logical unit (also called updated logical unit), in this exemplary embodiment, the memory The management circuit 202 will establish a global random area search table to facilitate the search of valid data. Here, the logical page to which the updated data temporarily stored in the global random area belongs is called an updated logical page and the logical unit block to which the updated logical page belongs is called an updated logical unit. In the global random area search table, the memory management circuit 202 will create multiple root units and configure a login link for each root unit. In particular, the memory management circuit 202 groups the logical pages of the logical units to respectively correspond to one of the root units, and records the update information of the updated logical pages on the login link of the corresponding root unit. Based on this, when it is desired to search for update data of a specific logical unit in the global random physical unit, it is only necessary to search for the login link of the corresponding root unit.
例如,在本范例实施例中,存储器管理电路202会每一逻辑单元的逻辑页面分别地对应至同一个根单元。也就是,同一个逻辑单元的逻辑页面是对应同一个根单元。必须了解的是,本发明不限于此,例如,在本发明另一范例实施中,亦可将一个逻辑单元的一部份逻辑页面分组至一个根单元并且将此逻辑单元的另一部分逻辑页面分组至另一根单元。For example, in this exemplary embodiment, the memory management circuit 202 maps the logical pages of each logical unit to the same root unit. That is, the logical pages of the same logical unit correspond to the same root unit. It must be understood that the present invention is not limited thereto. For example, in another exemplary implementation of the present invention, a part of logical pages of a logical unit may also be grouped into a root unit and another part of logical pages of this logical unit may be grouped to another unit.
此外,存储器管理电路202会为每一根单元分别地配置一个登录链接并且每当执行写入指令时,存储器管理电路202会在对应的登录链接上建立登录以记录关于此写入指令的更新信息。例如,每一登录包括第一字段(例如,图6的字段902)、第二字段(例如,图6的字段904)与第三字段(例如,图6的字段906),其中第一字段记录已更新逻辑页面的地址,第二字段用以记录储存此已更新逻辑页面的更新数据的物理地址,并且第三字段用以标记此登录是否有效。在此,若此登录为有效,则第三字段例如会被标记为‘1’;并且若此登录为无效,则第三字段例如会被标记为‘0’。必须了解的是,在此标记有效登录与无效登录的方式,不限于此。例如,亦可以‘1’代表无效登录并且以‘0’代表有效登录。In addition, the memory management circuit 202 will configure a login link for each root unit and whenever a write command is executed, the memory management circuit 202 will create a login on the corresponding login link to record the update information about the write command . For example, each entry includes a first field (for example, field 902 in FIG. 6 ), a second field (for example, field 904 in FIG. 6 ) and a third field (for example, field 906 in FIG. 6 ), wherein the first field records The address of the updated logical page, the second field is used to record the physical address for storing the updated data of the updated logical page, and the third field is used to mark whether the registration is valid. Here, if the registration is valid, the third field will be marked as '1'; and if the registration is invalid, the third field will be marked as '0', for example. It must be understood that the method of marking valid logins and invalid logins is not limited to this. For example, it is also possible to use '1' to represent an invalid login and '0' to represent a valid login.
图6是根据图5G所绘示的全局随机区搜寻表的简化范例。FIG. 6 is a simplified example of the global random region search table shown in FIG. 5G.
请参照图6,全局随机区搜寻表800包括根单元810(0)~810(4),其中逻辑单元710(0)的逻辑页面是对应根单元810(0),逻辑单元710(1)的逻辑页面是对应根单元810(1),逻辑单元710(2)的逻辑页面是对应根单元810(2),逻辑单元710(3)的逻辑页面是对应根单元810(3),并且逻辑单元710(4)的逻辑页面是对应根单元810(4)。Please refer to FIG. 6, the global random area search table 800 includes root units 810(0)-810(4), wherein the logical page of the logical unit 710(0) corresponds to the root unit 810(0), and the logical page of the logical unit 710(1) The logical page is for root unit 810(1), the logical page for logical unit 710(2) is for root unit 810(2), the logical page for logical unit 710(3) is for root unit 810(3), and logical unit 710(2) is for root unit 810(3). The logical page of 710(4) is the corresponding root unit 810(4).
在根单元810(0)的登录链接中包含2个有效登录,以记录逻辑单元710(0)的第1个逻辑页面(即,信息″710(0)-1″)与第2个逻辑页面(即,信息″710(0)-2″)已被更新,其中逻辑单元710(0)的第1个逻辑页面的更新数据被写入至物理单元610(5)的第0个物理页面(即,信息″610(5)-0″)中并且逻辑单元710(0)的第2个逻辑页面的更新数据被写入至物理单元610(6)的第2个物理页面(即,信息″610(6)-2″)中。Include 2 valid logins in the login link of root unit 810(0) to record the 1st logical page (ie, information "710(0)-1") and the 2nd logical page of logical unit 710(0) (i.e., information "710(0)-2") has been updated, wherein the updated data of logical page 1 of logical unit 710(0) is written to physical page 0 of physical unit 610(5) ( That is, the updated data in the information "610(5)-0") and the second logical page of the logical unit 710(0) is written to the second physical page of the physical unit 610(6) (ie, the information " 610(6)-2″).
在根单元810(1)的登录链接中包含1个有效登录,以记录逻辑单元710(1)的第0个逻辑页面(即,信息″710(1)-0″)已被更新,其中逻辑单元710(1)的第0个逻辑页面的更新数据被写入至物理单元610(5)的第1个物理页面(即,信息″610(5)-1″)中。Include 1 valid login in the login link of root unit 810(1) to record that logical page 0 of logical unit 710(1) (i.e., information "710(1)-0") has been updated, where logical The update data of the 0th logical page of unit 710(1) is written into the 1st physical page of physical unit 610(5) (ie, information "610(5)-1").
在根单元810(2)的登录链接中包含1个有效登录,以记录逻辑单元710(2)的第1个逻辑页面(即,信息″710(2)-1″)已被更新,其中逻辑单元710(2)的第1个逻辑页面的更新数据被写入至物理单元610(5)的第2个物理页面(即,信息″610(5)-2″)中。Include 1 valid login in the login link of root unit 810(2) to record that the 1st logical page of logical unit 710(2) (i.e., information "710(2)-1") has been updated, where logical The update data of the 1st logical page of unit 710(2) is written into the 2nd physical page of physical unit 610(5) (ie, information "610(5)-2").
在根单元810(3)的登录链接中包含2个有效登录,以记录逻辑单元710(3)的第0个逻辑页面(即,信息″710(3)-0″)与第1个逻辑页面(即,信息″710(3)-1″)已被更新,其中逻辑单元710(3)的第0个逻辑页面的更新数据被写入至物理单元610(6)的第0个物理页面(即,信息″610(6)-0″)中并且逻辑单元710(3)的第1个逻辑页面的更新数据被写入至物理单元610(6)的第1个物理页面(即,信息″610(6)-1″)中。Include 2 valid entries in the entry link of the root unit 810(3) to record the 0th logical page (i.e., information "710(3)-0") and the 1st logical page of the logical unit 710(3) (i.e., information "710(3)-1") has been updated, wherein the updated data of the 0th logical page of logical unit 710(3) is written to the 0th physical page of physical unit 610(6) ( That is, the updated data in the information "610(6)-0") and the first logical page of the logical unit 710(3) is written to the first physical page of the physical unit 610(6) (ie, the information " 610(6)-1″).
此外,在根单元810(0)~810(4)的登录链接中分别地会包含1个空的登录,以表示登录链接的结束。例如,倘若欲在全局随机物理单元中搜寻属于逻辑单元710(4)的数据时,存储器管理单元202可根据根单元810(4)的登录链接仅有空的登录,而识别出全局随机物理单元中未储存属于逻辑单元710(4)的数据,由此可直接依据逻辑单元-物理单元映射表的信息从对应的物理单元的物理页面中读取数据。In addition, one empty entry is included in the entry links of the root units 810 ( 0 ) to 810 ( 4 ), indicating the end of the entry links. For example, if it is desired to search for data belonging to the logical unit 710(4) in the global random physical unit, the memory management unit 202 can identify the global random physical unit according to the entry link of the root unit 810(4) with only empty entries No data belonging to the logical unit 710(4) is stored in the logical unit 710(4), so the data can be directly read from the physical page of the corresponding physical unit according to the information in the logical unit-physical unit mapping table.
以此类推,存储器管理电路202会依序地将主机系统1000欲储存的数据写入至作为全局随机区的物理单元中。特别是,当全局随机区的物理单元的数目达到3时,存储器管理电路202会在执行写入指令时一并执行数据合并程序,以防止闲置区的物理单元被用尽。By analogy, the memory management circuit 202 will sequentially write the data to be stored by the host system 1000 into the physical unit serving as the global random area. In particular, when the number of physical units in the global random area reaches 3, the memory management circuit 202 will execute the data consolidation process when executing the write command, so as to prevent the physical units in the free area from being used up.
图7A与7B是绘示使用全局随机区写入数据与执行数据合并程序的简化范例。7A and 7B are simplified examples of writing data and performing data merging procedures using the global random area.
请参照图7A,接续图5G,假设欲再编程更新数据UD7并且更新数据UD7是属于逻辑单元710(2)的第0个逻辑页面时,由于全局随机物理单元610(6)已无储存空间,因此,存储器管理电路202会从闲置区504中提取物理单元610(7)作为全局随机区550的物理单元并且下达编程指令以将此更新数据UD7写入至物理单元610(7)的第0个物理页面。特别是,由于作为全局随机区550的物理单元的数目已达到3,因此,存储器管理电路202在执行图7B所示的写入运作后会执行数据合并程序。也就是说,在此例子中,在执行此次写入指令期间,存储器管理电路202会一并执行数据合并程序。Please refer to FIG. 7A , continuing FIG. 5G , assuming that the update data UD7 is to be reprogrammed and the update data UD7 belongs to the 0th logical page of the logical unit 710(2), since the global random physical unit 610(6) has no storage space, Therefore, the memory management circuit 202 will extract the physical unit 610(7) from the spare area 504 as a physical unit of the global random area 550 and issue a programming instruction to write the update data UD7 into the 0th physical unit 610(7) physical page. In particular, since the number of physical units serving as the global random area 550 has reached 3, the memory management circuit 202 executes the data consolidation procedure after executing the writing operation shown in FIG. 7B . That is to say, in this example, during the execution of the write command, the memory management circuit 202 will also execute the data merging procedure.
请参照图7B,假设存储器管理电路202选择逻辑单元710(0)来进行数据合并时,存储器管理电路202会识别逻辑单元710(0)是映射物理单元610(0),从闲置区504提取物理单元610(8),并且将物理单元610(0)以及全局随机区550中属于逻辑单元710(0)的有效数据复制到物理单元610(8)中。具体来说,存储器管理电路202会依序地将物理单元610(0)中的数据ID1、物理单元610(5)中的UD1与物理单元610(6)中的数据UD6写入至物理单元610(8)的第0~2个物理页面中,并且将物理单元610(5)的第1个物理页面与物理单元610(6)的第2个物理页面标示为无效(如斜线所示)。之后,存储器管理电路202会对物理单元610(0)执行抹除运作,在逻辑单元-物理单元映射表中将逻辑单元710(0)重新映射至物理单元610(8),并且将物理单元610(0)关联至闲置区504。Please refer to FIG. 7B , assuming that the memory management circuit 202 selects the logical unit 710(0) for data merging, the memory management circuit 202 will recognize that the logical unit 710(0) is a mapped physical unit 610(0), and extract the physical unit 610(0) from the spare area 504. Unit 610(8), and copy valid data belonging to logical unit 710(0) in physical unit 610(0) and global random area 550 to physical unit 610(8). Specifically, the memory management circuit 202 will sequentially write the data ID1 in the physical unit 610(0), the data UD1 in the physical unit 610(5) and the data UD6 in the physical unit 610(6) to the physical unit 610 (8) in the 0th to 2nd physical pages, and mark the first physical page of the physical unit 610(5) and the second physical page of the physical unit 610(6) as invalid (as shown by the slash) . Afterwards, the memory management circuit 202 performs an erase operation on the physical unit 610(0), remaps the logical unit 710(0) to the physical unit 610(8) in the logical unit-physical unit mapping table, and transfers the physical unit 610 (0) is associated to the spare area 504 .
例如,当执行下一个写入指令时,存储器管理电路202会对逻辑单元710(1)执行数据合并程序,并且之后再执行下一个写入指令时,存储器管理电路202会对逻辑单元710(2)执行数据合并程序。因此,在物理单元610(7)的储存空间被填满时,物理单元610(5)中的数据皆会成为无效数据。基此,存储器管理电路202可对物理单元610(5)执行抹除运作并将抹除后的物理单元610(5)关联回闲置区504。For example, when executing the next write instruction, the memory management circuit 202 will execute the data consolidation program on the logic unit 710(1), and then when executing the next write instruction, the memory management circuit 202 will execute the data consolidation program on the logic unit 710(2). ) to execute the data merging procedure. Therefore, when the storage space of the physical unit 610(7) is full, all the data in the physical unit 610(5) will become invalid data. Based on this, the memory management circuit 202 can perform an erase operation on the physical unit 610 ( 5 ) and associate the erased physical unit 610 ( 5 ) back to the spare area 504 .
或者,例如,当执行下一个写入指令时,存储器管理电路202会对逻辑单元710(3)执行数据合并程序。因此,在物理单元610(7)的储存空间被填满之前,物理单元610(6)中的数据皆会成为无效数据。基此,存储器管理电路202可对物理单元610(6)执行抹除运作并将抹除后的物理单元610(6)关联回闲置区504。Or, for example, when executing the next write command, the memory management circuit 202 will perform a data consolidation procedure on the logic unit 710(3). Therefore, before the storage space of the physical unit 610(7) is filled, the data in the physical unit 610(6) will become invalid data. Based on this, the memory management circuit 202 can perform an erase operation on the physical unit 610 ( 6 ) and associate the erased physical unit 610 ( 6 ) back to the spare area 504 .
基此,根据上述运作,存储器管理电路202可持续将已储存无效数据的物理单元关联回闲置区504并且从闲置区504中提取空的物理单元作为全局随机物理单元。Therefore, according to the above operations, the memory management circuit 202 can continuously associate the physical units storing invalid data back to the spare area 504 and extract empty physical units from the spare area 504 as global random physical units.
值得一提的是,在本范例实施例中,暂存于全局随机区550的更新数据所属的逻辑单元的数目会被限制不大于预设数目。也就是说,在同一时间,存储器管理电路202仅会在全局随机区550中暂存部分逻辑单元的更新数据,并且此部分逻辑单元的数目不大于预设数目。也就是说,此预设数会被设定为小于逻辑单元的总数。It is worth mentioning that, in this exemplary embodiment, the number of logical units to which the update data temporarily stored in the global random area 550 belongs is limited to not more than a preset number. That is to say, at the same time, the memory management circuit 202 only temporarily stores the update data of some logic units in the global random area 550 , and the number of this part of logic units is not greater than the preset number. That is to say, the preset number is set to be smaller than the total number of logical units.
具体来说,如上所述,在全局随机区搜寻表中,已更新逻辑页面的地址是通过记录在第一字段中的信息来识别。因此,在已知技术所使用的全局随机区搜寻表中,第一字段的大小必须足够记录能够区别所有逻辑页面的信息。例如,倘若逻辑单元的数目为1024个时,在已知技术所使用的全局随机区搜寻表中第一字段必须被配置10个位才能够区别所有逻辑页面的信息。Specifically, as mentioned above, in the global random area search table, the address of the updated logical page is identified by the information recorded in the first field. Therefore, in the global random area lookup table used in the prior art, the size of the first field must be sufficient to record information capable of distinguishing all logical pages. For example, if the number of logical units is 1024, the first field in the global random area search table used in the known technology must be configured with 10 bits to be able to distinguish the information of all logical pages.
在本范例实施例中,第一字段902的大小被设计为较小并且无法记录能够区别所有逻辑页面的信息。例如,第一字段902的大小为7个位,并且仅能记录用以区别128个逻辑单元的逻辑页面地址的信息(即,索引编号)。因此,上述预设数目会被设定为128并且存储器管理电路202最多仅会在全局随机区550中暂存属于128个逻辑单元的更新数据。基此,全局随机区搜寻表800的大小能够有效地被缩小,以利被加载至容量较小的缓冲存储器252中。In this exemplary embodiment, the size of the first field 902 is designed to be small and cannot record information capable of distinguishing all logical pages. For example, the size of the first field 902 is 7 bits, and can only record information (ie, index numbers) for distinguishing logical page addresses of 128 logical units. Therefore, the aforementioned preset number is set to 128 and the memory management circuit 202 only temporarily stores update data belonging to 128 logical units in the global random area 550 at most. Based on this, the size of the global random area search table 800 can be effectively reduced, so as to be loaded into the buffer memory 252 with a smaller capacity.
当属于一个逻辑单元的逻辑页面的更新数据被写入至全局随机区550,存储器管理电路202会分配一个索引编号给此逻辑单元并且根据此索引编号在全局随机区搜寻表800记录此逻辑页面的更新信息。例如,在本范例实施例中,索引编号的范围为‘0’~‘127’并且存储器管理电路202会配置索引编号映射表来记录目前设定给每一已更新逻辑单元的索引编号。也就是说,每一个更新逻辑单元会被配置其中一个索引编号(即,‘0’~‘127’)并且索引编号会被记录在全局随机区搜寻表800的第一字段中以取代原本记录在第一字段中关于逻辑页面所属的逻辑单元的部分。When the update data of the logical page belonging to a logical unit is written into the global random area 550, the memory management circuit 202 will assign an index number to the logical unit and record the logical page in the global random area search table 800 according to the index number Update information. For example, in this exemplary embodiment, the range of index numbers is '0'˜127' and the memory management circuit 202 configures an index number mapping table to record the index number currently assigned to each updated logical unit. That is to say, each update logic unit will be configured with one of the index numbers (ie, '0'~'127') and the index number will be recorded in the first field of the global random area search table 800 to replace the original record in The part of the first field about the logical unit to which the logical page belongs.
图8是根据第一范例实施例所绘示的索引编号映射表的范例。FIG. 8 is an example of an index number mapping table according to the first exemplary embodiment.
请参照图8,假设属于逻辑单元710(0)的第0个逻辑页面的更新数据被写入至全局随机区550时,存储器管理电路202会将索引编号映射表900中未被使用的索引编号‘0’指派给逻辑单元710(0)。Please refer to FIG. 8 , assuming that the update data of the 0th logical page belonging to the logical unit 710 (0) is written into the global random area 550, the memory management circuit 202 will map the unused index numbers in the index number mapping table 900 '0' is assigned to logical unit 710(0).
此外,在进行数据合并程序(如图7B所示)之后,倘若全局随机区550已无储存属于逻辑单元710(0)的更新数据时,指派给逻辑单元710(0)的索引编号‘0’会被取消。基此,在后续的写入运作时,索引编号‘0’可再被指派给其它更新逻辑单元。In addition, after the data merging procedure (as shown in FIG. 7B ), if the global random area 550 does not store any updated data belonging to the logical unit 710(0), the index number '0' assigned to the logical unit 710(0) will be cancelled. Based on this, during subsequent write operations, the index number '0' can be assigned to other updating logical units.
也就是说,当主机系统1000欲储存数据至某一个逻辑单元的某一个逻辑页面时,存储器管理电路202会判断全局随机区550是否已存有属于此逻辑单元的数据。例如,存储器管理电路202会根据索引编号映射表来判断此逻辑单元是否已被指派一个索引编号,其中当此逻辑单元已被指派一个索引编号时表示全局随机区550已存有属于此逻辑单元的数据。当全局随机区550已存有属于此逻辑单元的数据,存储器管理电路202会将属于此逻辑页面的更新数据写入至全局随机区550并且使用指派给此逻辑单元的索引编号来在全局随机区搜寻表中记录对应此逻辑页面的更新数据。That is to say, when the host system 1000 intends to store data in a certain logical page of a certain logical unit, the memory management circuit 202 will determine whether the global random area 550 has stored data belonging to the logical unit. For example, the memory management circuit 202 will judge whether the logical unit has been assigned an index number according to the index number mapping table, wherein when the logical unit has been assigned an index number, it means that the global random area 550 has already stored the data. When the global random area 550 has already stored the data belonging to this logical unit, the memory management circuit 202 will write the update data belonging to this logical page into the global random area 550 and use the index number assigned to this logical unit to write in the global random area The update data corresponding to this logical page is recorded in the search table.
当全局随机区550未存有属于此逻辑单元的数据,存储器管理电路202会判断暂存于全局随机区550的更新数据所属的逻辑单元的数目是否小于预设数目。例如,存储器管理电路202会判断索引编号映射表中是否还有未被指派的索引编号,其中当索引编号映射表中还有未被指派的索引编号时表示暂存于全局随机区550的更新数据所属的逻辑单元的数目小于预设数目。When the global random area 550 does not store data belonging to the logical unit, the memory management circuit 202 determines whether the number of logical units to which the updated data temporarily stored in the global random area 550 belongs is less than a preset number. For example, the memory management circuit 202 will determine whether there are unassigned index numbers in the index number mapping table, wherein when there are unassigned index numbers in the index number mapping table, it means the update data temporarily stored in the global random area 550 The number of logical units it belongs to is less than the preset number.
倘若暂存于全局随机区550的更新数据所属的逻辑单元的数目小于预设数目时,存储器管理电路202会将一个未使用的索引编号指派给此逻辑单元,将属于此逻辑页面的更新数据写入至全局随机区550并且使用指派给此逻辑单元的索引编号来在全局随机区搜寻表中记录对应此逻辑页面的更新数据。If the number of logical units to which the update data temporarily stored in the global random area 550 belongs is less than the preset number, the memory management circuit 202 will assign an unused index number to this logical unit, and write the update data belonging to this logical page Enter the global random area 550 and use the index number assigned to this logical unit to record the update data corresponding to this logical page in the global random area lookup table.
倘若暂存于全局随机区550的更新数据所属的逻辑单元的数目非小于预设数目(即,已无空的索引编号可指派给欲写入的逻辑单元)时,存储器管理电路202会从闲置区504中提取一个物理单元作为子物理单元来写入更新数据。If the number of logical units to which the update data temporarily stored in the global random area 550 belongs is not less than the preset number (that is, there is no empty index number that can be assigned to the logical unit to be written), the memory management circuit 202 will start from idle One physical unit is extracted from area 504 as a sub-physical unit to write update data.
图9~图11是绘示的使用子物理单元来写入更新数据的范例。9 to 11 illustrate examples of using sub-physical units to write update data.
请同时参照图9~图11,例如,在逻辑单元710(0)是映射至物理单元610(0)的映射状态下,当存储器控制器104从主机系统1000中接收到写入指令而欲写入数据至属于逻辑单元710(0)的逻辑页面时,存储器管理电路202依据逻辑单元-物理单元映射表识别逻辑单元710(0)目前是映射至物理单元610(0)并且从闲置区504中提取物理单元610(H+1)来轮替物理单元610(0)。然而,当新数据写入至物理单元610(H+1)的同时,存储器管理电路202可不用立刻将物理单元610(0)中的所有有效数据搬移至物理单元610(H+1)而抹除物理单元610(0)。具体来说,存储器管理电路202会从物理单元610(0)中读取欲写入物理页面之前的有效数据(即,物理单元610(0)的第0物理页面与第1物理页面中的数据)。之后,存储器控制器104会将物理单元610(0)中欲写入物理页面之前的有效数据写入至物理单元610(H+1)的第0物理页面与第1物理页面中(如图9所示),并且将新数据写入至物理单元610(H+1)的第2~4个物理页面中(如图10所示)。此时,存储器控制器104即完成写入的运作。因为物理单元610(0)中的有效数据有可能在下个操作(例如,写入指令)中变成无效,因此立刻将物理单元610(0)中的有效数据搬移至物理单元610(H+1)可能会造成无谓的搬移。此外,数据必须依序地写入至物理单元内的物理页面,因此,存储器管理电路202可先搬移欲写入物理页面之前的有效数据(即,储存在物理单元610(0)的第0物理页面与第0物理页面中数据),并且暂不搬移其余有效数据(即,储存在物理单元610(0)的第5~K物理页面中数据)。Please refer to FIGS. 9 to 11 at the same time. For example, in the mapping state where the logical unit 710(0) is mapped to the physical unit 610(0), when the memory controller 104 receives a write command from the host system 1000 and wants to write When inputting data to the logical page belonging to the logical unit 710(0), the memory management circuit 202 identifies that the logical unit 710(0) is currently mapped to the physical unit 610(0) according to the logical unit-physical unit mapping table. Physical unit 610(H+1) is fetched to replace physical unit 610(0). However, when new data is written into the physical unit 610(H+1), the memory management circuit 202 can erase all the valid data in the physical unit 610(0) to the physical unit 610(H+1) immediately. Except physical unit 610(0). Specifically, the memory management circuit 202 will read from the physical unit 610(0) the valid data before the physical page to be written (that is, the data in the 0th physical page and the 1st physical page of the physical unit 610(0) ). Afterwards, the memory controller 104 will write the valid data before the physical page in the physical unit 610(0) into the 0th physical page and the 1st physical page of the physical unit 610(H+1) (as shown in FIG. 9 ), and write new data into the second to fourth physical pages of the physical unit 610 (H+1) (as shown in FIG. 10 ). At this point, the memory controller 104 completes the writing operation. Because the valid data in the physical unit 610(0) may become invalid in the next operation (for example, a write command), the valid data in the physical unit 610(0) is immediately moved to the physical unit 610(H+1 ) may cause unnecessary movement. In addition, data must be sequentially written to the physical pages in the physical unit. Therefore, the memory management circuit 202 can first move the valid data before the physical page to be written (that is, the 0th physical page stored in the physical unit 610(0) page and the data in the 0th physical page), and the remaining valid data (that is, the data stored in the 5th-K physical pages of the physical unit 610(0)) is not moved temporarily.
在本范例实施例中,暂时地维持此等瞬时关系的运作称为开启(open)母子区块,并且原物理单元(例如,上述物理单元610(0))称为母物理单元而用以替换母物理单元的物理单元(例如,上述与物理单元610(H+1))称为子物理单元。In this exemplary embodiment, the operation of temporarily maintaining these instantaneous relationships is called opening (opening) the parent-child block, and the original physical unit (for example, the above-mentioned physical unit 610(0)) is called the parent physical unit to replace A physical unit of a parent physical unit (for example, the aforementioned AND physical unit 610(H+1)) is called a child physical unit.
之后,当需要将物理单元610(0)与物理单元610(H+1)的数据合并(merge)时,存储器控制器104会将物理单元610(0)与物理单元610(H+1)的数据整并至一个物理单元,由此提升物理单元的使用效率。在此,合并母子区块的运作称为数据合并程序或关闭(close)母子区块。例如,如图11所示,当进行关闭母子区块时,存储器管理电路202会从物理单元610(0)中读取剩余的有效数据(即,物理单元610(0)的第5~K物理页面中的数据),将物理单元610(0)中剩余的有效数据写入至物理单元610(H+1)的第5物理页面~第K物理页面中,对物理单元610(0)执行抹除操作,抹除后的物理单元610(0)关联至闲置区504并且将物理单元610(H+1)关联至数据区502。也就是说,存储器控制器104会在逻辑单元-物理单元映射表中将逻辑单元710(0)重新映射至物理单元610(H+1)。值得一提的是,闲置区504中物理单元的数目是有限的,基此,在存储器储存装置100运作期间,已开启的母子区块组的数目亦会受到限制。因此,当存储器储存装置100接收到来自于主机系统1000的写入指令时,倘若已开启母子区块组的数目达到上限时,存储器控制器104需关闭至少一组目前已开启的母子区块组后才可执行此写入指令。Afterwards, when the data of the physical unit 610(0) and the physical unit 610(H+1) need to be merged (merge), the memory controller 104 will merge the data of the physical unit 610(0) and the physical unit 610(H+1) The data is consolidated into one physical unit, thereby improving the efficiency of using the physical unit. Here, the operation of merging the parent and child blocks is called a data merging process or closing the parent and child blocks. For example, as shown in FIG. 11, when closing the parent-child block, the memory management circuit 202 will read the remaining valid data from the physical unit 610(0) (that is, the 5th to K physical units of the physical unit 610(0) page), write the remaining valid data in the physical unit 610(0) into the fifth physical page to the Kth physical page of the physical unit 610(H+1), and execute the erase operation on the physical unit 610(0). In the erase operation, the erased physical unit 610 ( 0 ) is associated to the spare area 504 and the physical unit 610 (H+1) is associated to the data area 502 . That is, the memory controller 104 remaps the logical unit 710(0) to the physical unit 610(H+1) in the logical unit-physical unit mapping table. It is worth mentioning that the number of physical units in the spare area 504 is limited, and therefore, the number of opened parent and child block groups will also be limited during the operation of the memory storage device 100 . Therefore, when the memory storage device 100 receives a write command from the host system 1000, if the number of opened parent and child block groups reaches the upper limit, the memory controller 104 needs to close at least one set of currently opened parent and child block groups. The write command can only be executed after that.
值得一提的是,尽管在本范例实施例中,当暂存于全局随机区550的更新数据所属的逻辑单元的数目非小于预设数目时,存储器管理电路202是使用子物理单元来写入更新数据。但本发明不限于此,在本发明另一范例实施例中,存储器管理电路202亦可先执行如图7B所述的数据合并程序,将属于某一个已更新逻辑单元的有效数据整理至从闲置区504提取的物理单元中并且将此逻辑单元重新映射此物理单元,由此使得暂存于全局随机区550的更新数据所属的逻辑单元的数目小于预设数目并且将新的更新数据写入至全局随机区550中。It is worth mentioning that although in this exemplary embodiment, when the number of logical units to which the update data temporarily stored in the global random area 550 belongs is not less than the preset number, the memory management circuit 202 uses sub-physical units to write update data. But the present invention is not limited thereto. In another exemplary embodiment of the present invention, the memory management circuit 202 may also execute the data merging program as shown in FIG. Area 504 extracts the physical unit and remaps this logical unit to this physical unit, thereby making the number of logical units to which the update data temporarily stored in the global random area 550 belongs is less than the preset number and writing new update data to in the global random area 550 .
图12A与图12B是根据第一范例实施例所绘示的数据写入方法的流程图,其中图12A是绘示设置全局随机区550与全局随机区搜寻表的步骤并且图12B是绘示写入更新数据的步骤。12A and FIG. 12B are flowcharts of the data writing method according to the first exemplary embodiment, wherein FIG. 12A shows the steps of setting the global random area 550 and the global random area search table and FIG. Enter the steps to update the data.
请参照图12A,在步骤S1201中,至少一个物理单元会从闲置区504的物理单元之中被提取作为全局随机区550。在此,全局随机区550可暂存属于多个已更新逻辑单元的多个已更新逻辑页面的数据。Referring to FIG. 12A , in step S1201 , at least one physical unit is extracted from the physical units in the spare area 504 as the global random area 550 . Here, the global random area 550 can temporarily store data of a plurality of updated logical pages belonging to a plurality of updated logical units.
在步骤S1203中,全局随机区搜寻表会被建立以记录在全局随机区中对应已更新逻辑页面的更新信息。特别是,全局随机区可被分配到的逻辑单元数目是小于此装置所具有的逻辑单元数目,此外,在全局随机区搜寻表中关于已更新逻辑页面所属的逻辑单元的信息可以是由所指派的索引编号来记录。例如,在步骤S1203中,索引编号映射表会被建立以记录已更新逻辑单元与索引编号之间的映射关系。In step S1203, a global random area search table is established to record update information corresponding to the updated logical page in the global random area. In particular, the number of logical units to which the global random area can be allocated is less than the number of logical units possessed by the device. In addition, the information about the logical unit to which the updated logical page belongs in the global random area lookup table can be assigned by index number to record. For example, in step S1203, an index number mapping table is established to record the mapping relationship between the updated logical unit and the index number.
请参照图12B,当主机系统1000下达写入指令以写入更新数据至逻辑页面(以下称为第一逻辑单元的第一逻辑页面)时,在步骤S1211中,写入指令与对应写入指令的更新数据会被接收,并且在步骤S1213中,全局随机区550会被判断是否储存有属于第一逻辑单元的数据。12B, when the host system 1000 issues a write command to write update data to the logical page (hereinafter referred to as the first logical page of the first logical unit), in step S1211, the write command and the corresponding write command The update data of will be received, and in step S1213, the global random area 550 will be judged whether the data belonging to the first logical unit is stored.
倘若全局随机区550未储存有属于第一逻辑单元的数据时,则在步骤S1215中,暂存于全局随机区550的更新数据所属的已更新逻辑单元的数目会被判断是否小于预设数目,其中此预设数目是小于此装置所具有的逻辑单元的总数。If the global random area 550 does not store data belonging to the first logical unit, then in step S1215, whether the number of updated logical units to which the update data temporarily stored in the global random area 550 belongs is judged to be less than a preset number, Wherein the preset number is less than the total number of logical units of the device.
倘若已更新逻辑单元的数目小于预设数目时,在步骤S1217中,一个未使用的索引编号(以下称为第一索引编号)会被配置给第一逻辑单元。并且,之后,在步骤S1219中,此更新数据会被写入至全局随机区550中并且对应第一逻辑页面的更新信息会通过使用对应第一逻辑单元的第一索引编号被记录在全局随机区搜寻表中。If the number of updated logical units is less than the preset number, in step S1217, an unused index number (hereinafter referred to as the first index number) is allocated to the first logical unit. And, after that, in step S1219, the update data will be written into the global random area 550 and the update information corresponding to the first logical page will be recorded in the global random area by using the first index number corresponding to the first logical unit in the search form.
倘若已更新逻辑单元的数目非小于预设数目时,在步骤S1221中,一个物理单元(以下称为第一物理单元)会从闲置区的物理单元之中被提取作为对应第一逻辑单元的子物理单元并且更新数据会被写入至对应第一逻辑单元的子物理单元中。If the number of updated logical units is not less than the preset number, in step S1221, a physical unit (hereinafter referred to as the first physical unit) will be extracted from the physical units in the spare area as a child corresponding to the first logical unit The physical unit and update data will be written into the sub-physical unit corresponding to the first logical unit.
倘若全局随机区550储存有属于第一逻辑单元的数据时,则步骤S1219会被执行。If the data belonging to the first logic unit is stored in the global random area 550, step S1219 will be executed.
[第二范例实施例][Second Exemplary Embodiment]
第二范例实施例与第一范例实施例的差异在于,除了第一范例实施例所述的区块管理步骤与数据写入步骤之外,在第二范例实施例中,当接收到写入指令与更新数据时,此更新数据所属的逻辑单元还会被判断是否为频繁写入的区域,其中仅属于频繁写入的区域的更新数据才会被写入至全局随机区中。第二范例实施例的存储器控制器与存储器储存装置的硬件架构本质上是相同于第一范例实施例,以下将使用第一范例实施例的硬件架构来描述第二范例实施例。The difference between the second exemplary embodiment and the first exemplary embodiment is that, in addition to the block management step and the data writing step described in the first exemplary embodiment, in the second exemplary embodiment, when a write command is received When updating data, the logical unit to which the updated data belongs is also judged whether it is a frequently written area, and only the updated data belonging to the frequently written area will be written into the global random area. The hardware architecture of the memory controller and the memory storage device of the second exemplary embodiment is essentially the same as that of the first exemplary embodiment, and the second exemplary embodiment will be described below using the hardware architecture of the first exemplary embodiment.
在第二范例实施例中,存储器控制器104的存储器管理电路202会记录对应每一逻辑单元的写入次数。例如,每当主机系统将数据储存至一个逻辑单元时,对应此逻辑单元的写入次数会被加1。此外,存储器管理电路202会根据此些写入次数将逻辑单元区分为较常被使用的热逻辑区与较少被使用的冷逻辑区。例如,在本范例实施例中,存储器管理电路202会依据写入次数由大到小将逻辑单元排序并且前80%的逻辑单元分组为热逻辑区并且交其它的逻辑单元分组至冷逻辑区。依据写入次数区分热逻辑区与冷逻辑区仅是一个范例,本发明不限于此。In the second exemplary embodiment, the memory management circuit 202 of the memory controller 104 records the write times corresponding to each logical unit. For example, whenever the host system stores data into a logical unit, the write count corresponding to this logical unit will be incremented by 1. In addition, the memory management circuit 202 divides the logical units into hot logical areas that are more frequently used and cold logical areas that are less used according to the write times. For example, in this exemplary embodiment, the memory management circuit 202 sorts the logical units from the largest to the smallest according to the number of writes, and the top 80% of the logical units are grouped into the hot logical area and other logical units are grouped into the cold logical area. Distinguishing the hot logical area and the cold logical area according to the writing times is just an example, and the invention is not limited thereto.
在本范例实施例中,当主机系统1000欲储存数据至某一个逻辑单元的某一个逻辑页面时,存储器管理电路202会判断此逻辑单元是否属于冷逻辑区。In this exemplary embodiment, when the host system 1000 intends to store data in a certain logical page of a certain logical unit, the memory management circuit 202 will determine whether the logical unit belongs to the cold logical area.
倘若此逻辑单元属于冷逻辑区时,存储器管理电路202会使用子物理单元来写入此更新数据。并且,倘若此逻辑单元非属于冷逻辑区时,存储器管理电路202才会根据全局随机区550的储存状态来决定是否将更新数据写入至全局随机区550中。也就是说,仅当更新数据所属的逻辑单元属于热逻辑区时,存储器管理电路202才会判断全局随机区550是否存有属于此逻辑单元的数据和暂存于全局随机区550的更新数据所属的逻辑单元的数目是否小于预设数目并且根据判断决定是否将更新数据写入至全局随机区550中(如第一范例实施例所述)。If the logical unit belongs to the cold logical area, the memory management circuit 202 uses the sub-physical unit to write the updated data. Moreover, if the logic unit does not belong to the cold logic area, the memory management circuit 202 will decide whether to write the update data into the global random area 550 according to the storage state of the global random area 550 . That is to say, only when the logical unit to which the updated data belongs belongs to the hot logical area, the memory management circuit 202 will judge whether the global random area 550 stores data belonging to the logical unit and whether the updated data temporarily stored in the global random area 550 belongs to Whether the number of logical units is less than the preset number and whether to write the update data into the global random area 550 is determined according to the judgment (as described in the first exemplary embodiment).
图13是根据第二范例实施例所绘示的写入更新数据的流程图。FIG. 13 is a flow chart of writing update data according to the second exemplary embodiment.
请参照图13,当主机系统1000下达写入指令以写入更新数据至逻辑页面(以下称为第一逻辑单元的第一逻辑页面)时,在步骤S1211中,写入指令与对应写入指令的更新数据会被接收,并且在步骤S1301中,逻辑单元会根据写入次数被区分为热逻辑区与冷逻辑区并且第一逻辑单元会被判断是否属于冷逻辑区。Referring to FIG. 13, when the host system 1000 issues a write command to write update data to a logical page (hereinafter referred to as the first logical page of the first logical unit), in step S1211, the write command and the corresponding write command The update data of will be received, and in step S1301, the logical unit will be divided into a hot logical area and a cold logical area according to the write times and the first logical unit will be judged whether it belongs to the cold logical area.
倘若第一逻辑单元非属于冷逻辑区时,在步骤S1213中,全局随机区550会被判断是否储存有属于第一逻辑单元的数据。If the first logical unit does not belong to the cold logical area, in step S1213, the global random area 550 will be judged whether there is stored data belonging to the first logical unit.
倘若全局随机区550未储存有属于第一逻辑单元的数据时,在步骤S1215中,判断暂存于全局随机区550的更新数据所属的已更新逻辑单元的数目会被判断是否小于预设数目。If the global random area 550 does not store data belonging to the first logical unit, in step S1215, it is determined whether the number of updated logical units to which the updated data temporarily stored in the global random area 550 belongs is less than a preset number.
倘若已更新逻辑单元的数目小于预设数目时,在步骤S1217中,一个未使用的索引编号(以下称为第一索引编号)会被配置给第一逻辑单元。并且之后,在步骤S1219中,此更新数据会被写入至全局随机区550中并且对应第一逻辑页面的更新信息会通过使用对应第一逻辑单元的第一索引编号被记录在全局随机区搜寻表中。If the number of updated logical units is less than the preset number, in step S1217, an unused index number (hereinafter referred to as the first index number) is allocated to the first logical unit. And then, in step S1219, the update data will be written into the global random area 550 and the update information corresponding to the first logical page will be recorded in the global random area by using the first index number corresponding to the first logical unit. table.
倘若已更新逻辑单元的数目非小于预设数目时,在步骤S1221中,一个物理单元(以下称为第一物理单元)会从闲置区的物理单元之中被提取作为对应第一逻辑单元的子物理单元并且更新数据会被写入至对应第一逻辑单元的子物理单元中。If the number of updated logical units is not less than the preset number, in step S1221, a physical unit (hereinafter referred to as the first physical unit) will be extracted from the physical units in the spare area as a child corresponding to the first logical unit The physical unit and update data will be written into the sub-physical unit corresponding to the first logical unit.
此外,倘若全局随机区550储存有属于第一逻辑单元的数据时,则步骤S1219会被执行。In addition, if the data belonging to the first logic unit is stored in the global random area 550, step S1219 will be executed.
另外,倘若第一逻辑单元属于冷逻辑区时,步骤S1221会被执行。In addition, if the first logical unit belongs to the cold logical zone, step S1221 will be executed.
之后,在步骤S1219与步骤S1221之后,在步骤S1303中,对应第一逻辑单元的写入次数会被更新。Afterwards, after step S1219 and step S1221, in step S1303, the writing times corresponding to the first logical unit are updated.
[第三范例实施例][Third Exemplary Embodiment]
第三范例实施例与第一范例实施例的差异在于,除了第一范例实施例所述的区块管理步骤与数据写入步骤之外,在第三范例实施例中,全局随机区的物理单元会被至少分成两组(即,第一全局随机区与第二全局随机区)并且第一全局随机区与第二全局随机区至多可被分别地写入属于预定数目的逻辑单元的更新数据。也就是说,在第二范例实施例中,两个如第一范例实施例所述的全局随机区搜寻表会被用来记录对应第一全局随机区的更新信息与对应第二全局随机区的更新信息。第三范例实施例的存储器控制器与存储器储存装置的硬件架构本质上是相同于第一范例实施例,以下将使用第一范例实施例的硬件架构来描述第三范例实施例。The difference between the third exemplary embodiment and the first exemplary embodiment is that, in addition to the block management step and the data writing step described in the first exemplary embodiment, in the third exemplary embodiment, the physical unit of the global random area are at least divided into two groups (ie, the first global random area and the second global random area) and at most the first global random area and the second global random area can be respectively written with update data belonging to a predetermined number of logical units. That is to say, in the second exemplary embodiment, two global random area search tables as described in the first exemplary embodiment will be used to record the update information corresponding to the first global random area and the update information corresponding to the second global random area. Update information. The hardware architecture of the memory controller and the memory storage device of the third exemplary embodiment is essentially the same as that of the first exemplary embodiment, and the third exemplary embodiment will be described below using the hardware architecture of the first exemplary embodiment.
图14是根据第三范例实施例所绘示的配置全局随机区的范例。FIG. 14 is an example of configuring the global random zone according to the third exemplary embodiment.
请参照图14,存储器控制器104的存储器管理电路202会从闲置区504中提取物理单元作为第一全局随机区550-1与第二全局随机区550-2。此外,存储器管理电路202会为第一全局随机区550-1与第二全局随机区550-2分别地配置第一全局随机区搜寻表与第二全局随机区搜寻表。在此,第一全局随机区搜寻表与第一全局随机区搜寻表的数据结构与大小是相同于第一范例实施例的全局随机区搜寻表800。Referring to FIG. 14 , the memory management circuit 202 of the memory controller 104 extracts physical units from the spare area 504 as a first global random area 550 - 1 and a second global random area 550 - 2 . In addition, the memory management circuit 202 configures a first global random area search table and a second global random area search table for the first global random area 550 - 1 and the second global random area 550 - 2 respectively. Here, the data structure and size of the first global random area search table and the first global random area search table are the same as the global random area search table 800 in the first exemplary embodiment.
在本范例实施例中,存储器管理电路202会使用第一全局随机区550-1与第二全局随机区550-2来分别地储存属于不同逻辑单元的更新数据,其中暂存在第一全局随机区550-1的更新数据所属的逻辑单元的数目不会超过预设数目并且暂存在第二全局随机区550-2的更新数据所属的逻辑单元的数目不会超过预设数目。例如,在预设数目设定为128的例子,第一全局随机区550-1最多储存属于128个逻辑单元的更新数据并且第二全局随机区550-2最多储存属于128个逻辑单元的更新数据。In this exemplary embodiment, the memory management circuit 202 uses the first global random area 550-1 and the second global random area 550-2 to respectively store update data belonging to different logical units, wherein the first global random area is temporarily stored The number of logic units to which the update data of 550-1 belongs will not exceed a preset number and the number of logic units to which update data temporarily stored in the second global random area 550-2 will not exceed a preset number. For example, in the case where the preset number is set to 128, the first global random area 550-1 stores update data belonging to 128 logical units at most and the second global random area 550-2 stores update data belonging to 128 logical units at most .
具体来说,当主机系统1000欲储存数据至某一个逻辑单元的某一个逻辑页面时,存储器管理电路202会判断第一全局随机区550-1或第二全局随机区550-2是否已存有属于此逻辑单元的数据。Specifically, when the host system 1000 intends to store data in a certain logical page of a certain logical unit, the memory management circuit 202 will determine whether the first global random area 550-1 or the second global random area 550-2 has already stored The data belonging to this logical unit.
当第一全局随机区550-1存有属于此逻辑单元的数据,存储器管理电路202会将此更新数据写入至第一全局随机区550-1中并且根据已指派给此逻辑单元的索引编号在第一全局随机区搜寻表中记录对应此逻辑页面的更新信息。When the first global random area 550-1 stores data belonging to the logic unit, the memory management circuit 202 will write the updated data into the first global random area 550-1 and The update information corresponding to this logical page is recorded in the first global random area search table.
当第二全局随机区550-2存有属于此逻辑单元的数据,存储器管理电路202会将此更新数据写入至第二全局随机区550-2中并且根据已指派给此逻辑单元的索引编号在第二全局随机区搜寻表中记录对应此逻辑页面的更新信息。When the second global random area 550-2 stores data belonging to the logic unit, the memory management circuit 202 will write the update data into the second global random area 550-2 and The update information corresponding to the logical page is recorded in the second global random area search table.
当第一全局随机区550-1与第二全局随机区550-2未存有属于此逻辑单元的数据,存储器管理电路202会判断暂存于第一全局随机区550-1的更新数据所属的逻辑单元的数目是否小于预设数目。When the first global random area 550-1 and the second global random area 550-2 do not store any data belonging to the logical unit, the memory management circuit 202 will determine which update data temporarily stored in the first global random area 550-1 belongs to. Whether the number of logical units is less than a preset number.
倘若暂存于第一全局随机区550-1的更新数据所属的逻辑单元的数目小于预设数目时,存储器管理电路202会将第一全局随机区搜寻表中未使用的索引编号指派给此逻辑单元,将属于此逻辑页面的更新数据写入至第一全局随机区550并且使用指派给此逻辑单元的索引编号来在第一全局随机区搜寻表中记录对应此逻辑页面的更新数据。If the number of logic units to which the update data temporarily stored in the first global random area 550-1 belongs is less than the preset number, the memory management circuit 202 will assign unused index numbers in the first global random area search table to the logical units. Write the updated data belonging to the logical page into the first global random area 550 and record the updated data corresponding to the logical page in the first global random area lookup table using the index number assigned to the logical unit.
倘若暂存于第一全局随机区550-1的更新数据所属的逻辑单元的数目非小于预设数目时,存储器管理电路202会判断暂存于第二全局随机区550-2的更新数据所属的逻辑单元的数目是否小于预设数目。If the number of logical units to which the updated data temporarily stored in the first global random area 550-1 belongs is not less than the preset number, the memory management circuit 202 will determine which logical unit the updated data temporarily stored in the second global random area 550-2 belongs to. Whether the number of logical units is less than a preset number.
倘若暂存于第二全局随机区550-2的更新数据所属的逻辑单元的数目小于预设数目时,存储器管理电路202会将第二全局随机区搜寻表中未使用的索引编号指派给此逻辑单元,将属于此逻辑页面的更新数据写入至第二全局随机区550-2并且使用指派给此逻辑单元的索引编号来在第二全局随机区搜寻表中记录对应此逻辑页面的更新数据。If the number of logic units to which the update data temporarily stored in the second global random area 550-2 belongs is less than the preset number, the memory management circuit 202 will assign an unused index number in the second global random area search table to the logic unit. Write the updated data belonging to the logical page into the second global random area 550-2 and use the index number assigned to the logical unit to record the updated data corresponding to the logical page in the second global random area search table.
倘若暂存于第二全局随机区550-2的更新数据所属的逻辑单元的数目非小于预设数目时,存储器管理电路202会从闲置区504中提取一个物理单元作为子物理单元来写入更新数据。If the number of logical units to which the update data temporarily stored in the second global random area 550-2 belongs is not less than the preset number, the memory management circuit 202 will extract a physical unit from the idle area 504 as a sub-physical unit to write the update data.
图15A与图15B是根据第三范例实施例所绘示的数据写入方法的流程图,其中图15A是绘示设置全局随机区与全局随机区搜寻表的步骤并且图15B是绘示写入更新数据的步骤。15A and 15B are flowcharts of the data writing method according to the third exemplary embodiment, wherein FIG. 15A shows the steps of setting the global random area and the global random area search table and FIG. 15B shows the steps of writing Steps to update data.
请参照图15A,在步骤S1501中,至少一个物理单元会从闲置区504的物理单元之中被提取作为第一全局随机区550-1并且至少一个物理单元会从闲置区504的物理单元之中被提取作为第二全局随机区550-2。在此,第一全局随机区550-1会暂存属于多个已更新逻辑单元(以下称为第一已更新逻辑单元)的多个已更新逻辑页面(以下称为第一已更新逻辑页面)的数据并且第二全局随机区550-2会暂存属于多个已更新逻辑单元(以下称为第二已更新逻辑单元)的多个已更新逻辑页面(以下称为第二已更新逻辑页面)的数据。Please refer to FIG. 15A, in step S1501, at least one physical unit will be extracted from the physical units in the idle area 504 as the first global random area 550-1 and at least one physical unit will be extracted from the physical units in the idle area 504 is extracted as the second global random area 550-2. Here, the first global random area 550-1 temporarily stores a plurality of updated logical pages (hereinafter referred to as first updated logical pages) belonging to a plurality of updated logical units (hereinafter referred to as first updated logical units). and the second global random area 550-2 temporarily stores multiple updated logical pages (hereinafter referred to as second updated logical pages) belonging to multiple updated logical units (hereinafter referred to as second updated logical units) The data.
在步骤S1503中,第一全局随机区搜寻表与第二全局随机区搜寻表会分别地被建立,其中第一全局随机区搜寻表记录在第一全局随机区中对应第一已更新逻辑页面的更新信息并且第二全局随机区搜寻表记录在第二全局随机区中对应第二已更新逻辑页面的更新信息。特别是,在第一全局随机区搜寻表与第二全局随机区搜寻表中关于已更新逻辑页面所属的逻辑单元的信息是以所指派的索引编号来记录。In step S1503, the first global random area search table and the second global random area search table are respectively established, wherein the first global random area search table records the data corresponding to the first updated logical page in the first global random area The information is updated and the second global random area search table records the updated information corresponding to the second updated logical page in the second global random area. In particular, the information about the logical unit to which the updated logical page belongs is recorded by the assigned index number in the first global random area search table and the second global random area search table.
请参照图15B,当主机系统1000下达写入指令以写入更新数据至逻辑页面(以下称为第一逻辑单元的第一逻辑页面)时,在步骤S1511中,写入指令与对应写入指令的更新数据会被接收,并且在步骤S1513中,第一全局随机区550-1会被判断是否储存有属于第一逻辑单元的数据。Please refer to FIG. 15B, when the host system 1000 issues a write command to write update data to the logical page (hereinafter referred to as the first logical page of the first logical unit), in step S1511, the write command and the corresponding write command The update data of will be received, and in step S1513, the first global random area 550-1 will be judged whether there is stored data belonging to the first logical unit.
倘若第一全局随机区550-1未储存有属于第一逻辑单元的数据时,则在步骤S1515中,第二全局随机区550-1会被判断是否储存有属于第一逻辑单元的数据。If the first global random area 550-1 does not store data belonging to the first logical unit, then in step S1515, the second global random area 550-1 will be judged whether to store data belonging to the first logical unit.
倘若第二全局随机区550-2未储存有属于第一逻辑单元的数据时,在步骤S1517中,暂存于第一全局随机区550-1的更新数据所属的已更新逻辑单元的数目会被判断是否小于预设数目。If the second global random area 550-2 does not store data belonging to the first logical unit, in step S1517, the number of updated logical units to which the update data temporarily stored in the first global random area 550-1 belongs will be replaced by Determine whether it is less than the preset number.
倘若暂存于第一全局随机区550-1的更新数据所属的已更新逻辑单元的数目小于预设数目时,在步骤S1519中,在第一全局随机区搜寻表中未使用的索引编号(以下称为第一索引编号)会被配置给第一逻辑单元。并且,之后,在步骤S1521中,此更新数据会被写入至第一全局随机区550-1中并且对应第一逻辑页面的更新信息会通过使用对应第一逻辑单元的第一索引编号被记录在第一全局索引映射表中。If the number of updated logical units to which the update data temporarily stored in the first global random area 550-1 belongs is less than the preset number, in step S1519, unused index numbers in the first global random area search table (hereinafter referred to as the first index number) will be assigned to the first logical unit. And, after that, in step S1521, the update data will be written into the first global random area 550-1 and the update information corresponding to the first logical page will be recorded by using the first index number corresponding to the first logical unit in the first global index mapping table.
倘若暂存于第一全局随机区550-1的更新数据所属的已更新逻辑单元的数目非小于预设数目时,在步骤S1523中,暂存于第二全局随机区550-2的更新数据所属的已更新逻辑单元的数目会被判断是否小于预设数目。If the number of updated logical units to which the update data temporarily stored in the first global random area 550-1 belongs is not less than the preset number, in step S1523, the update data temporarily stored in the second global random area 550-2 belongs to It is determined whether the number of updated logical units of is less than a preset number.
倘若暂存于第二全局随机区550-2的更新数据所属的已更新逻辑单元的数目小于预设数目时,在步骤S1525中,在第二全局随机区搜寻表中未使用的索引编号(以下称为第二索引编号)会被配置给第一逻辑单元。并且,之后,在步骤S1527中,此更新数据会被写入至第二全局随机区550-2中并且对应第一逻辑页面的更新信息会通过使用对应第一逻辑单元的第二索引编号被记录在第二全局随机区搜寻表中。If the number of updated logical units to which the update data temporarily stored in the second global random area 550-2 belongs is less than the preset number, in step S1525, unused index numbers in the second global random area search table (hereinafter referred to as the second index number) will be assigned to the first logical unit. And, after that, in step S1527, the update data will be written into the second global random area 550-2 and the update information corresponding to the first logical page will be recorded by using the second index number corresponding to the first logical unit In the second global random area search table.
倘若暂存于第二全局随机区550-2的更新数据所属的已更新逻辑单元的数目非小于预设数目时,在步骤S1529中,一个物理单元(以下称为第一物理单元)会从闲置区的物理单元之中被提取作为对应第一逻辑单元的子物理单元并且更新数据会被写入至对应第一逻辑单元的子物理单元中。If the number of updated logical units to which the updated data temporarily stored in the second global random area 550-2 belongs is not less than the preset number, in step S1529, a physical unit (hereinafter referred to as the first physical unit) will be removed from idle The physical units of the zone are extracted as sub-physical units corresponding to the first logical unit and the update data is written into the sub-physical units corresponding to the first logical unit.
此外,倘若在步骤S1513中判断第一全局随机区550-1储存有属于第一逻辑单元的数据时,则步骤S1521会直接被执行。并且,倘若在步骤S1515中判断第二全局随机区550-2储存有属于第一逻辑单元的数据时,则步骤S1527会被执行。In addition, if it is determined in step S1513 that the first global random area 550-1 stores data belonging to the first logic unit, then step S1521 will be directly executed. Moreover, if it is determined in step S1515 that the second global random area 550-2 stores data belonging to the first logic unit, then step S1527 will be executed.
值得一提的,仅管在第三范例实施例中,以配置两个全局随机区来作说明,但本发明不限于此,全局随机区的数目可以超过2。It is worth mentioning that although in the third exemplary embodiment, two global random areas are configured for illustration, the present invention is not limited thereto, and the number of global random areas may exceed two.
综上所述,根据本发明一范例实施例的数据写入方法、存储器控制器与存储器储存装置在将更新数据写入全局随机区之前会判断暂存于全局随机区的更新数据所属的逻辑单元的数目是否小于预设数目,并且仅当暂存于全局随机区的更新数据所属的逻辑单元的数目小于预设数目才将更新数据暂存于全局随机区中。因此,全局随机表仅需记录预设数目的逻辑单元的更新信息并且全局随机表的大小可有效地缩小。基此,在配置小容量的缓冲存储器的存储器储存装置中亦可使用全局随机物理单元来储存数据并且有效地提升配置小容量的缓冲存储器的存储器储存装置的写入速度。此外,根据本发明另一范例实施例的数据写入方法、存储器控制器与存储器储存装置,逻辑单元会被区分为热逻辑区与冷逻辑区,并且仅将属于热逻辑区的更新数据暂存至全局随机区中,还可使仅能暂存有限的逻辑单元的更新数据的全局随机区被有效地利用。此外,根据本发明另一范例实施例的数据写入方法、存储器控制器与存储器储存装置,多个全局随机区会被配置以分别地暂存不同逻辑单元的更新数据,由此可使更多逻辑单元的更新数据可被暂存至全局随机区中,以更提升配置小容量的缓冲存储器的存储器储存装置的写入速度。To sum up, according to an exemplary embodiment of the present invention, the data writing method, the memory controller and the memory storage device will determine the logic unit to which the update data temporarily stored in the global random area belongs before writing the update data into the global random area. Whether the number is less than the preset number, and only when the number of logical units to which the update data temporarily stored in the global random area belongs is less than the preset number, the update data is temporarily stored in the global random area. Therefore, the global random table only needs to record update information of a preset number of logical units and the size of the global random table can be effectively reduced. Based on this, the memory storage device configured with a small-capacity buffer memory can also use the global random physical unit to store data and effectively increase the writing speed of the memory storage device configured with a small-capacity buffer memory. In addition, according to the data writing method, memory controller and memory storage device according to another exemplary embodiment of the present invention, logical units are divided into hot logical areas and cold logical areas, and only update data belonging to the hot logical areas are temporarily stored In the global random area, the global random area which can only temporarily store update data of a limited number of logical units can also be effectively used. In addition, according to the data writing method, memory controller, and memory storage device of another exemplary embodiment of the present invention, multiple global random areas are configured to temporarily store update data of different logical units, thereby enabling more The update data of the logic unit can be temporarily stored in the global random area, so as to further improve the writing speed of the memory storage device configured with a small-capacity buffer memory.
虽然本发明已以实施例揭露如上,然其并非用以限定本发明,任何所属技术领域中具有通常知识者,在不脱离本发明的精神和范围内,当可作些许的更动与润饰,故本发明的保护范围当视所附的权利要求范围所界定者为准。Although the present invention has been disclosed as above with the embodiments, it is not intended to limit the present invention. Anyone with ordinary knowledge in the technical field can make some changes and modifications without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention should be defined by the appended claims.
Claims (20)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110256271.XA CN102968385B (en) | 2011-08-31 | 2011-08-31 | Data writing method, memory controller and storage device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110256271.XA CN102968385B (en) | 2011-08-31 | 2011-08-31 | Data writing method, memory controller and storage device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102968385A CN102968385A (en) | 2013-03-13 |
CN102968385B true CN102968385B (en) | 2016-01-20 |
Family
ID=47798537
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201110256271.XA Active CN102968385B (en) | 2011-08-31 | 2011-08-31 | Data writing method, memory controller and storage device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102968385B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104423888B (en) * | 2013-08-23 | 2017-10-03 | 群联电子股份有限公司 | Data writing method, memory control circuit unit and memory storage device |
KR20160032910A (en) * | 2014-09-17 | 2016-03-25 | 에스케이하이닉스 주식회사 | Memory system and operating method of memory system |
KR20170060203A (en) * | 2015-11-23 | 2017-06-01 | 에스케이하이닉스 주식회사 | Memory system and operating method of memory system |
CN109213692B (en) * | 2017-07-06 | 2022-10-21 | 慧荣科技股份有限公司 | Storage device management system and storage device management method |
CN108920107B (en) * | 2018-07-13 | 2022-02-01 | 深圳忆联信息系统有限公司 | Method and device for screening cold data, computer equipment and storage medium |
CN114637626B (en) * | 2022-02-14 | 2022-09-30 | 弘正储能(上海)能源科技有限公司 | Method, device and equipment for reducing read-write errors of EEPROM (electrically erasable programmable read-only memory) data and readable storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW201103025A (en) * | 2009-07-09 | 2011-01-16 | Phison Electronics Corp | Logical block management method for a flash memory and control circuit and storage system using the same |
TW201122810A (en) * | 2009-12-30 | 2011-07-01 | Phison Electronics Corp | Block management and data writing method, flash memory storage system and controller |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR100843135B1 (en) * | 2006-11-20 | 2008-07-02 | 삼성전자주식회사 | Non-volatile memory management method and device |
KR101028929B1 (en) * | 2008-12-31 | 2011-04-12 | 성균관대학교산학협력단 | Log block association distribution method for real-time system and flash memory device |
-
2011
- 2011-08-31 CN CN201110256271.XA patent/CN102968385B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW201103025A (en) * | 2009-07-09 | 2011-01-16 | Phison Electronics Corp | Logical block management method for a flash memory and control circuit and storage system using the same |
TW201122810A (en) * | 2009-12-30 | 2011-07-01 | Phison Electronics Corp | Block management and data writing method, flash memory storage system and controller |
Also Published As
Publication number | Publication date |
---|---|
CN102968385A (en) | 2013-03-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104732153B (en) | Data erasing method, memory control circuit unit and memory storage device | |
TWI436212B (en) | Data writing method, memory controller and memory storage apparatus | |
CN106469122B (en) | Effective data combination method, memory controller and memory storage device | |
CN103377129B (en) | Data writing method, memory controller and memory storage device | |
TWI457755B (en) | Data writing method, memory controller and memory storage apparatus | |
TWI438630B (en) | Data merging method for non-volatile memory and controller and stoarge apparatus using the same | |
CN102968385B (en) | Data writing method, memory controller and storage device | |
CN103593296B (en) | Data storage method, memory controller and memory storage device | |
CN102915273B (en) | Data writing method, memory controller and memory storage device | |
CN102902626B (en) | Block management method, memory controller and memory storage device | |
CN102592670B (en) | Data writing method, memory controller and memory storage device | |
CN102200946B (en) | Data access method, memory controller and storage system | |
CN104536906B (en) | Data writing method, memory controller and memory storage device | |
CN102446137B (en) | Data writing method, memory controller and memory storage device | |
CN102567221B (en) | Data management method, memory controller and memory storage device | |
CN104978149A (en) | Data writing method, memory control circuit unit and memory storage device | |
CN102122233B (en) | Block management and data writing method, flash storage system and controller | |
CN104238956A (en) | Data writing method, memory controller and memory storage device | |
CN102736985B (en) | data merging method, controller and storage device | |
CN102543183B (en) | Data writing method, memory controller and storage device | |
CN107103930A (en) | Data writing method, memory control circuit unit and memory storage device | |
CN102467459B (en) | Data writing method, memory controller and memory storage device | |
CN102779551B (en) | Data writing method, memory controller and memory storage device | |
TWI498731B (en) | Non-volatile memory storage system | |
CN104951241B (en) | Memory management method, memory storage device and memory control circuit unit |
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 |