CN102122269B - Flash memory writing overtime control method and memory device thereof - Google Patents
Flash memory writing overtime control method and memory device thereof Download PDFInfo
- Publication number
- CN102122269B CN102122269B CN201010004561A CN201010004561A CN102122269B CN 102122269 B CN102122269 B CN 102122269B CN 201010004561 A CN201010004561 A CN 201010004561A CN 201010004561 A CN201010004561 A CN 201010004561A CN 102122269 B CN102122269 B CN 102122269B
- Authority
- CN
- China
- Prior art keywords
- block
- update
- data
- parent
- cleared
- 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 37
- 230000005540 biological transmission Effects 0.000 claims description 10
- 230000010354 integration Effects 0.000 description 13
- 238000010586 diagram Methods 0.000 description 10
- 230000008672 reprogramming Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000007423 decrease Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000010926 purge Methods 0.000 description 1
Images
Landscapes
- Techniques For Improving Reliability Of Storages (AREA)
- Memory System (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
技术领域 technical field
本发明涉及闪存(flash memory)相关技术领域,更具体地说,涉及一种适用于闪存的写入逾时(write timeout)控制方法及其记忆装置。The present invention relates to the relevant technical field of flash memory (flash memory), and more specifically, relates to a write timeout (write timeout) control method suitable for flash memory and a memory device thereof.
背景技术 Background technique
闪存为一种非遗失性内存,不需倚赖电力即可维持其所储存的数据,由于具有尺寸小、高记忆密度、低耗电及低成本的优势,因此广泛地用于手机、数字相机、个人数字助理(PDA)等各种消费性电子产品中。Flash memory is a non-volatile memory that can maintain its stored data without relying on electricity. Due to its advantages of small size, high memory density, low power consumption and low cost, it is widely used in mobile phones, digital cameras, In various consumer electronic products such as personal digital assistants (PDAs).
闪存通常包括多个区块(block),且每一区块具有用以储存数据的复数页面(page)。进一步,闪存以页面为单位进行数据编程(program),而以区块为单位进行数据抹除(erase)。换言之,当闪存对一区块进行数据抹除时,该区块所有页面所储存的数据均会一起被抹除。Flash memory generally includes multiple blocks, and each block has a plurality of pages for storing data. Further, the flash memory performs data programming (program) in units of pages, and performs data erasure (erase) in units of blocks. In other words, when the flash memory erases data on a block, the data stored in all pages of the block will be erased together.
除此之外,闪存的每一页面仅允许被编程一次。当一区块的部分页面所储存的数据需要更新时,由于该等页面已存有旧数据,并无法将更新数据直接编程至该等页面中。也就是说,若欲更新该等页面,必须先抹除该区块,才能够进行更新数据的写入或编程。此一额外的抹除及再编程操作,除了造成执行时间的延迟,亦会产生额外工作负担,导致整体存取效能的下降。In addition, each page of flash memory is only allowed to be programmed once. When the data stored in some pages of a block needs to be updated, the updated data cannot be directly programmed into the pages because the pages already store old data. That is to say, if these pages are to be updated, the block must be erased first, and then the updating data can be written or programmed. This additional erasing and reprogramming operation not only causes delay in execution time, but also creates additional workload, resulting in a decline in overall access performance.
再者,为配合闪存记忆容量增加的趋势,可增加每一区块的页面数量,例如:从128页增加为256页,或者增加每一页面的记忆容量,例如:从4K字节(bytes)增加为8K字节,用以使闪存具备更大的记忆容量。然而,这也意谓着更新数据将耗费更多的抹除及再编程时间,甚至导致超过闪存规格所允许的编程忙录时间,例如:250毫秒(millisecond,ms)。一般而言,128个页面的区块需200毫秒完成抹除操作。因此,需要400毫秒才能完成256个页面的区块抹除操作,加上更新数据的再编程时间,便会发生写入逾时的情况,导致整体存取效能严重下降。Furthermore, in order to match the trend of increasing memory capacity of flash memory, the number of pages in each block can be increased, for example: from 128 pages to 256 pages, or the memory capacity of each page can be increased, for example: from 4K bytes (bytes) It is increased to 8K bytes to make the flash memory have a larger memory capacity. However, this also means that updating data will consume more time for erasing and reprogramming, which may even exceed the programming time allowed by the flash memory specification, for example: 250 milliseconds (ms). Generally speaking, a block of 128 pages takes 200 milliseconds to complete the erase operation. Therefore, it takes 400 milliseconds to complete the block erase operation of 256 pages, plus the reprogramming time for updating data, there will be write overtime, resulting in a serious drop in overall access performance.
因此,需要一种适用于闪存的写入逾时控制方法,于编程数据或更新数据时,能够避免写入逾时,从而提升闪存的整体存取效能。Therefore, there is a need for a write timeout control method suitable for flash memory, which can avoid write timeout when programming data or updating data, thereby improving the overall access performance of flash memory.
发明内容 Contents of the invention
本发明要解决的技术问题在于,针对现有技术的上述缺陷,提供一种用于闪存的写入逾时控制方法及其记忆装置。The technical problem to be solved by the present invention is to provide a writing time-out control method for flash memory and a memory device thereof, aiming at the above-mentioned defects of the prior art.
本发明解决其技术问题所采用的技术方案之一是:构造一种闪存的写入逾时控制方法,该闪存包括多个数据区块及多个备用区块,进一步,该等数据区块包括多个母区块。该方法包括:接收一主机的一写入命令及对应的一起始逻辑区块地址;根据该起始逻辑区块地址所链接的一目标母区块,用以决定一更新模式;判断一第一母区块是否已执行一预清除操作,其中,该第一母区块被标记为一待清除区块;当该第一母区块已执行该预清除操作时,于一第一时间周期,执行该第一母区块的一后清除操作;将该第一母区块重置为一备用区块;根据该更新模式,于该起始逻辑区块地址所链接的该目标母区块上,执行对应于该写入命令的一写入数据编程程序;判断该等母区块的数量是否超过一第一临界值;以及当该等母区块的数量超过该第一临界值时,于一第二时间周期,执行一第二母区块的该预清除操作,其中,该第二母区块被标记为该待清除区块。One of the technical solutions adopted by the present invention to solve the technical problems is: construct a write timeout control method of a flash memory, the flash memory includes a plurality of data blocks and a plurality of spare blocks, further, the data blocks include Multiple parent blocks. The method includes: receiving a write command from a host and a corresponding initial logical block address; determining an update mode according to a target parent block linked by the initial logical block address; judging a first Whether the parent block has performed a pre-clear operation, wherein the first parent block is marked as a block to be cleared; when the first parent block has performed the pre-clear operation, in a first time period, performing a post-clear operation of the first parent block; resetting the first parent block as a spare block; according to the update mode, on the target parent block linked by the initial logical block address , executing a write data programming program corresponding to the write command; judging whether the number of the mother blocks exceeds a first critical value; and when the number of the mother blocks exceeds the first critical value, at For a second time period, perform the pre-clear operation on a second parent block, wherein the second parent block is marked as the block to be cleared.
本发明所述的用于闪存的写入逾时控制方法,其中,于接收该起始逻辑区块地址后,更包括:The writing overtime control method for flash memory described in the present invention, wherein, after receiving the initial logical block address, further includes:
依序接收用以表示该写入数据的一连串的数据单元。A series of data units representing the write data are sequentially received.
本发明所述的用于闪存的写入逾时控制方法,其中,于接收该一连串的数据单元后,更包括:The writing overtime control method for flash memory according to the present invention, wherein, after receiving the series of data units, further includes:
接收由该主机发出的一停止传送命令,用以表示对应该写入命令的该写入数据已传送完成。A stop transmission command sent by the host is received to indicate that the write data corresponding to the write command has been transmitted.
本发明所述的用于闪存的写入逾时控制方法,其中,该第一时间周期用以表示一第一数据单元接收后,到接收一第二数据单元的前的一段时间。In the write timeout control method for flash memory according to the present invention, the first time period is used to indicate a period of time after a first data unit is received and before a second data unit is received.
本发明所述的用于闪存的写入逾时控制方法,其中,该第二时间周期用以表示该既定命令接收后,到接收主机的次一命令之前的一段时间。In the write timeout control method for flash memory according to the present invention, the second time period is used to represent a period of time after receiving the predetermined command and before receiving the next command from the host.
本发明所述的用于闪存的写入逾时控制方法,更包括:The writing overtime control method for flash memory described in the present invention further includes:
当该第一母区块尚未执行该预清除操作时,于该第一时间周期,执行该第一母区块的该预清除操作;以及performing the pre-erase operation on the first parent block during the first time period when the first parent block has not yet performed the pre-erase operation; and
于一第三时间周期,执行该第一母区块的该后清除操作,performing the post clear operation of the first parent block during a third time period,
其中,该第三时间周期于该第一时间周期之后,且于该第二时间周期之前,用以表示接收两连续数据单元的一间隔时间。Wherein, the third time period is after the first time period and before the second time period, and is used to represent an interval time for receiving two consecutive data units.
本发明所述的用于闪存的写入逾时控制方法,其中,该等数据区块更包括多个更新区块,每一更新区块具有一或多个用以更新一对应母区块的更新页面。In the write timeout control method for flash memory described in the present invention, wherein the data blocks further include a plurality of update blocks, and each update block has one or more update blocks for updating a corresponding parent block Update the page.
本发明所述的用于闪存的写入逾时控制方法,其中,该预清除操作及该后清除操作的步骤包括:In the writing overtime control method for flash memory of the present invention, wherein, the steps of the pre-clear operation and the post-clear operation include:
取得该待清除区块的该更新模式;Obtain the update mode of the block to be cleared;
当该待清除区块的该更新模式为一子区块模式时,自该待清除区块所对应的一更新区块中,寻找一最后更新页面;When the update mode of the block to be cleared is a sub-block mode, searching for a last updated page from an update block corresponding to the block to be cleared;
根据该最后更新页面,自该待清除区块中,将该最后更新页面的后的数据搬移至该更新区块;以及According to the last updated page, from the block to be cleared, move the data of the last updated page to the updated block; and
抹除该待清除区块。Erase the block to be cleared.
本发明所述的用于闪存的写入逾时控制方法,其中,该预清除操作及该后清除操作的步骤包括:In the writing overtime control method for flash memory of the present invention, wherein, the steps of the pre-clear operation and the post-clear operation include:
取得该待清除区块的该更新模式;Obtain the update mode of the block to be cleared;
当该待清除区块的该更新模式为一档案配置表区块模式时,取得一既定备用区块;When the update mode of the block to be cleared is a file allocation table block mode, obtain a predetermined spare block;
自该待清除区块所对应的一更新区块中,读取一查找表,该查找表记录该一或多个更新页面与该待清除区块的对应更新位置;Reading a lookup table from an update block corresponding to the block to be cleared, the lookup table records the corresponding update positions of the one or more update pages and the block to be cleared;
根据该查找表,将该待清除区块所储存的数据及该一或多个更新页面所储存的数据进行整合,用以得到一整合写入数据;According to the lookup table, the data stored in the block to be cleared and the data stored in the one or more update pages are integrated to obtain integrated write data;
将该整合写入数据编程至该既定备用区块;以及programming the consolidated write data into the intended spare block; and
抹除该待清除区块及该更新区块。Erase the block to be cleared and the update block.
本发明所述的用于闪存的写入逾时控制方法,更包括:The writing overtime control method for flash memory described in the present invention further includes:
当该等母区块的数量未超过该第一临界值时,判断该目标母区块的该更新模式是否为一档案配置表区块模式;When the number of the parent blocks does not exceed the first critical value, determine whether the update mode of the target parent block is a file configuration table block mode;
当该目标母区块的该更新模式为该档案配置表区块模式时,取得该写入数据的一数据长度;When the update mode of the target parent block is the file allocation table block mode, obtain a data length of the written data;
根据该起始逻辑区块地址及该数据长度,用以计算该目标母区块所对应的一更新区块,在执行该写入数据编程程序后的一结束逻辑区块地址;According to the initial logical block address and the data length, it is used to calculate an update block corresponding to the target parent block, and an end logical block address after executing the write data programming procedure;
根据该结束逻辑区块地址及该更新区块的大小,用以取得该更新区块的一可用页面数量;Obtaining an available page quantity of the update block according to the end logical block address and the size of the update block;
判断该可用页面数量是否小于一第二临界值;judging whether the number of available pages is less than a second critical value;
当该可用页面数量小于该第二临界值时,将该目标母区块标记为该待清除区块;以及When the number of available pages is less than the second critical value, marking the target parent block as the block to be cleared; and
于该第二时间周期,执行该目标母区块的该预清除操作。During the second time period, the pre-erase operation of the target parent block is performed.
本发明解决其技术问题所采用的技术方案之二是:构造一种记忆装置,耦接至一主机,并包括一闪存及一控制器。该闪存包括一闪存,包括多个数据区块及多个备用区块,其中,该等数据区块包括多个母区块。该控制器耦接于该闪存,用以接收该主机的一写入命令及对应的一起始逻辑区块地址、根据该起始逻辑区块地址所链接的一目标母区块决定一更新模式、判断被标记为一待清除区块的一第一母区块是否已执行一预清除操作、当该第一母区块已执行该预清除操作时,于一第一时间周期执行该第一母区块的一后清除操作、将该第一母区块重置为一备用区块、根据该更新模式,于该起始逻辑区块地址所链接的该目标母区块上执行对应于该写入命令的一写入数据编程程序、判断该等母区块的数量是否超过一第一临界值、以及当该等母区块的数量超过该第一临界值时,于一第二时间周期,对被标记为该待清除区块的一第二母区块执行该预清除操作。The second technical solution adopted by the present invention to solve the technical problem is to construct a memory device, which is coupled to a host and includes a flash memory and a controller. The flash memory includes a flash memory, including a plurality of data blocks and a plurality of spare blocks, wherein the data blocks include a plurality of parent blocks. The controller is coupled to the flash memory for receiving a write command from the host and a corresponding initial logical block address, determining an update mode according to a target parent block linked to the initial logical block address, judging whether a first parent block marked as a block to be cleared has performed a pre-clear operation, and when the first parent block has performed the pre-clear operation, perform the first parent block in a first time period A post-clear operation of the block, resetting the first parent block as a spare block, performing the write corresponding to the target parent block linked by the starting logical block address according to the update mode A write data programming program of input command, judging whether the number of the parent blocks exceeds a first critical value, and when the number of the parent blocks exceeds the first critical value, in a second time period, The pre-erase operation is performed on a second parent block marked as the block to be cleared.
本发明所述的记忆装置,其中,该控制器接收该起始逻辑区块地址后,依序接收用以表示该写入数据的一连串的数据单元。In the memory device of the present invention, after receiving the initial logical block address, the controller sequentially receives a series of data units representing the write data.
本发明所述的记忆装置,其中,该控制器接收该一连串的数据单元后,接收由该主机发出的一停止传送命令,用以表示对应该写入命令的该写入数据已传送完成。In the memory device of the present invention, after receiving the series of data units, the controller receives a stop transmission command issued by the host to indicate that the write data corresponding to the write command has been transmitted.
本发明所述的记忆装置,其中,该第一时间周期用以表示一第一数据单元接收后,到接收一第二数据单元的前的一段时间。In the memory device of the present invention, the first time period is used to represent a period of time after a first data unit is received and before a second data unit is received.
本发明所述的记忆装置,其中,该第二时间周期用以表示该既定命令接收后,到接收主机的次一命令之前的一段时间。In the memory device of the present invention, the second time period is used to indicate a period of time after receiving the predetermined command and before receiving a next command from the host.
本发明所述的记忆装置,其中,当该第一母区块尚未执行该预清除操作时,该控制器于该第一时间周期执行该第一母区块的该预清除操作,并于一第三时间周期执行该第一母区块的该后清除操作,In the memory device of the present invention, when the first parent block has not yet performed the pre-erase operation, the controller executes the pre-erase operation of the first parent block in the first time period, and in a performing the post-clearing operation of the first parent block in a third time period,
其中,该第三时间周期于该第一时间周期之后,且于该第二时间周期之前,用以表示接收两连续数据单元的一间隔时间。Wherein, the third time period is after the first time period and before the second time period, and is used to represent an interval time for receiving two consecutive data units.
本发明所述的记忆装置,其中,该等数据区块更包括多个更新区块,且每一更新区块具有一或多个用以更新一对应母区块的更新页面。In the memory device of the present invention, the data blocks further include a plurality of update blocks, and each update block has one or more update pages for updating a corresponding parent block.
本发明所述的记忆装置,其中,该控制器取得该待清除区块的该更新模式、当该待清除区块的该更新模式为一子区块模式时,自该待清除区块所对应的该更新区块中寻找一最后更新页面、根据该最后更新页面,自该待清除区块中将该最后更新页面之后的数据搬移至该更新区块、以及抹除该待清除区块,用以进行该预清除操作及该后清除操作。In the memory device of the present invention, wherein the controller obtains the update mode of the block to be cleared, and when the update mode of the block to be cleared is a sub-block mode, from the block corresponding to the block to be cleared Find a last update page in the update block, move the data after the last update page from the block to be cleared to the update block according to the last update page, and erase the block to be cleared, using to perform the pre-clear operation and the post-clear operation.
本发明所述的记忆装置,其中,该控制器取得该待清除区块的该更新模式、当该待清除区块的该更新模式为一档案配置表区块模式时,取得一既定备用区块、自该待清除区块所对应的一更新区块中,读取一查找表,该查表记录该一或多个更新页面与该待清除区块的对应更新位置、根据该查表,将该待清除区块所储存的数据及该一或多个更新页面所储存的数据进行整合,用以得到一整合写入数据、将该整合写入数据编程至该既定备用区块、以及抹除该待清除区块及该更新区块,用以进行该预清除操作及该后清除操作。In the memory device of the present invention, wherein the controller obtains the update mode of the block to be cleared, and obtains a predetermined spare block when the update mode of the block to be cleared is a file allocation
本发明所述的记忆装置,其中,当该等母区块的数量未超过该第一临界值时,该控制器判断该目标母区块的该更新模式是否为一档案配置表区块模式、当该目标母区块的该更新模式为该档案配置表区块模式时,取得该写入数据的一数据长度、根据该起始逻辑区块地址及该数据长度,用以计算该目标母区块所对应的一更新区块,在执行该写入数据编程程序后的一结束逻辑区块地址、根据该结束逻辑区块地址及该更新区块的大小,取得该更新区块的一可用页面数量、判断该可用页面数量是否小于一第二临界值、当该可用页面数量小于该第二临界值时,将该目标母区块标记为该待清除区块、以及于该第二时间周期,执行该目标母区块的该预清除操作。In the memory device of the present invention, when the number of the parent blocks does not exceed the first critical value, the controller determines whether the update mode of the target parent block is a file allocation table block mode, When the update mode of the target parent block is the file configuration table block mode, obtain a data length of the written data, and use it to calculate the target parent block according to the initial logical block address and the data length An update block corresponding to the block obtains an available page of the update block according to the end logical block address and the size of the update block after executing the write-in data programming program. number, judging whether the number of available pages is less than a second critical value, when the number of available pages is less than the second critical value, marking the target parent block as the block to be cleared, and in the second time period, Execute the pre-clear operation of the target parent block.
实施本发明的用于闪存的写入逾时控制方法及其记忆装置,具有以下有益效果:控制器自主机接收写入数据的过程中,或者,自主机接收停止传送命令后到接收次一命令前的等待周期中,可将配对区块组的整合操作依序分成预清除操作及后清除操作。因此,在每一命令的执行期间,控制器可同时整合一或多组配对区块组,用以节省配对区块组整合时所耗费的时间,可解决了写入逾时的问题,从而提升记忆装置的整体存取效能。Implementing the write overtime control method for flash memory and its memory device of the present invention has the following beneficial effects: in the process of the controller receiving write data from the host, or from the host receiving the stop transmission command to receiving the next command In the previous waiting period, the integration operation of the paired block group can be divided into a pre-clear operation and a post-clear operation in sequence. Therefore, during the execution of each command, the controller can integrate one or more pairs of block groups at the same time, so as to save the time spent on the integration of paired block groups, and solve the problem of writing timeout, thereby improving The overall access performance of the memory device.
附图说明 Description of drawings
下面将结合附图及实施例对本发明作进一步说明,附图中:The present invention will be further described below in conjunction with accompanying drawing and embodiment, in the accompanying drawing:
图1是本发明实施例的记忆装置方块图;Fig. 1 is a memory device block diagram of the embodiment of the present invention;
图2是本发明实施例的一目标母区块与一更新区块的示意图;FIG. 2 is a schematic diagram of a target parent block and an update block according to an embodiment of the present invention;
图3是本发明实施例的用于闪存的写入逾时控制方法流程图;3 is a flowchart of a write timeout control method for flash memory according to an embodiment of the present invention;
图4是本发明实施例的写入命令、对应起始逻辑区块地址、及数据单元时序图;4 is a timing diagram of a write command, a corresponding starting logical block address, and a data unit according to an embodiment of the present invention;
图5是本发明另一实施例的子区块模式中一目标母区块与一更新区块的示意图;5 is a schematic diagram of a target parent block and an update block in the child block mode according to another embodiment of the present invention;
图6是本发明另一实施例的档案配置表区块模式中一目标母区块与一更新区块的示意图。FIG. 6 is a schematic diagram of a target parent block and an update block in the block mode of the file allocation table according to another embodiment of the present invention.
【主要组件符号说明】[Description of main component symbols]
10~记忆装置; 12~主机;10~memory device; 12~host;
102~控制器; 104~闪存;102~controller; 104~flash memory;
106~数据区; 108~备用区;106~data area; 108~reserve area;
D0~DI~数据区块; S0~SJ~备用区块;D0~DI~data block; S0~SJ~spare block;
202、502、602~目标母区块;及202, 502, 602~target parent block; and
204、504、604~更新区块。204, 504, 604~update blocks.
具体实施方式 Detailed ways
下文说明本发明的较佳实施方式。下述的说明用以更容易了解本发明,并非用以限制本发明。本发明的保护范围当视后附的申请专利范围所界定者为准。Preferred embodiments of the present invention are described below. The following descriptions are used to understand the present invention more easily, but are not intended to limit the present invention. The scope of protection of the present invention should be defined by the scope of the appended patent application.
图1是本发明实施例的记忆装置10方块图。FIG. 1 is a block diagram of a
如图1所示,记忆装置10耦接至主机12,且包括控制器102与闪存104。于一实施例中,闪存104为与非门(NAND)型闪存,且记忆装置10包括与闪存相关的各种记忆卡,例如:安全数字(SD)卡。于图1中,闪存104包括多个区块,且每一区块包括多个页面。As shown in FIG. 1 , the
进一步,可将闪存104划分成数据区(data pool)106与备用区(spare pool)108,各自包括多个数据区块及多个备用区块。举例来讲,于数据区106中,区块D0~DI为存有数据的数据区块,而于备用区108中,区块S0~SJ为未储存数据或数据已抹除的备用区块。I及J可为相同或不相同的数值。Further, the
如前所述,由于数据仅允许被写入至未储存数据(亦即,未经编程或已被抹除)的页面,当一数据区块,例如:区块D0的多个页面尚未储存数据时,控制器102即可将数据编程至该数据区块的该等页面。As mentioned above, since data is only allowed to be written to pages that have not stored data (that is, unprogrammed or erased), when a data block, such as: multiple pages of block D 0 have not been stored data, the
然而,当主机12欲对该数据区块中,已储存数据的页面进行数据更新时,控制器102并无法将数据编程至已储存数据的页面。于此情况下,根据本发明的实施例,控制器102可利用备用区108的备用区块S0~SJ,用以进行数据更新。However, when the
图2是本发明实施例的一目标母区块202与一更新区块204的示意图。FIG. 2 is a schematic diagram of a
参考第1及2图。具体地,假设主机12要求控制器102以一写入数据#DATA更新一数据区块,例如:区块D0的多个欲更新页面。由于该数据区块的欲更新页面已存有数据,因此,控制器102并无法将该写入数据#DATA直接编程至该数据区块的该等欲更新页面。于此情况下,控制器102可将该数据区块设定为目标母区块(mother block)202。其次,从备用区108中选择一备用区块,例如:区块S0,用以作为更新目标母区块202的更新区块204。之后,再将该写入数据#DATA编程至该更新区块204的更新页面。Refer to Figures 1 and 2. Specifically, assume that the
于上述实施例中,因为更新区块204具有多个用以更新对应目标母区块202的更新页面,因此,可将目标母区块202及更新区块204称为一配对区块组。In the above embodiment, since the
此外,在不影响记忆装置10正常操作的前提下,控制器102可根据存取效能的需求来配置一既定数量的配对区块组,从而利用多个目标母区块及对应的更新区块来进行数据更新操作。于一实施例中,当一既定条件符合时,举例来讲,当更新区块204已存满用以更新目标母区块202的数据时,或者,已达记忆装置10所允许的配对区块组的数量时,控制器102需进一步整合目标母区块202及更新区块204。In addition, without affecting the normal operation of the
于一实施例中,控制器102将目标母区块202标记为一待清除区块,用以将目标母区块202所储存的数据整合至更新区块204。之后,抹除目标母区块202,并将抹除后的目标母区块202重置(reconfigure)为一备用区块,以供后续使用。In one embodiment, the
于另一实施例中,控制器102将目标母区块202标记为一待清除区块。接着,控制器102自备用区108中选择一备用区块,例如:区块S1,再将目标母区块202及更新区块204整合至区块S1。之后,抹除目标母区块202及更新区块204,并将抹除后的目标母区块202及更新区块204重置为备用区块,以供后续使用。更具体地,为了避免随着区块的记忆容量而导致写入逾时的情况发生,可将上述目标母区块202及更新区块204的整合过程分成至少两次完成。数据更新及整合的流程将参考第3-6图的实施例详细说明如下。In another embodiment, the
图3是本发明实施例的用于闪存的写入逾时控制方法30流程图。FIG. 3 is a flowchart of a write timeout control method 30 for flash memory according to an embodiment of the present invention.
参考第1至3图,假设主机12要求控制器102更新一数据区块,例如:区块D0。控制器102接收来自于主机12的一写入命令及对应的一起始逻辑区块地址(logical block address,LBA)(步骤S302)。之后,控制器102将该起始逻辑区块地址链接至欲更新数据区块,即区块D0。因此,控制器102将区块D0设定为欲更新的目标母区块202,并从备用区108中选择一备用区块(例如:区块S0),作为目标母区块202的对应更新区块204。Referring to FIGS. 1 to 3 , assume that the
接着,控制器102自主机12取得写入数据#DATA,用以更新目标母区块202的该等欲更新页面。具体地,每一页面可进一步地划分为4个储存段(sector)。因此,于一实施例中,可以储存段为单位,但不限于此,将该写入数据#DATA分为一连串的数据单元。换句话说,控制器102接收该起始逻辑区块地址后,随即依序接收用以表示该写入数据#DATA的一连串数据单元,如图4所示的数据单元U0~UK。Next, the
图4是本发明实施例的写入命令CMDN、对应起始逻辑区块地址LBAN、及数据单元U0~UK时序图。FIG. 4 is a timing diagram of a write command CMD N , a corresponding initial logical block address LBA N , and data units U 0 -U K according to an embodiment of the present invention.
如图4所示,控制器102接收写入命令CMDN及对应起始逻辑区块地址LBAN后,随即接收一连串的数据单元U0~UK。进一步地,接收完该等数据单元U0~UK后,控制器102接收由12主机发出的一停止传送命令STOP_TRAN,用以表示数据单元U0~UK已传送完成。于一实施例中,两连续数据单元间,例如:数据单元U0及U1,所间隔的周期,即编程忙录时间,为250毫秒(ms),或者更短。除此之外,收到停止传送命令STOP_TRAN后,到接收次一命令CMDN+1前,亦间隔250毫秒的周期。因此,控制器102可利用上述的时间周期,将需进行的配对区块组的整合操作分成至少两次进行。举例来讲,控制器102可利用上述的时间周期,将配对区块组的整合操作分成预清除操作及后清除操作两次完成。As shown in FIG. 4 , after receiving the write command CMD N and the corresponding initial logical block address LBA N , the
除此之外,控制器102根据起始逻辑区块地址LBAN所链接的目标母区块202,用以决定一更新模式(步骤S304)。于一实施例中,当主机12欲更新目标母区块202的连续页面时,目标母区块202的更新模式为子区块模式(mother-child mode)。于另一实施例中,当主机12欲更新目标母区块202的零散页面时,目标母区块202的更新模式为档案配置表(file allocation table,FAT)区块模式(mother-FAT mode)。In addition, the
图5是本发明另一实施例的子区块模式中一目标母区块502与一更新区块504的示意图。FIG. 5 is a schematic diagram of a
如图5所示,目标母区块502包括N个页面502_0~502_N-1,分别存有数据P502_0~P502_N-1。对应地,更新区块504亦包括N个更新页面504_0~504_N-1。由于更新区块504为备用区块,因此,该等N个更新页面504_0~504_N-1并未储存任何数据。As shown in FIG. 5 , the
于此实施例中,假设主机12要求控制器102更新目标母区块502的连续页面502_0~502_4中所储存的数据P502_0~P502_4。因此,控制器102决定目标母区块502的更新模式为子区块模式。也就是说,控制器102将更新区块504设为一子区块(child block),用以进行子区块模式的数据更新操作。In this embodiment, assume that the
根据图5的实施例,当控制器102将目标母区块502的页面502_0~502_4所对应的更新数据储存至更新区块504的更新页面504_0~504_4时,控制器102进一步整合目标母区块502及更新区块504。首先,控制器102将目标母区块502标记为一待清除区块。接下来,控制器102自目标母区块502所对应的更新区块504中,寻找一最后更新页面,即更新页面504_4。因此,于预清除操作中,根据最后更新页面504_4,控制器102将目标母区块502中未更新页面502_5~402_N-1所储存的数据P502_5~P502_N-1先搬移至更新区块504的更新页面504_5~504_N-1。进一步,于后清除操作中,控制器102抹除目标母区块502。According to the embodiment of FIG. 5, when the
图6是本发明另一实施例的档案配置表区块模式中一目标母区块602与一更新区块604的示意图。FIG. 6 is a schematic diagram of a target parent block 602 and an update block 604 in the file allocation table block mode according to another embodiment of the present invention.
如图6所示,目标母区块602包括N个页面602_0~602_N-1,分别存有数据P602_0~P602_N-1。对应地,更新区块604亦包括N个更新页面604_0~604_N-1。由于更新区块604为备用区块,因此,该等N个更新页面604_0~604_N-1并未储存任何数据。As shown in FIG. 6 , the target parent block 602 includes N pages 602_0˜602_N−1, respectively storing data P602_0˜P602_N−1. Correspondingly, the update block 604 also includes N update pages 604_0˜604_N−1. Since the update block 604 is a spare block, the N update pages 604_0˜604_N−1 do not store any data.
于此实施例中,假设主机12要求控制器102更新目标母区块602的非连续页面602_2、602_3、602_4、602_7及602_8中所储存的数据P602_2、P602_3、P602_4、P602_7及P602_8。因此,控制器102决定目标母区块602的更新模式为档案配置表区块模式。换句话说,控制器102将更新区块604设为一档案配置表区块(FAT block),用以进行档案配置表区块模式的数据更新操作。In this embodiment, assume that the
举例来说,当主机12要求以更新数据P2、P3、P4、P7及P8更新目标母区块602的页面602_2、602_3、602_4、602_7及602_8时,控制器102先将更新数据P2、P3及P4储存于更新区块604的更新页面604_0、604_1及604_2。之后,控制器102利用查找表TABLE_1,用以记录更新区块604的更新页面与目标母区块602的对应欲更新页面。也就是说,查找表TABLE_1记录着目标母区块602的页面602_2、602_3及602_4,与更新区块604的更新页面604_0、604_1及604_2,两者之间的对应关系。接着,控制器102将查找表TABLE_1编程至更新区块604的更新页面604_3。进一步,控制器102将更新数据P7及P8储存于更新区块604的更新页面604_4及604_5。同样地,控制器102再度利用查找表TABLE_2来记录着目标母区块602的页面602_7及602_8,与更新区块604的更新页面604_4及604_5两者之间的对应关系。然后,控制器102将查找表TABLE_2编程至更新区块604的更新页面604_6,用以结束档案配置表区块模式的数据更新操作。For example, when the
根据图6的实施例,当更新区块604存满用以更新目标母区块602的数据时,控制器102需整合目标母区块602及更新区块604。控制器102先将目标母区块602标记为一待清除区块。接着,控制器102自备用区108中选择一备用区块,例如:区块S1。因此,于预清除操作中,根据查找表TABLE_1及TABLE_2,控制器102将目标母区块602所储存的数据及更新区块604的更新页面所储存的更新数据进行整合,用以取得一整合写入数据。详细地,控制器102将目标母区块602的未更新页面,像是602_0、602_1、602_5、602_6、602_9~602_N-1所储存的数据,以及更新区块604的更新页面602_0~602_2及602_4~602_5所储存的数据加以整合,用以产生该整合写入数据。之后,控制器102将该整合写入数据编程至区块S1。进一步,于后清除操作中,控制器102抹除目标母区块602及更新区块604。According to the embodiment of FIG. 6 , when the update block 604 is full of data for updating the target parent block 602 , the
进一步,参考第3及4图,当目标母区块的更新模式决定后,控制器102自主机12取得用于更新的写入数据#DATA,即数据单元U0~UK。具体地,控制器102收到第一笔数据单元U0后(图3的步骤S306),随即判断在前一次命令CMDN-1的执行期间,是否有未完成的整合操作。亦即,控制器102判断是否有被标记为待清除区块的一特定母区块已执行过预清除操作(图3的步骤S308)。Further, referring to FIG. 3 and FIG. 4 , after the update mode of the target parent block is determined, the
当该特定母区块已执行过预清除操作时,于第一时间周期T1的250毫秒内,控制器102执行该特定母区块的后清除操作(图3的步骤S310)。When the pre-clear operation has been performed on the specific parent block, the
若该特定母区块并未于前一次命令CMDN-1的执行期间执行预清除操作时,于第一时间周期T1内,控制器102先执行该特定母区块的预清除操作。之后,控制器102可于另一时间周期内,例如:数据单元U1及U2所间隔的周期内,执行该特定母区块的后清除操作(图3的步骤S312)。If the specific parent block has not performed the pre-clear operation during the execution of the previous command CMD N−1 , the
进一步,当该特定母区块被抹除后,控制器102将该特定母区块重置为一备用区块(图3的步骤S314)。Further, after the specific parent block is erased, the
接下来,控制器102继续接收剩余的数据单元,用以进行图5的子区块模式数据更新操作或图6的档案配置表区块模式数据更新操作。具体地,控制器102执行对应于写入命令CMDN及起始逻辑区块地址LBAN的写入数据#DATA编程程序(图3的步骤S316)。亦即,根据目标母区块502或602的更新模式,控制器102将所有数据单元U0~UK依序编程至更新区块504或604的对应更新页面。Next, the
控制器102收到停止传送命令STOP_TRAN后,随即判断配对区块组的数量是否超过既定数量(图3的步骤S318)。After receiving the stop transmission command STOP_TRAN, the
当控制器102所配置的配对区块组数量已达既定数量时,记忆装置10的正常操作可能会受到影响。因此,控制器102先从目前的配对区块组中,选择其中一组配对区块组进行整合操作。之后,于收到停止传送命令STOP_TRAN后,到接收次一命令CMDN+1前的一段时间内,亦即,如图4所示的第二时间周期T2的250毫秒内,控制器102对该选择的配对区块组进行部份的整合操作,即前述的预清除操作(图3的步骤S320)。更进一步,控制器102可于次一命令CMDN+1的执行期间,例如:于收到次一命令CMDN+1的第一笔数据单元后的250毫秒内,对该选择的配对区块组进行剩余的整合操作,即前述的后清除操作。如此一来,可以有效解决闪存写入逾时的问题。When the number of paired block groups configured by the
当配对区块组的数量尚未超过既定数量时,控制器102进一步判断目标母区块的更新模式是否为档案配置表区块模式(图3的步骤S322)。When the number of paired block groups has not exceeded the predetermined number, the
参考第3、4及6图,当目标母区块602的更新模式被判断为档案配置表区块模式,控制器102取得用以更新目标母区块602的写入数据#DATA,即数据单元U0~UK,的数据长度。之后,根据起始逻辑区块地址LBAN及数据长度,控制器102计算目标母区块602的对应更新区块604在执行写入数据#DATA编程程序后的一结束逻辑区块地址,如图6所示的更新页面604_6。接着,控制器102根据结束逻辑区块地址及更新区块604的大小,用以取得更新区块604的可用页面数量。具体地,根据图6的实施例,更新区块604具有N个更新页面,且结束逻辑区块地址为更新页面604_6。于此情况下,更新区块604的可用页面数量为(N-7)。然后,控制器102判断更新区块604的可用页面数量(N-7)是否小于一预设临界值(图3的步骤S324)。Referring to Figures 3, 4 and 6, when the update mode of the target parent block 602 is determined to be the file configuration table block mode, the
当更新区块604的可用页面数量(N-7)比预设临界值多时,表示更新区块604的可用页面数量(N-7)足以维持后续的数据更新操作。换句话说,目标母区块602及更新区块604尚不需要进行整合操作。When the number of available pages (N-7) of the update block 604 is greater than the preset threshold, it means that the number of available pages (N-7) of the update block 604 is sufficient to maintain subsequent data update operations. In other words, the target parent block 602 and update block 604 do not need to be integrated yet.
反之,当更新区块604的可用页面数量(N-7)小于预设临界值时,表示控制器102需进一步整合目标母区块602及更新区块604。具体地,控制器102先将目标母区块602标记为待清除区块。之后,于图4所示的第二时间周期T2内,控制器102对目标母区块602及更新区块604进行预清除操作(图3的步骤S326)。再者,于次一命令CMDN+1的执行期间,例如:于收到次一命令CMDN+1的第一笔数据单元后的250毫秒内,控制器102对目标母区块602及更新区块604进行后清除操作。目标母区块602及更新区块604的预清除操作及后清除操作方式已详述于图6及其相关实施例中,于此不加赘述。On the contrary, when the number of available pages (N−7) of the update block 604 is less than the preset threshold, it means that the
综上所述,依据本发明的实施例,为了避免记忆装置发生写入逾时的情况,可配置具有目标母区块及对应更新区块的配对区块组来进行数据更新操作。进一步,可将配对区块组的整合操作分成至少两次完成。也就是说,控制器自主机接收写入数据的过程中,或者,自主机接收停止传送命令后到接收次一命令前的等待周期中,可将配对区块组的整合操作依序分成预清除操作及后清除操作。因此,在每一命令的执行期间,控制器可同时整合一或多组配对区块组,用以节省配对区块组整合时所耗费的时间,可解决写入逾时的问题,从而能够提升记忆装置的整体存取效能。To sum up, according to the embodiment of the present invention, in order to avoid the write timeout of the memory device, a paired block group with the target parent block and the corresponding update block can be configured to perform the data update operation. Further, the integration operation of the paired block groups can be divided into at least two times. That is to say, during the process of the controller receiving write data from the host, or during the waiting period from the host receiving the stop transmission command to receiving the next command, the integration operation of the paired block group can be sequentially divided into pre-clear operation and post-clear operation. Therefore, during the execution of each command, the controller can integrate one or more pairs of block groups at the same time, so as to save the time spent on the integration of paired block groups, solve the problem of write timeout, and thus improve The overall access performance of the memory device.
虽然本发明已以较佳实施例揭露如上,然其并非用以限定本发明,任何熟习此技艺者,在不脱离本发明的精神和范围内,当可作各种的更动与润饰,因此本发明的保护范围当视后附的申请专利范围所界定者为准。Although the present invention has been disclosed above with preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make various 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 scope of the appended patent application.
Claims (14)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201010004561A CN102122269B (en) | 2010-01-07 | 2010-01-07 | Flash memory writing overtime control method and memory device thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201010004561A CN102122269B (en) | 2010-01-07 | 2010-01-07 | Flash memory writing overtime control method and memory device thereof |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102122269A CN102122269A (en) | 2011-07-13 |
CN102122269B true CN102122269B (en) | 2012-10-03 |
Family
ID=44250831
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201010004561A Active CN102122269B (en) | 2010-01-07 | 2010-01-07 | Flash memory writing overtime control method and memory device thereof |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102122269B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107943710B (en) * | 2016-10-13 | 2021-08-27 | 深圳大心电子科技有限公司 | Memory management method and memory controller using the same |
CN109683803B (en) * | 2017-10-19 | 2021-07-13 | 中兴通讯股份有限公司 | Data processing method and device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1567476A (en) * | 2003-06-24 | 2005-01-19 | 群联电子股份有限公司 | Data writing method for high-speed large block of flash memory |
CN101458956A (en) * | 2007-12-14 | 2009-06-17 | 慧荣科技股份有限公司 | Apparatus and method for accessing a flash memory and method for averagely using blocks of the flash memory |
-
2010
- 2010-01-07 CN CN201010004561A patent/CN102122269B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1567476A (en) * | 2003-06-24 | 2005-01-19 | 群联电子股份有限公司 | Data writing method for high-speed large block of flash memory |
CN101458956A (en) * | 2007-12-14 | 2009-06-17 | 慧荣科技股份有限公司 | Apparatus and method for accessing a flash memory and method for averagely using blocks of the flash memory |
Also Published As
Publication number | Publication date |
---|---|
CN102122269A (en) | 2011-07-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI409633B (en) | Flash memory storage device, controller thereof, and method for programming data | |
CN103425595B (en) | Block management method for data storage device and flash memory | |
JP5002201B2 (en) | Memory system | |
US8812784B2 (en) | Command executing method, memory controller and memory storage apparatus | |
CN102981959B (en) | Solid-state storage device and method for controlling garbage collection action thereof | |
US9176865B2 (en) | Data writing method, memory controller, and memory storage device | |
TWI512467B (en) | Methods for maintaining a storage mapping table and apparatuses using the same | |
US9021218B2 (en) | Data writing method for writing updated data into rewritable non-volatile memory module, and memory controller, and memory storage apparatus using the same | |
CN110673789B (en) | Metadata storage management method, device, equipment and storage medium of solid state disk | |
CN110989918B (en) | Write control method, data storage device and controller thereof | |
US9304900B2 (en) | Data reading method, memory controller, and memory storage device | |
KR101374065B1 (en) | Data Distinguish Method and Apparatus Using Algorithm for Chip-Level-Parallel Flash Memory | |
CN104765569A (en) | Data writing method, memory control circuit unit and memory storage device | |
US9378130B2 (en) | Data writing method, and memory controller and memory storage apparatus using the same | |
CN113885808A (en) | Mapping information recording method, memory control circuit unit and memory device | |
CN107045423B (en) | Memory device and data access method therefor | |
US8943289B2 (en) | Data moving method for flash memory module, and memory controller and memory storage apparatus using the same | |
TWI709975B (en) | Write control method, associated data storage device and controller thereof | |
CN101576859A (en) | Nonvolatile memory data writing method, memory system and controller thereof | |
CN102122269B (en) | Flash memory writing overtime control method and memory device thereof | |
TWI417889B (en) | Write timeout methods for a flash memory and memory device using the same | |
US9710374B2 (en) | Data writing method, memory controller and memory storage device | |
JP4334331B2 (en) | Flash memory access control method | |
TWI863051B (en) | Memory management method, memory storage device and memory control circuit unit | |
TWI810719B (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 |