TWI670640B - Data storage method and data recovery method for data storage device, and data storage device using the same methods - Google Patents

Data storage method and data recovery method for data storage device, and data storage device using the same methods Download PDF

Info

Publication number
TWI670640B
TWI670640B TW106118406A TW106118406A TWI670640B TW I670640 B TWI670640 B TW I670640B TW 106118406 A TW106118406 A TW 106118406A TW 106118406 A TW106118406 A TW 106118406A TW I670640 B TWI670640 B TW I670640B
Authority
TW
Taiwan
Prior art keywords
data
data block
comparison table
active
block
Prior art date
Application number
TW106118406A
Other languages
Chinese (zh)
Other versions
TW201820117A (en
Inventor
沈揚智
周柏昇
Original Assignee
慧榮科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 慧榮科技股份有限公司 filed Critical 慧榮科技股份有限公司
Priority to TW106118406A priority Critical patent/TWI670640B/en
Publication of TW201820117A publication Critical patent/TW201820117A/en
Application granted granted Critical
Publication of TWI670640B publication Critical patent/TWI670640B/en

Links

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

本發明提出可用於資料儲存裝置之一種資料儲存方法與一種資料回復程序,以及採用這些方法的資料儲存裝置。此資料儲存方法包括:選取主動資料區塊以儲存來自主機的資料;判斷是否發生電源中斷事件;當判斷為是時,記錄主動資料區塊的編號、以及主動資料區塊中具有資料的最後一個資料頁的編號;產生主要F2H對照表;以及將主要F2H對照表、主動資料區塊的編號、以及具有資料的最後一個資料頁的編號寫入至指定資料區塊。 The present invention proposes a data storage method and a data recovery program that can be used for a data storage device, and a data storage device using the same. The data storage method includes: selecting an active data block to store data from the host; determining whether a power interruption event occurs; when the determination is yes, recording the number of the active data block and the last data having the data in the active data block The number of the data page; the primary F2H comparison table is generated; and the primary F2H comparison table, the number of the active data block, and the number of the last data page with the data are written to the designated data block.

Description

可用於資料儲存裝置之資料儲存方法與資料回復程序、 以及採用這些方法的資料儲存裝置 Data storage method and data recovery procedure that can be used for data storage devices, And data storage device using these methods

本發明是有關於資料儲存之技術,尤其是有關於可用於資料儲存裝置之一種資料儲存方法與一種資料回復程序、以及一種採用這些方法的資料儲存裝置。 The present invention relates to techniques for data storage, and more particularly to a data storage method and a data recovery program that can be used for data storage devices, and a data storage device using the same.

傳統上,採用非揮發性記憶體(Non-volatile memory)作為資料儲存媒體的資料儲存裝置在運作時如果發生電源中斷事件,必需立即產生一實體位址至邏輯位址(Flash Physical-to-Host Logical address mapping table,F2H)對照表,以下簡稱為F2H對照表,以建立使用者資料的實體位址(physical address)至邏輯位址(logical address)之間的對應關係(簡稱對應關係),避免使用者資料的遺失。由此可知,F2H對照表對於資料儲存裝置的運作極為重要。 Traditionally, a data storage device using a non-volatile memory as a data storage medium must generate a physical address to a logical address (Flash Physical-to-Host) if a power interruption event occurs during operation. Logical address mapping table, F2H) comparison table, hereinafter referred to as F2H comparison table, to establish the correspondence between physical address and logical address of user data (referred to as correspondence) Loss of user data. It can be seen that the F2H comparison table is extremely important for the operation of the data storage device.

然而,電源中斷事件發生後,資料儲存裝置需要在所剩無幾的時間內建立並儲存F2H對照表。因此,如何建立一個精簡的F2H對照表並將它儲存至適當的地方,以便復電時資料儲存裝置可以依據F2H對照表而取得使用者資料,存在著實作上的需求。 However, after a power outage event occurs, the data storage device needs to establish and store the F2H lookup table in the few remaining time. Therefore, how to establish a streamlined F2H comparison table and store it in the appropriate place, so that the data storage device can obtain user data according to the F2H comparison table during the power-on, there is a practical requirement.

本發明之一目的在提供可用於資料儲存裝置之資料儲存方法,以此方法所產生之F2H對照表的資料量較少。 It is an object of the present invention to provide a data storage method that can be used in a data storage device in which the amount of data generated by the F2H look-up table is small.

本發明之另一目的在提供一種對應於上述資料儲存方法的資料回復程序。 Another object of the present invention is to provide a data recovery procedure corresponding to the above data storage method.

本發明之再一目的在提供一種採用上述方法的資料儲存裝置。 Still another object of the present invention is to provide a data storage device using the above method.

本發明提出一種可用於資料儲存裝置之資料儲存方法,此資料儲存方法包括有下列步驟:選取主動資料區塊以儲存來自主機的資料;判斷是否發生電源中斷事件;當判斷為是時,記錄主動資料區塊的編號、以及主動資料區塊中具有資料的最後一個資料頁的編號;產生主要F2H對照表;以及將主要F2H對照表、主動資料區塊的編號、以及具有資料的最後一個資料頁的編號寫入至指定資料區塊。 The present invention provides a data storage method that can be used for a data storage device. The data storage method includes the following steps: selecting an active data block to store data from the host; determining whether a power interruption event occurs; and when the determination is yes, recording the initiative The number of the data block and the number of the last data page with the data in the active data block; generate the main F2H comparison table; and the main F2H comparison table, the number of the active data block, and the last data page with the data The number is written to the specified data block.

本發明另提出一種可用於資料儲存裝置之資料儲存方法,此資料儲存方法包括有下列步驟:選取主動資料區塊以儲存來自主機的資料;判斷是否發生電源中斷事件;當判斷為是時,進一步判斷主動資料區塊是否已發生另一電源中斷事件;當進一步判斷的結果為否時,記錄主動資料區塊的編號、以及主動資料區塊中具有資料的最後一個資料頁的主要編號;產生主要F2H對照表;以及將主要F2H對照表、主動資料區塊的編號、以及具有資料的最後一個資料頁的主要編號寫入至指定資料區塊。 The present invention further provides a data storage method that can be used for a data storage device. The data storage method includes the following steps: selecting an active data block to store data from the host; determining whether a power interruption event occurs; when the determination is yes, further Determining whether another power interruption event has occurred in the active data block; when the result of the further determination is no, recording the number of the active data block and the major number of the last data page having the data in the active data block; The F2H comparison table; and the main F2H comparison table, the number of the active data block, and the major number of the last data page with the data are written to the designated data block.

本發明再提出一種可用於資料儲存裝置之資料回復程序,此資料回復程序包括下列步驟:讀取指定資料區塊而取得F2H對照表、主動資料區塊的編號、以及具有資料的最後一個資料頁的編號;判斷F2H對照表的內容是否與主動資料區塊的編號以及具有資料的最後一個資料頁的編號一致;當判斷為是時,將F2H對照表儲存至揮發性儲存媒體;以及選取一主動資料區塊以儲存來自主機的資料。 The invention further proposes a data replying program which can be used for the data storage device. The data replying program comprises the following steps: reading the designated data block to obtain the F2H comparison table, the number of the active data block, and the last data page having the data. Number; determine whether the content of the F2H comparison table is consistent with the number of the active data block and the number of the last data page with the data; when the determination is yes, store the F2H comparison table to the volatile storage medium; and select an active Data block to store data from the host.

本發明又提出一種資料儲存裝置,其包括有非揮發性儲存媒體以及控制單元。控制單元用以自非揮發性儲存媒體選取主動資料區塊以儲存來自主機的資料,並判斷是否發生電源中斷事件。當判斷為是 時,控制單元便記錄主動資料區塊的編號、以及主動資料區塊中具有資料的最後一個資料頁的編號,據以產生主要F2H對照表,並將主要F2H對照表、主動資料區塊的編號、以及具有資料的最後一個資料頁的編號寫入至非揮發性儲存媒體中之指定資料區塊。 The invention further provides a data storage device comprising a non-volatile storage medium and a control unit. The control unit is configured to select an active data block from the non-volatile storage medium to store data from the host and determine whether a power interruption event occurs. When judged as yes When the control unit records the number of the active data block and the number of the last data page with the data in the active data block, the main F2H comparison table is generated, and the main F2H comparison table and the number of the active data block are generated. And the number of the last data page with the data is written to the specified data block in the non-volatile storage medium.

本發明又另提出一種資料儲存裝置,其包括有非揮發性儲存媒體以及控制單元。控制單元用以自揮發性儲存媒體選取主動資料區塊以儲存來自主機的資料,並判斷是否發生電源中斷事件,當判斷為是時,進一步判斷主動資料區塊是否已發生另一電源中斷事件。且當進一步判斷的結果為否時,控制單元便記錄主動資料區塊的編號、以及主動資料區塊中具有資料的最後一個資料頁的主要編號,據以產生主要F2H對照表,並將主要F2H對照表、主動資料區塊的編號、以及具有資料的最後一個資料頁的主要編號寫入至非揮發性儲存媒體之指定資料區塊。 The invention further provides a data storage device comprising a non-volatile storage medium and a control unit. The control unit is configured to select an active data block from the volatile storage medium to store data from the host, and determine whether a power interruption event occurs. When the determination is yes, further determine whether another active power interruption event has occurred in the active data block. And when the result of the further judgment is no, the control unit records the number of the active data block and the major number of the last data page having the data in the active data block, thereby generating a main F2H comparison table, and the main F2H The comparison table, the number of the active data block, and the major number of the last data page with the data are written to the designated data block of the non-volatile storage medium.

本發明又再提出一種資料儲存裝置,其包括有揮發性儲存媒體、非揮發性儲存媒體以及控制單元。控制單元用以讀取非揮發性儲存媒體中之指定資料區塊而取得F2H對照表、主動資料區塊的編號、以及具有資料的最後一個資料頁的編號,並判斷F2H對照表的內容是否與主動資料區塊的編號以及具有資料的最後一個資料頁的編號一致。當判斷為是時,控制單元便將F2H對照表儲存至揮發性儲存媒體,並自非揮發性儲存媒體選取主動資料區塊以儲存來自主機的資料。 The invention further proposes a data storage device comprising a volatile storage medium, a non-volatile storage medium and a control unit. The control unit is configured to read the designated data block in the non-volatile storage medium, obtain the F2H comparison table, the number of the active data block, and the number of the last data page having the data, and determine whether the content of the F2H comparison table is The number of the active data block and the number of the last data page with the data are the same. When the determination is yes, the control unit stores the F2H comparison table to the volatile storage medium, and selects the active data block from the non-volatile storage medium to store the data from the host.

在本發明中,由於控制單元在電源中斷時所產生的F2H對照表僅記錄部份資料頁的資料的對應關係,因此,產生的F2H對照表的資料量會少於採習知方法所產生之完整F2H對照表的資料量,不但可以降低F2H對照表的資料量,更能減少產生的F2H對照表所需要的時間,且將F2H對照表儲存至具有較佳資料保存能力的資料區塊中,更能提供F2H對照表較佳的保護。 In the present invention, since the F2H comparison table generated by the control unit when the power is interrupted only records the correspondence of the data of the partial data pages, the amount of data generated by the F2H comparison table is less than that produced by the learned method. The amount of data in the complete F2H comparison table can not only reduce the amount of data in the F2H comparison table, but also reduce the time required for the generated F2H comparison table, and store the F2H comparison table in the data block with better data retention ability. Better protection of the F2H comparison table is provided.

100‧‧‧主機 100‧‧‧Host

110‧‧‧中央處理單元 110‧‧‧Central Processing Unit

120‧‧‧連接介面 120‧‧‧Connection interface

200‧‧‧資料儲存裝置 200‧‧‧ data storage device

210‧‧‧控制單元 210‧‧‧Control unit

212‧‧‧介面邏輯 212‧‧‧Interface logic

214‧‧‧微處理器 214‧‧‧Microprocessor

216‧‧‧控制邏輯 216‧‧‧Control logic

220‧‧‧非揮發性儲存媒體 220‧‧‧Non-volatile storage media

230‧‧‧揮發性儲存媒體 230‧‧‧Volatile storage media

240‧‧‧SLC類型資料區塊 240‧‧‧SLC type data block

250‧‧‧多平面資料頁 250‧‧‧Multi-planar data page

260‧‧‧超級資料區塊 260‧‧‧Super Data Block

270‧‧‧超級資料頁 270‧‧‧Super Data Page

F2H#0~F2H#3‧‧‧具有編號的F2H對照表 F2H#0~F2H#3‧‧‧F2H comparison table with numbers

P1、P2‧‧‧平面 P1, P2‧‧‧ plane

S301~S305、S401~S409、S501-S505‧‧‧步驟 S301~S305, S401~S409, S501-S505‧‧‧ steps

圖1繪有依照本發明一實施例之資料儲存裝置及其與主機的電性耦接關係;圖2繪有依照本發明一實施例之非揮發性儲存媒體220的實現方式;圖3為依照本發明一實施例之資料儲存方法的流程圖;圖4為依照本發明另一實施例之資料儲存方法的流程圖;圖5為本發明一實施例的資料回復程序的流程。 1 is a data storage device according to an embodiment of the invention and its electrical coupling relationship with a host; FIG. 2 illustrates an implementation of a non-volatile storage medium 220 according to an embodiment of the invention; FIG. A flowchart of a data storage method according to an embodiment of the present invention; FIG. 4 is a flowchart of a data storage method according to another embodiment of the present invention; and FIG. 5 is a flowchart of a data recovery procedure according to an embodiment of the present invention.

圖1繪有依照本發明一實施例之資料儲存裝置及其與主機的電性耦接關係。請參照圖1,主機100主要包括有中央處理單元110與連接介面120。連接介面120適於電性耦接資料儲存裝置200。中央處理單元110用以透過連接介面120傳送命令、資料給資料儲存裝置200,例如是傳送讀取命令給資料儲存裝置200,或是傳送寫入命令及欲寫入資料儲存裝置200的資料給資料儲存裝置200。而在此例中,主機100包括以電腦、手機、平板、相機或是其他具運算功能的手持式電子裝置來實現。 1 depicts a data storage device and its electrical coupling relationship with a host in accordance with an embodiment of the present invention. Referring to FIG. 1 , the host 100 mainly includes a central processing unit 110 and a connection interface 120 . The connection interface 120 is adapted to be electrically coupled to the data storage device 200. The central processing unit 110 is configured to transmit commands and data to the data storage device 200 through the connection interface 120, for example, to transmit a read command to the data storage device 200, or to transmit a write command and data to be written to the data storage device 200. Storage device 200. In this example, the host 100 includes a computer, a mobile phone, a tablet, a camera, or other handheld electronic device with computing functions.

資料儲存裝置200主要包括有控制單元210、非揮發性儲存媒體220與揮發性儲存媒體230。控制單元210係電性耦接非揮發性儲存媒體220與揮發性儲存媒體230,並用以控制非揮發性儲存媒體220與揮發性儲存媒體230的操作(例如進行資料的存取與抹除)。在此例中,非揮發性儲存媒體220例如是以快閃記憶體(Flash memory)、磁阻式隨機存取記憶體(Magnetoresistive RAM)、鐵電隨機存取記憶體(Ferroelectric RAM)等具有長時間資料保存之記憶體裝置來實現,在下述的說明中將以快閃記憶體為例進行說明,但不以此為限。 The data storage device 200 mainly includes a control unit 210, a non-volatile storage medium 220, and a volatile storage medium 230. The control unit 210 is electrically coupled to the non-volatile storage medium 220 and the volatile storage medium 230, and is used to control the operations of the non-volatile storage medium 220 and the volatile storage medium 230 (eg, accessing and erasing data). In this example, the non-volatile storage medium 220 has long lengths such as a flash memory, a magnetoresistive random access memory (Magnetoresistive RAM), and a ferroelectric random access memory (Ferroelectric RAM). The memory device in which the time data is stored is realized. In the following description, the flash memory will be described as an example, but not limited thereto.

揮發性儲存媒體230例如是以動態隨機存取記憶體(Dynamic Random-Access Memory,DRAM)、靜態隨機存取記憶體(Static Random-Access Memory,SRAM)等具有資料緩衝(data buffering)功能的元件來實現。 The volatile storage medium 230 is, for example, a component having a data buffering function such as a dynamic random access memory (DRAM) or a static random access memory (SRAM). to realise.

控制單元210主要包括有介面邏輯212、微處理器214與控制邏輯216。微處理器214電性耦接介面邏輯212與控制邏輯214。微處理器214用以透過控制邏輯216存取非揮發性儲存媒體220與揮發性儲存媒體230中的資料,且微處理器214還用以透過介面邏輯212接收來自主機100之命令或資料,例如:寫入命令、欲寫入資料儲存裝置200的資料、讀取命令、抹除命令等。 Control unit 210 primarily includes interface logic 212, microprocessor 214, and control logic 216. The microprocessor 214 is electrically coupled to the interface logic 212 and the control logic 214. The microprocessor 214 is configured to access the data in the non-volatile storage medium 220 and the volatile storage medium 230 through the control logic 216, and the microprocessor 214 is further configured to receive commands or materials from the host 100 through the interface logic 212, such as : a write command, a data to be written to the data storage device 200, a read command, an erase command, and the like.

圖2繪有依照本發明一實施例之非揮發性儲存媒體220的實現方式。請參照圖2,非揮發性儲存媒體220包括有記憶體0~4。記憶體0較佳為SLC(Single Level Cell,單階儲存單元)類型快閃記憶體,以提供較大的資料存取能力或較佳的資料正確性(data integrity)。記憶體0可用以儲存機密(confidential)資料、保護(protection)資料或管理(management)資料,其中,保護資料包括:使用者設定的安全資訊(例如密碼)、偵錯日誌等,其中偵錯日誌較佳為S.M.A.R.T.(Self-Monitoring Analysis and Reporting Technology,自我監測、分析及報告技術)資訊。記憶體0具有多個SLC類型資料區塊240,而每一個SLC類型資料區塊240較佳具有二個平面(planes),分別以平面P1與P2來表示。每一個平面具有Q+1個實體資料頁(physical page),其中Q為自然數,例如是256。控制單元210較佳可同時對平面P1與P2的一個資料頁進行存取,此運作模式稱之為多平面(multi-planes)存取,並將此二個平面P1與P2資料頁邏輯上視為一個多平面資料頁250。想當然爾,控制單元210亦可分別對平面P1與P2的一個資料頁進行存取,此為實作上的選項,並不以此為限。 2 depicts an implementation of a non-volatile storage medium 220 in accordance with an embodiment of the present invention. Referring to FIG. 2, the non-volatile storage medium 220 includes memories 0-4. The memory 0 is preferably an SLC (Single Level Cell) type flash memory to provide greater data access capability or better data integrity. The memory 0 can be used to store confidential data, protection data or management data, wherein the protection data includes: security information (such as a password) set by the user, a debug log, etc., wherein the error log Preferred is SMART (Self-Monitoring Analysis and Reporting Technology) information. The memory 0 has a plurality of SLC type data blocks 240, and each of the SLC type data blocks 240 preferably has two planes, which are represented by planes P1 and P2, respectively. Each plane has Q+1 physical pages, where Q is a natural number, for example 256. The control unit 210 preferably accesses a data page of the planes P1 and P2 at the same time. This mode of operation is called multi-planes access, and logically views the two planes P1 and P2. For a multi-plan data page 250. Of course, the control unit 210 can also access a data page of the planes P1 and P2, which is an implementation option, and is not limited thereto.

記憶體1~4較佳為TLC(Triple-Level Cell,三階儲存 單元)類型快閃記憶體,用以儲存使用者資料。每一記憶體1~4亦具有多個TLC類型資料區塊,每一個TLC類型資料區塊具有二個平面,分別以P1與P2來表示,支援多平面(multi-planes)存取;每一個平面具有R+1個資料頁(或稱實體資料頁,physical page),其中R為自然數,例如是2304。控制單元210較佳可同時對記憶體1~4的一個TLC類型資料區塊進行存取,此時,邏輯上可將總共4個TLC類型資料區塊視為一個超級資料區塊260,並將總共8個資料頁視為一個超級資料頁270。想當然爾,控制單元210亦可只選取記憶體1~4的其中一個資料區塊進行存取,此為實作上的選項,並不以此為限。 Memory 1~4 is preferably TLC (Triple-Level Cell) Unit) type flash memory for storing user data. Each memory 1~4 also has multiple TLC type data blocks, and each TLC type data block has two planes, which are respectively represented by P1 and P2, and support multi-planes access; each The plane has R+1 material pages (or physical pages), where R is a natural number, for example 2304. The control unit 210 preferably accesses one TLC type data block of the memory 1~4 at the same time. At this time, a total of four TLC type data blocks can be logically regarded as one super data block 260, and A total of 8 data pages are considered a super data page 270. Of course, the control unit 210 can also select only one of the data blocks 1 to 4 for access, which is an implementation option, and is not limited thereto.

在實作上,記憶體0亦可為操作於binary mode的MLC(Multi-Level Cell,多階儲存單元)或TLC類型快閃記憶體;記憶體1~4亦可為MLC或SLC類型快閃記憶體。使用者可以依其實際需求而進行替換,並不以本發明中的設定為限。 In practice, the memory 0 can also be an MLC (Multi-Level Cell) or a TLC type flash memory operating in a binary mode; the memory 1~4 can also be a MLC or SLC type flashing. Memory. The user can replace it according to his actual needs, and is not limited to the setting in the present invention.

圖3為依照本發明一實施例之資料儲存方法的流程圖,請同時參照圖1~3。步驟S301:選取一個主動資料區塊以儲存來自主機100的資料。當資料儲存裝置200接收來自主機100的寫入命令時,資料儲存裝置200的控制單元210便會選取一個超級資料區塊260,例如:超級資料區塊#0,作為主動資料區塊,以儲存來自主機100的資料,而來自主機100的資料較佳係依序儲存至超級資料區塊#0的超級資料頁270。假設超級資料區塊#0包含2304個超級資料頁270,則來自主機100的資料較佳先從超級資料區塊#0的超級資料頁#0開始寫入資料,接著是超級資料頁#1,以下依此類推。如果超級資料區塊#0已寫滿資料,則控制單元210便會選取另一個超級資料區塊260,例如超級資料區塊#1,作為主動資料區塊,以儲存後續的資料。 FIG. 3 is a flow chart of a data storage method according to an embodiment of the present invention. Please refer to FIG. 1 to FIG. 3 at the same time. Step S301: Select an active data block to store the data from the host 100. When the data storage device 200 receives the write command from the host 100, the control unit 210 of the data storage device 200 selects a super data block 260, for example, a super data block #0, as an active data block for storage. The data from the host 100 is preferably stored in the super data page 270 of the super data block #0. Assuming that the super data block #0 contains 2304 super data pages 270, the data from the host 100 is preferably written from the super data page #0 of the super data block #0, followed by the super data page #1, The following and so on. If the super data block #0 has been filled with data, the control unit 210 will select another super data block 260, such as the super data block #1, as the active data block to store the subsequent data.

步驟S302,判斷是否發生電源中斷事件。控制單元210會持續地判斷是否發生電源中斷事件。當主機100因故停止對資料儲存裝置200進行供電,或要求資料儲存裝置200進入指定的電力狀態 (power state)以節約電力的消耗,皆可能觸發電源中斷事件。 In step S302, it is determined whether a power interruption event occurs. The control unit 210 continuously determines whether a power interruption event has occurred. When the host 100 stops supplying power to the data storage device 200 for any reason, or requests the data storage device 200 to enter a specified power state. (Power state) to save power consumption, may trigger a power interruption event.

步驟S303,記錄主動資料區塊的編號以及主動資料區塊中具有資料的最後一個資料頁的編號。假設發生電源中斷事件時,最後一個完成資料寫入或即將完成資料寫入的是超級資料區塊#0的超級資料頁#63,則超級資料頁#63為具有資料的最後一個超級資料頁270,那麼控制單元210就會將超級資料區塊的編號0與超級資料頁270的編號63這二者記錄下來。 Step S303, recording the number of the active data block and the number of the last data page having the data in the active data block. Assuming that a power interruption event occurs, the last completed data write or the data to be completed is the super data page #63 of the super data block #0, then the super data page #63 is the last super data page 270 with the data. Then, the control unit 210 records both the number 0 of the super data block and the number 63 of the super data page 270.

步驟S304,產生主要F2H對照表,其中,主要F2H對照表係記錄具有資料的最後一個資料頁及其之前的所有資料頁的資料的對應關係。以前述的例子來說,此主要F2H對照表係記錄超級資料區塊#0之超級資料頁#63及其以前的所有超級資料頁270,即超級資料頁#0至超級資料頁#63共計64個超級資料頁270,的資料的對應關係。相較於習知方法,依習知方法所產生的完整F2H對照表則需要將超級資料頁#0至超級資料頁#2303,總共2304個超級資料頁270,的資料的對應關係通通記錄下來。對比之下,依本發明之資料儲存方法所產生的主要F2H對照表僅為完整F2H對照表的一部份,除了資料量較少之外,產生主要F2H對照表所需的時間亦較短。 Step S304, a main F2H comparison table is generated, wherein the main F2H comparison table records the correspondence between the last data page having the data and the data of all the previous data pages. In the foregoing example, the primary F2H comparison table records the super data page #63 of Super Data Block #0 and all of its previous Super Data Pages 270, that is, Super Data Page #0 to Super Data Page #63 Total 64 Super data page 270, the correspondence of the data. Compared with the conventional method, the complete F2H comparison table generated by the conventional method needs to record the correspondence between the super data page #0 to the super data page #2303 and the total data of 2304 super data pages 270. In contrast, the main F2H comparison table produced by the data storage method of the present invention is only a part of the complete F2H comparison table, and the time required to generate the main F2H comparison table is also shorter, except for a small amount of data.

在步驟S304的另一實施例中,主要F2H對照表僅記錄具有資料的最後一個資料頁及其以前的所有資料頁的有效資料的對應關係。以前述的例子來說,最後一個具有資料的資料頁是超級資料頁#63,假設超級資料頁#0~#63所儲存的資料皆為有效資料,則控制單元210會產生包含超級資料頁#0~#63的資料的對應關係的主要F2H對照表,此主要F2H對照表的內容與上一實施例相同;假設超級資料頁#0~#63中僅超級資料頁#60~#63所儲存的資料為有效資料,則控制單元210僅產生包含超級資料頁#60~#63的資料的對應關係的主要F2H對照表,如此一來,此實施例的主要F2H對照表的大小會小於上一實施例。綜上所述,依此實施例所產生的主要F2H對照表的資料量會小於完整F2H 對照表的資料量。 In another embodiment of step S304, the primary F2H look-up table records only the correspondence between the last material page having the material and the valid data of all of the previous material pages. In the foregoing example, the last data page with data is super data page #63. If the data stored in the super data pages #0~#63 are all valid data, the control unit 210 will generate a super data page. The main F2H comparison table of the correspondence relationship of the data of 0~#63, the content of the main F2H comparison table is the same as that of the previous embodiment; it is assumed that only the super data page #60~#63 in the super data page #0~#63 is stored. The information of the data is valid data, the control unit 210 only generates the main F2H comparison table of the correspondence relationship of the data including the super data pages #60 to #63, so that the size of the main F2H comparison table of this embodiment will be smaller than the previous one. Example. In summary, the amount of data of the main F2H comparison table produced by this embodiment will be smaller than that of the complete F2H. Compare the amount of data in the table.

步驟S305,將主要F2H對照表、主動資料區塊的編號、以及具有資料的最後一個資料頁的編號寫入至指定資料區塊,其中,指定資料區塊與主動資料區塊較佳為不同類型的資料區塊,或指定資料區塊的每個儲存單元(cell)的資料儲存能力不大於主動資料區塊的每個儲存單元(cell)的資料儲存能力,或指定資料區塊不用以儲存來自主機100的資料。以上述為例,控制單元210便將產生的主要F2H對照表、超級資料區塊260的編號0、以及具有資料的最後一個超級資料頁270的編號63寫入至SLC類型資料區塊#0的多平面資料頁250。 Step S305, the main F2H comparison table, the number of the active data block, and the number of the last data page having the data are written into the designated data block, wherein the designated data block and the active data block are preferably different types. The data storage capacity of each data block, or each storage unit (cell) of the designated data block, is not greater than the data storage capacity of each storage unit (cell) of the active data block, or the designated data block is not stored for storage. The data of the host 100. Taking the above as an example, the control unit 210 writes the generated main F2H lookup table, the number 0 of the super data block 260, and the number 63 of the last super data page 270 with the data to the SLC type data block #0. Multi-planar data page 250.

依習知方法所產生的完整F2H對照表,其記錄超級資料區塊#0之2304個超級資料頁270的資料的對應關係,而儲存此完整F2H對照表共需要SLC類型資料區塊240中的72個多平面資料頁250來儲存,則較佳將完整F2H對照表分割成72份,使每一分割後的完整F2H對照表可儲存至SLC類型資料區塊240的一個資料頁,並分別給予一個編號,例如編號0~71,則第一個分割後的完整F2H對照表為F2H#0對照表,第72個分割後的完整F2H對照表為F2H#71對照表,而每一個分割後的完整F2H對照表係可記錄32個超級資料頁270的資料的對應關係。另外,使用者亦可使每一分割後的完整F2H對照表可儲存至SLC類型資料區塊240的複數個資料頁,其運作原理相似,故不多作說明。由於主要F2H對照表以及SLC類型資料區塊240的多平面資料頁250的大小為已知,因此,控制單元210可以計算出儲存主要F2H對照表所需的多平面資料頁250的數目,並將主要F2H對照表予以分割,每一個分割後的主要F2H對照表給予一個編號(index),而此編號與分割後的完整F2H對照表的編號一致。 The complete F2H comparison table generated by the conventional method records the correspondence of the data of 2304 super data pages 270 of the super data block #0, and the storage of the complete F2H comparison table requires the SLC type data block 240. The 72 multi-planar data pages 250 are stored, and the complete F2H comparison table is preferably divided into 72 parts, so that each divided complete F2H comparison table can be stored in a data page of the SLC type data block 240 and given separately. A number, for example, number 0~71, the first F2H comparison table after the first segmentation is the F2H#0 comparison table, and the 72nd segmented complete F2H comparison table is the F2H#71 comparison table, and each segmented The complete F2H comparison table can record the correspondence of the data of 32 super data pages 270. In addition, the user can also save each divided complete F2H comparison table to a plurality of data pages of the SLC type data block 240, and the operation principle is similar, so there is no description. Since the size of the primary F2H lookup table and the multiplanar data page 250 of the SLC type data block 240 is known, the control unit 210 can calculate the number of multiplanar data pages 250 required to store the primary F2H lookup table and will The main F2H comparison table is divided, and each of the divided main F2H comparison tables is given an index, which is consistent with the number of the completed F2H comparison table.

由於主要F2H對照表僅為完整F2H對照表的一部份,假設主要F2H對照表需儲存至SLC類型資料區塊240的二個多平面資料頁250,那麼控制單元210可將主要F2H對照表分割並寫入至多平面資 料頁#K與#K+1,其中K亦為自然數,並在這二個多平面資料頁250中分別儲存F2H#0對照表與F2H#1對照表。較佳地,F2H#0對照表與F2H#1對照表的編號,即編號0以及1,可分別記錄在多平面資料頁#K與#K+1的詮釋資料(matadata)中,以作為日後資料確認的依據。此外,超級資料區塊260的編號(即編號0)、以及具有資料的最後一個超級資料頁270的編號(即編號63)亦可記錄在多平面資料頁#K與#K+1的詮釋資料中,同樣可以作為日後資料確認的依據。 Since the main F2H comparison table is only a part of the complete F2H comparison table, assuming that the main F2H comparison table needs to be stored to the two multi-planar data pages 250 of the SLC type data block 240, the control unit 210 can segment the main F2H comparison table. And write to the multi-plane The materials page #K and #K+1, where K is also a natural number, and the F2H#0 comparison table and the F2H#1 comparison table are stored in the two multi-planar data pages 250, respectively. Preferably, the numbers of the F2H#0 comparison table and the F2H#1 comparison table, that is, the numbers 0 and 1, can be respectively recorded in the interpretation data (matadata) of the multi-planar data pages #K and #K+1, as the future Basis for data validation. In addition, the number of the super data block 260 (ie, number 0) and the number of the last super data page 270 having the data (ie, number 63) can also be recorded in the interpretative data of the multi-planar data pages #K and #K+1. It can also be used as a basis for future data confirmation.

由於SLC類型快閃記憶體240的可靠性(即錯誤率)優於MLC類型快閃記憶體的可靠性,而MLC類型快閃記憶體的可靠性又優於TLC類型快閃記憶體的可靠性,因此將步驟S303所產生的主要F2H對照表儲存在SLC類型資料區塊240可以使主要F2H對照表得到較好的保護。 Since the reliability (ie, error rate) of the SLC type flash memory 240 is superior to the reliability of the MLC type flash memory, the reliability of the MLC type flash memory is superior to the reliability of the TLC type flash memory. Therefore, storing the main F2H comparison table generated in step S303 in the SLC type data block 240 can make the main F2H comparison table better protected.

圖4為依照本發明另一實施例之資料儲存方法的流程圖,相較於圖3所對應的實施例,圖4所對應的實施例可適用於同一主動資料區塊上發生多重電源中斷事件的處理。步驟S401:選取一個主動資料區塊以儲存來自主機100的資料;S402:判斷是否發生電源中斷事件。由於步驟S401與S301相同,步驟S402與S302相同,故不多作說明。 4 is a flowchart of a data storage method according to another embodiment of the present invention. Compared with the embodiment corresponding to FIG. 3, the embodiment corresponding to FIG. 4 is applicable to multiple power interruption events occurring on the same active data block. Processing. Step S401: Select an active data block to store data from the host 100; S402: determine whether a power interruption event occurs. Since steps S401 and S301 are the same, steps S402 and S302 are the same, and therefore will not be described.

步驟S403,當步驟S402的判斷結果為是時,判斷此主動資料區塊是否已發生另一電源中斷事件。以前述例子來說就是判斷超級資料區塊#0是否已發生上述另一電源中斷事件。 Step S403, when the result of the determination in step S402 is YES, it is determined whether another active power interruption event has occurred in the active data block. In the foregoing example, it is determined whether the other power interruption event has occurred in the super data block #0.

步驟S404,當步驟S403的判斷結果為否時,記錄主動資料區塊的編號以及主動資料區塊中具有資料的最後一個資料頁的主要編號;步驟S405,產生主要F2H對照表,其中,主要F2H對照表係記錄具有資料的最後一個資料頁及其之前的所有資料頁的資料的對應關係;步驟S406,將主要F2H對照表、主動資料區塊的編號、以及具有資料的最後一個資料頁的主要編號寫入至指定資料區塊,其中,指定資料區塊與主動資料區塊較佳為不同類型的資料區塊,或指定資料區塊的 每個儲存單元的資料儲存能力不大於主動資料區塊的每個儲存單元的資料儲存能力,或指定資料區塊不用以儲存來自主機100的資料。由於步驟S404與S303類似,步驟S405與S304相同,步驟S406與S305類似,主要的差異乃在於具有資料的最後一個資料頁的編號變更為具有資料的最後一個資料頁的主要編號,故不多作說明。 Step S404, when the result of the determination in step S403 is no, the number of the active data block and the main number of the last data page having the data in the active data block are recorded; in step S405, a main F2H comparison table is generated, wherein the main F2H The comparison table records the correspondence between the last data page having the data and the data of all the previous data pages; in step S406, the main F2H comparison table, the number of the active data block, and the main data page with the last data page. The number is written to the specified data block, wherein the designated data block and the active data block are preferably different types of data blocks, or designated data blocks. The data storage capacity of each storage unit is not greater than the data storage capacity of each storage unit of the active data block, or the designated data block is not used to store data from the host 100. Since step S404 is similar to S303, step S405 is the same as S304, and step S406 is similar to S305. The main difference is that the number of the last data page having the data is changed to the main number of the last data page having the data, so it is not much Description.

步驟S407,當步驟S403的判斷結果為是時,記錄主動資料區塊的編號、以及具有資料的最後一個資料頁的次要編號。假設超級資料區塊#0曾發生過電源中斷事件(稱之為第一次電源中斷事件),且當時最後一個具有資料的超級資料頁270是超級資料頁#63。現在又再度發生電源中斷事件(稱之為第二次電源中斷事件),且最後一個具有資料的超級資料頁270是超級資料頁#127,那麼控制單元210就會記錄超級資料區塊的編號0、以及超級資料頁的編號128(即次要編號)。 Step S407, when the result of the determination in step S403 is YES, the number of the active data block and the minor number of the last data page having the data are recorded. Assume that the power data interrupt event (called the first power interruption event) has occurred in the super data block #0, and the last super data page 270 with the data at that time is the super data page #63. Now again the power interruption event (referred to as the second power interruption event), and the last super data page 270 with data is the super data page #127, then the control unit 210 will record the number 0 of the super data block. And the super data page number 128 (ie minor number).

步驟S408,產生一個次要F2H對照表,此次要F2H對照表係記錄步驟S404的主要編號以及步驟S407的次要編號,此兩個編號之間的所有資料頁的資料的對應關係。控制單元210會產生一個次要F2H對照表,此次要F2H對照表係記錄第一次電源中斷事件時最後一個具有資料的超級資料頁270的編號(即編號63)以及第二次電源中斷事件時最後一個具有資料的超級資料頁270的編號(編號127),兩個編號之間的所有超級資料頁270的資料的對應關係。由於次要F2H對照表係記錄超級資料區塊#0之超級資料頁#64至超級資料頁#127這64個超級資料頁270的資料的對應關係,而非超級資料頁#0至超級資料頁#127這128個超級資料頁270的資料的對應關係,因此,控制單元210僅需較少的時間即能完成次要F2H對照表的建立。 In step S408, a secondary F2H comparison table is generated. The F2H comparison table records the main number of the step S404 and the minor number of the step S407, and the correspondence between the data of all the data pages between the two numbers. The control unit 210 generates a secondary F2H comparison table, and this time the F2H comparison table records the number of the last super data page 270 with the data (ie, number 63) and the second power interruption event at the time of the first power interruption event. The last number of the super data page 270 with the data (number 127), the correspondence between the data of all the super data pages 270 between the two numbers. Since the secondary F2H comparison table records the correspondence of the data of the super data page #64 to the super data page #127 to the super data page 270, instead of the super data page #0 to the super data page #127 The correspondence of the data of the 128 super material pages 270, therefore, the control unit 210 can complete the establishment of the secondary F2H comparison table in less time.

步驟S409,將次要F2H對照表、主動資料區塊的編號、以及具有資料的最後一個資料頁的次要編號寫入至指定資料區塊。控制單元210便將新產生的次要F2H對照表、超級資料區塊260的編號(即編號0)、以及第二次電源中斷時具有資料的的最後一個超級資料頁270 的次要編號(即編號127)寫入至SLC類型資料區塊#0的多平面資料頁250。 In step S409, the secondary F2H comparison table, the number of the active data block, and the secondary number of the last data page having the data are written to the designated data block. The control unit 210 will newly generate the secondary F2H comparison table, the number of the super data block 260 (ie, number 0), and the last super data page 270 with the data at the second power interruption. The minor number (i.e., number 127) is written to the multi-plane data page 250 of the SLC type data block #0.

假設記錄超級資料頁#64至超級資料頁#127這64個超級資料頁270的資料的對應關係的次要F2H對照表需以SLC類型資料區塊240中的二個多平面資料頁250來儲存,那麼控制單元210可將次要F2H對照表分割並分別寫入至多平面資料頁#K+2與#K+3,並在這二個多平面資料頁250中分別儲存F2H#2對照表與F2H#3對照表。較佳地,F2H#2對照表與F2H#3對照表的編號,即編號2以及3,超級資料區塊260的編號(即編號0)、以及具有資料的最後一個超級資料頁270的編號(即編號127)記錄在多平面資料頁#K+2與#K+3的詮釋資料中,以作為日後資料確認的依據。 Assume that the secondary F2H comparison table of the correspondence of the data of the 64 super data pages 270 of the super data page #64 to the super material page #127 is stored in the two multi-plane data pages 250 in the SLC type data block 240. Then, the control unit 210 may divide and write the secondary F2H comparison table to the multi-plane data pages #K+2 and #K+3, respectively, and store the F2H#2 comparison table and the two multi-plane data pages 250 respectively. F2H#3 comparison table. Preferably, the numbers of the F2H#2 lookup table and the F2H#3 lookup table, namely numbers 2 and 3, the number of the super data block 260 (ie number 0), and the number of the last super data page 270 with the data ( That is, the number 127) is recorded in the interpretation data of the multi-planar data pages #K+2 and #K+3, as the basis for the confirmation of the future data.

假設記錄超級資料頁#64至超級資料頁#127這64個超級資料頁270的資料並非全是新的資料,而是更新後的資料,則分割後的F2H對照表的編號有可能會重覆。例如,超級資料頁#64至超級資料頁#127所儲存的資料包含32筆新的資料以及超級資料頁#0-31的更新資料,則次要F2H對照表包含F2H#2對照表與更新後的F2H#0對照表,則控制單元210可將F2H#2對照表與更新後的F2H#0對照表儲存至多平面資料頁#K+2與#K+3,並將F2H#2對照表與更新後的F2H#0對照表的編號,即編號2以及0,可分別記錄在多平面資料頁#K+2與#K+3的詮釋資料(matadata)中,以作為資料確認的依據。此外,超級資料區塊260的編號(即編號0)、以及具有資料的最後一個超級資料頁270的編號(即編號127)亦可記錄在多平面資料頁#K+2與#K+3的詮釋資料中,同樣可以作為資料確認的依據。 Assume that the data of the super data page #64 to the super data page #127 is not all new data, but the updated data, the number of the F2H comparison table after the division may be repeated. . For example, the data stored in Super Data Page #64 to Super Data Page #127 contains 32 new data and the updated data of Super Data Page #0-31, then the secondary F2H comparison table contains F2H#2 comparison table and updated. The F2H#0 comparison table, the control unit 210 can store the F2H#2 comparison table and the updated F2H#0 comparison table to the multi-planar data pages #K+2 and #K+3, and compare the F2H#2 comparison table with The updated F2H#0 comparison table numbers, ie, numbers 2 and 0, can be recorded in the matadata of the multi-planar data pages #K+2 and #K+3, respectively, as the basis for data validation. In addition, the number of the super data block 260 (ie, number 0) and the number of the last super material page 270 having the data (ie, number 127) may also be recorded on the multi-planar data pages #K+2 and #K+3. Interpretation data can also be used as a basis for data validation.

圖5為本發明一實施例的資料回復程序的流程,本發明資料回復程序可應用於資料儲存裝置200,以便於復電後進行資料回復。步驟S501,讀取指定資料區塊而取得F2H對照表、主動資料區塊的編號以及具有資料的最後一個資料頁的編號。控制單元210讀取SLC類 型資料區塊240的內容可以取得F2H對照表,例如,步驟S305所儲存的主要F2H對照表,或是步驟S406所儲存的主要F2H對照表以及步驟S409所儲存的次要F2H對照表。 FIG. 5 is a flowchart of a data recovery procedure according to an embodiment of the present invention. The data recovery procedure of the present invention can be applied to the data storage apparatus 200 to facilitate data recovery after power is restored. Step S501, reading the designated data block to obtain the F2H comparison table, the number of the active data block, and the number of the last data page having the data. Control unit 210 reads SLC class The content of the type data block 240 can obtain an F2H comparison table, for example, the main F2H comparison table stored in step S305, or the main F2H comparison table stored in step S406 and the secondary F2H comparison table stored in step S409.

步驟S502判斷F2H對照表的內容是否與主動資料區塊的編號以及具有資料的最後一個資料頁的編號一致。由於F2H對照表的編號乃已建立,因此,藉由詮釋資料所記錄的F2H對照表的編號即可得知分割後的F2H對照表的總數。再判斷是否需要將分割後的F2H對照表予以合併,即可得到完整的主要F2H對照表以及次要F2H對照表。主要F2H對照表及次要F2H對照表的內容本身含有主動資料區塊的編號以及具有資料的最後一個資料頁的編號(主要編號及次要編號)的資訊,控制單元210可藉比對此些資料即可得到判斷的結果。假設詮釋資料所記錄的主動資料區塊是超級資料區塊#0,且具有資料的最後一個超級資料頁270的主要編號是63,次要編號是127,那麼控制單元210就會判斷出這些是否符合主要F2H對照表以及次要F2H對照表的記錄。如果F2H對照表包括主要F2H對照表以及次要F2H對照表,由於次要F2H對照表僅記錄第一次電源中斷事件後所新增或更新的資料的對應關係,因此,次要F2H對照表需結合主要F2H對照表的才是完整的F2H對照表,也才能得到超級資料區塊#0中所有具有資料的超級資料頁270的資料的對應關係。假如分割後的次要F2H對照表的編號與分割後的主要F2H對照表的編號重覆時,如上述例子中所述的F2H#0對照表,這表示於第一次電源中斷事件後,超級資料頁#0~#31的資料已被更新,因此,超級資料頁#0~#31的資料的對應關係將以分割後的次要F2H對照表(即F2H#0對照表)為準。 Step S502 determines whether the content of the F2H comparison table is consistent with the number of the active data block and the number of the last data page having the data. Since the number of the F2H comparison table has been established, the total number of the F2H comparison tables after the division can be known by interpreting the number of the F2H comparison table recorded in the data. Then, it is judged whether it is necessary to combine the divided F2H comparison tables to obtain a complete main F2H comparison table and a secondary F2H comparison table. The contents of the main F2H comparison table and the secondary F2H comparison table themselves contain the number of the active data block and the information of the last data page number (primary number and secondary number) of the data, and the control unit 210 can borrow more than this. The data can be judged. Assuming that the active data block recorded in the interpretation data is the super data block #0, and the last super data page 270 having the data has a major number of 63 and a minor number of 127, the control unit 210 determines whether these are The records of the main F2H comparison table and the secondary F2H comparison table are met. If the F2H comparison table includes the main F2H comparison table and the secondary F2H comparison table, since the secondary F2H comparison table only records the correspondence of the newly added or updated data after the first power interruption event, the secondary F2H comparison table is required. The complete F2H comparison table is combined with the main F2H comparison table, and the correspondence relationship of all the super data pages 270 having the data in the super data block #0 can also be obtained. If the number of the sub-divided F2H comparison table is repeated with the number of the divided main F2H comparison table, as shown in the F2H#0 comparison table described in the above example, this means that after the first power interruption event, super The data of the data page #0~#31 has been updated. Therefore, the correspondence of the data of the super data page #0~#31 will be based on the divided secondary F2H comparison table (ie, F2H#0 comparison table).

步驟S503,如果步驟S502的判斷結果為是,則將F2H對照表儲存至揮發性儲存媒體230。控制單元210會將主要F2H對照表儲存至揮發性儲存媒體230,或同時將主要F2H對照表及次要F2H對照表儲存至揮發性儲存媒體230。 In step S503, if the result of the determination in step S502 is YES, the F2H comparison table is stored in the volatile storage medium 230. The control unit 210 stores the main F2H comparison table to the volatile storage medium 230, or simultaneously stores the primary F2H comparison table and the secondary F2H comparison table to the volatile storage medium 230.

步驟S504,選取主動資料區塊以儲存來自主機100的資料。以上述為例,由於超級資料區塊#0仍有空間可以儲存來自主機100的資料,則控制單元210會將後續的資料寫入至超級資料區塊#0中。以上述為例,如果F2H對照表僅包含主要F2H對照表,則後續的資料將寫入至超級資料頁#64以及後續的超級資料頁270;如果F2H對照表包含主要F2H對照表以及次要F2H對照表,則後續的資料將寫入至超級資料頁#128以及後續的超級資料頁270。 Step S504, the active data block is selected to store the data from the host 100. Taking the above as an example, since the super data block #0 still has space to store the data from the host 100, the control unit 210 writes the subsequent data into the super data block #0. Taking the above as an example, if the F2H comparison table contains only the main F2H comparison table, the subsequent data will be written to the super data page #64 and the subsequent super data page 270; if the F2H comparison table contains the main F2H comparison table and the secondary F2H The comparison table will be written to the super data page #128 and the subsequent super data page 270.

在另一實施例中,於步驟S503,控制單元210會將F2H對照表寫入主動資料區塊,並於步驟S504,選取另一個超級資料區塊260,例如超級資料區塊#1,作為主動資料區塊,以儲存來自主機100的資料。或者,於步驟S503,控制單元210會將主要F2H對照表以及次要F2H對照表寫入主動資料區塊,並於步驟S504,選取另一個超級資料區塊260,例如超級資料區塊#1,作為主動資料區塊,以儲存來自主機100的資料。在此實施例中,由於超級資料區塊#0發生過電源中斷事件,其資料儲存能力可能已受到影響,因此,將超級資料區塊#0予以關閉,並選取超級資料區塊#1作為主動資料區塊,可以降低資料流失的風險。此外,若步驟S502中的判斷結果為否,則控制單元210將執行資料修復程序(如步驟S505所示),由於資料修復程序為習知技術,故不多作說明。 In another embodiment, in step S503, the control unit 210 writes the F2H comparison table into the active data block, and in step S504, select another super data block 260, such as the super data block #1, as the active A data block to store data from the host 100. Alternatively, in step S503, the control unit 210 writes the primary F2H comparison table and the secondary F2H comparison table into the active data block, and in step S504, select another super data block 260, such as super data block #1, As an active data block, the data from the host 100 is stored. In this embodiment, since the power interruption event has occurred in the super data block #0, the data storage capability may have been affected. Therefore, the super data block #0 is closed, and the super data block #1 is selected as the active. Data blocks can reduce the risk of data loss. Further, if the result of the determination in step S502 is NO, the control unit 210 will execute the data repair program (as shown in step S505), and since the data repair program is a conventional technique, it will not be described.

綜上所述,在本發明中,由於控制單元210在電源中斷時所產生的主要或次要F2H對照表僅記錄有儲存資料的資料頁的資料的對應關係,因此,產生的主要或次要F2H對照表的資料量會少於採習知方法所產生之完整F2H對照表的資料量,不但可以降低主要或次要F2H對照表的資料量,更能減少產生主要或次要F2H對照表所需要的時間,且將主要或次要F2H對照表儲存至具有較佳資料保存能力的資料區塊中,更能提供主要或次要F2H對照表較佳的保護。 In summary, in the present invention, since the primary or secondary F2H comparison table generated by the control unit 210 when the power is interrupted only records the correspondence relationship of the data of the data pages storing the data, the primary or secondary The amount of data in the F2H comparison table will be less than the amount of data in the complete F2H comparison table produced by the known method, which will not only reduce the amount of data in the primary or secondary F2H comparison table, but also reduce the occurrence of primary or secondary F2H comparison tables. The time required and the storage of the primary or secondary F2H control tables into the data blocks with better data retention capabilities provide better protection of the primary or secondary F2H control tables.

Claims (13)

一種資料儲存裝置,包括:一主動資料區塊;以及一指定資料區塊記錄一F2H對照表以及該主動資料區塊的編號,其中,該F2H對照表記錄該主動資料區塊所儲存的資料的對應關係,其中,該指定資料區塊於一中斷事件後記錄該F2H對照表以及該主動資料區塊的編號。 A data storage device includes: an active data block; and a designated data block record, an F2H comparison table, and a number of the active data block, wherein the F2H comparison table records the data stored in the active data block Corresponding relationship, wherein the designated data block records the F2H comparison table and the number of the active data block after an interruption event. 如申請專利範圍第1項所述之資料儲存裝置,其中,該主動資料區塊與該指定資料區塊為同一類型的資料區塊。 The data storage device of claim 1, wherein the active data block and the designated data block are the same type of data block. 如申請專利範圍第1項所述之資料儲存裝置,其中,該主動資料區塊與該指定資料區塊為不同類型的資料區塊。 The data storage device of claim 1, wherein the active data block and the designated data block are different types of data blocks. 如申請專利範圍第1項所述之資料儲存裝置,其中,該主動資料區塊與該指定資料區塊操作在不同的工作模式下。 The data storage device of claim 1, wherein the active data block and the designated data block operate in different working modes. 如申請專利範圍第1項所述之資料儲存裝置,其中該F2H對照表僅記錄該主動資料區塊所儲存的有效資料的對應關係。 The data storage device of claim 1, wherein the F2H comparison table records only the correspondence between the valid data stored in the active data block. 如申請專利範圍第1項所述之資料儲存裝置,其中,資料儲存裝置更包括一控制單元。 The data storage device of claim 1, wherein the data storage device further comprises a control unit. 如申請專利範圍第1項所述之資料儲存裝置,其中,該主動資料區塊以儲存來自一主機的資料。 The data storage device of claim 1, wherein the active data block stores data from a host. 如申請專利範圍第1項所述之資料儲存裝置,其中,該指定資料區塊更記錄該主動資料區塊中具有資料的最後一個資料頁的編號。 The data storage device of claim 1, wherein the designated data block further records the number of the last data page having the data in the active data block. 一種資料回復方法,包括下列步驟:判斷是否曾發生一中斷事件;如果是,則暫存一指定資料區塊所記錄的一F2H對照表;以及依據該指定資料區塊所記錄的一主動資料區塊的編號而選取該主動資料區塊,並以該主動資料區塊儲存來自一主機的資料,其中,該指 定資料區塊於一中斷事件後記錄該F2H對照表以及該主動資料區塊的編號。 A data reply method includes the following steps: determining whether an interrupt event has occurred; if yes, temporarily storing an F2H comparison table recorded in a designated data block; and an active data area recorded according to the specified data block The active data block is selected by the number of the block, and the data from a host is stored by the active data block, wherein the finger The data block records the F2H comparison table and the number of the active data block after an interruption event. 如申請專利範圍第9項所述之資料回復方法,其中,該主動資料區塊與該指定資料區塊為同一類型的資料區塊。 The method for replying data according to claim 9 , wherein the active data block and the designated data block are the same type of data block. 如申請專利範圍第9項所述之資料回復方法,其中,該主動資料區塊與該指定資料區塊為不同類型的資料區塊。 The method for replying data according to claim 9 is characterized in that the active data block and the designated data block are different types of data blocks. 如申請專利範圍第9項所述之資料回復方法,其中,該主動資料區塊與該指定資料區塊操作在不同的工作模式下。 The method for replying data according to claim 9 is characterized in that the active data block and the designated data block operate in different working modes. 如申請專利範圍第9項所述之資料回復方法,其中,該F2H對照表僅記錄該主動資料區塊所儲存的有效資料的對應關係。 The method for replying data according to claim 9 , wherein the F2H comparison table records only the correspondence between the valid data stored in the active data block.
TW106118406A 2016-11-25 2016-11-25 Data storage method and data recovery method for data storage device, and data storage device using the same methods TWI670640B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW106118406A TWI670640B (en) 2016-11-25 2016-11-25 Data storage method and data recovery method for data storage device, and data storage device using the same methods

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW106118406A TWI670640B (en) 2016-11-25 2016-11-25 Data storage method and data recovery method for data storage device, and data storage device using the same methods

Publications (2)

Publication Number Publication Date
TW201820117A TW201820117A (en) 2018-06-01
TWI670640B true TWI670640B (en) 2019-09-01

Family

ID=63258052

Family Applications (1)

Application Number Title Priority Date Filing Date
TW106118406A TWI670640B (en) 2016-11-25 2016-11-25 Data storage method and data recovery method for data storage device, and data storage device using the same methods

Country Status (1)

Country Link
TW (1) TWI670640B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI740454B (en) * 2020-04-14 2021-09-21 慧榮科技股份有限公司 Method and apparatus for accessing to data in response to a power-supply event
US11342008B2 (en) 2020-04-14 2022-05-24 Silicon Motion, Inc. Method and apparatus for accessing to data in response to power-supply event

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101458659A (en) * 2007-12-14 2009-06-17 环达电脑(上海)有限公司 Flash memory system and method thereof
TW201107970A (en) * 2009-08-21 2011-03-01 Hsu Hsiu Yu Memory accessing method for microcontroller
TW201411347A (en) * 2012-09-06 2014-03-16 Silicon Motion Inc Data storage device and FLASH memory control method
TW201525691A (en) * 2013-12-26 2015-07-01 Silicon Motion Inc Data storage device and flash memory control method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101458659A (en) * 2007-12-14 2009-06-17 环达电脑(上海)有限公司 Flash memory system and method thereof
TW201107970A (en) * 2009-08-21 2011-03-01 Hsu Hsiu Yu Memory accessing method for microcontroller
TW201411347A (en) * 2012-09-06 2014-03-16 Silicon Motion Inc Data storage device and FLASH memory control method
TW201525691A (en) * 2013-12-26 2015-07-01 Silicon Motion Inc Data storage device and flash memory control method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI740454B (en) * 2020-04-14 2021-09-21 慧榮科技股份有限公司 Method and apparatus for accessing to data in response to a power-supply event
US11342008B2 (en) 2020-04-14 2022-05-24 Silicon Motion, Inc. Method and apparatus for accessing to data in response to power-supply event
US11664056B2 (en) 2020-04-14 2023-05-30 Silicon Motion, Inc. Method and apparatus for accessing to data in response to power-supply event

Also Published As

Publication number Publication date
TW201820117A (en) 2018-06-01

Similar Documents

Publication Publication Date Title
KR102580577B1 (en) ZNSs in solid state drives
TWI591533B (en) Data storage method and data recovery method for data storage device, and data storage device using the same methods
US10303599B2 (en) Memory system executing garbage collection
US11055176B1 (en) Storage devices hiding parity swapping behavior
US11354236B2 (en) Garbage collection method for data storage device
TW201740386A (en) Data management method and data block management method for data storage device and memory controller
US20090198875A1 (en) Data writing method for flash memory, and controller and system using the same
US11726672B2 (en) Operating method of storage device setting secure mode of command, and operating method of storage system including the storage device
US11269783B2 (en) Operating method for data storage device
US20140219041A1 (en) Storage device and data processing method thereof
US10558562B2 (en) Data storage device and operating method thereof
TWI670640B (en) Data storage method and data recovery method for data storage device, and data storage device using the same methods
US20210224186A1 (en) Systems and methods for managing an artificially limited logical space of non-volatile memory
KR20180042699A (en) Data storage device and operating method thereof
US11847337B2 (en) Data parking for ZNS devices
KR20230037255A (en) Method for managing event log, controller and storage device
TWI662554B (en) Memory device and control unit thereof, and data movement method for memory device
US20240111646A1 (en) Hmb multi-segment optimal selection
EP4180937A1 (en) Memory controller, storage device, and operating method of storage device
KR20220092770A (en) Operating method of storage device setting secure mode of command, and operating method of storage system having the storage device
CN115904226A (en) Solid state drive, apparatus and method of operating solid state drive
KR20100106109A (en) Flash memory device
TW201812566A (en) Memory device and control unit thereof, and data storage method for memory device