TWI646461B - Data storage device and data maintenance method thereof - Google Patents

Data storage device and data maintenance method thereof Download PDF

Info

Publication number
TWI646461B
TWI646461B TW105132831A TW105132831A TWI646461B TW I646461 B TWI646461 B TW I646461B TW 105132831 A TW105132831 A TW 105132831A TW 105132831 A TW105132831 A TW 105132831A TW I646461 B TWI646461 B TW I646461B
Authority
TW
Taiwan
Prior art keywords
data link
link relationship
frequent
indicator
infrequent
Prior art date
Application number
TW105132831A
Other languages
Chinese (zh)
Other versions
TW201814490A (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 TW105132831A priority Critical patent/TWI646461B/en
Priority to CN201611044061.3A priority patent/CN107943711B/en
Priority to US15/613,342 priority patent/US10073769B2/en
Publication of TW201814490A publication Critical patent/TW201814490A/en
Application granted granted Critical
Publication of TWI646461B publication Critical patent/TWI646461B/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/0292User address space allocation, e.g. contiguous or non contiguous base addressing using tables or multilevel address translation means

Abstract

本發明提供一種資料儲存裝置包括一隨機存取記憶體以及一控制器。隨機存取記憶體具有一預取區域。控制器將資料鏈結關係表中部分之複數資料鏈結關係集合載入該預取區域中之複數區段,其中該等資料鏈結關係集合中,被讀取次數小於一既定值之資料鏈結關係集合屬於複數非頻繁資料鏈結關係集合中之一者,且被讀取次數到達該既定值之資料鏈結關係集合,屬於複數頻繁資料鏈結關係集合中之一者。 The invention provides a data storage device including a random access memory and a controller. The random access memory has a prefetch area. The controller loads a plurality of data link relationship sets in the data link relationship table into a plurality of sections in the prefetch area. Among the data link relationship sets, the number of data link read sets is less than a predetermined value. The knot relationship set belongs to one of the plural infrequent data link relationship sets, and the data link relationship set that has been read the number of times reaches the predetermined value belongs to one of the plural frequent data link relationship sets.

Description

資料儲存裝置及其資料維護方法    Data storage device and data maintenance method   

本發明係關於一種資料儲存裝置,特別係關於以特定方式維護預取區域中之資料的資料儲存裝置。 The present invention relates to a data storage device, and more particularly to a data storage device that maintains data in a prefetched area in a specific manner.

快閃記憶體為一種普遍的非揮發性資料儲存裝置,係以電性方式抹除與程式化。以非及閘型的快閃記憶體(即NAND FLASH)為例,常用作記憶卡(memory card)、通用序列匯流排閃存裝置(USB flash device)、固態硬碟(SSD)、嵌入式快閃記憶體模組(eMMC)…等使用。 Flash memory is a universal non-volatile data storage device that is electrically erased and programmed. Take non-gate flash memory (namely NAND FLASH) as an example, it is often used as a memory card, a universal serial bus flash memory device (USB flash device), a solid-state hard disk (SSD), and an embedded flash memory. Memory module (eMMC) ... etc.

快閃記憶體(如,NAND FLASH)的儲存陣列包括複數個區塊(blocks),其中浮置閘極電晶體可用以構成快閃記憶體。浮置閘極電晶體中之浮置閘極,可捕捉的電荷以儲存資料。另外,快閃記憶體中之實體頁面與主機裝置所指定之邏輯頁面的轉換關係需要一個實體轉邏輯表紀錄。然而,需要很大的容量才可以將全部的實體邏輯表載入隨機存取記憶體中。如何有效更新管理隨機記憶體中所載入之資料是一個重要的課題。 A flash memory (eg, NAND FLASH) storage array includes a plurality of blocks, and a floating gate transistor can be used to form the flash memory. The floating gate in the floating gate transistor can capture the charge to store data. In addition, the conversion relationship between the physical page in the flash memory and the logical page specified by the host device requires a physical to logical table record. However, a large capacity is required to load the entire physical logic table into the random access memory. How to effectively update and manage the data loaded in random memory is an important issue.

本發明所提供之資料儲存裝置以及資料維護方法可藉由三種表來維護儲存於隨機記憶體中之資料。 The data storage device and data maintenance method provided by the present invention can maintain data stored in random memory through three types of tables.

本發明提供一種資料儲存裝置包括一隨機存取記憶體以及一控制器。隨機存取記憶體具有一預取區域。控制器將資料鏈結關係表中部分之複數資料鏈結關係集合載入該預取區域中之複數區段,其中該等資料鏈結關係集合中,被讀取次數小於一既定值之資料鏈結關係集合屬於複數非頻繁資料鏈結關係集合中之一者,且被讀取次數到達該既定值之資料鏈結關係集合,屬於複數頻繁資料鏈結關係集合中之一者。 The invention provides a data storage device including a random access memory and a controller. The random access memory has a prefetch area. The controller loads a plurality of data link relationship sets in the data link relationship table into a plurality of sections in the prefetch area. Among the data link relationship sets, the number of data link read sets is less than a predetermined value. The knot relationship set belongs to one of the plural infrequent data link relationship sets, and the data link relationship set that has been read the number of times reaches the predetermined value belongs to one of the plural frequent data link relationship sets.

在一實施例中,控制器更建立一非頻繁指標組以維護該等非頻繁資料鏈結關係集合,並且建立一頻繁指標組以維護該等頻繁資料鏈結關係集合,其中非頻繁指標組係由一非頻繁頭指標以及一非頻繁尾指標所構成,並且頻繁指標組係由一頻繁頭指標以及一頻繁尾指標所構成。區段依序具有複數共用指標,非頻繁頭指標為用以儲存最後一個被讀取之非頻繁資料鏈結關係集合之區段的共用指標,非頻繁尾指標為用以儲存最久未被讀取之非頻繁資料鏈結關係集合之區段的共用指標,頻繁頭指標為用以儲存最後一個被讀取之頻繁資料鏈結關係集合之區段的共用指標,頻繁尾指標為用以儲存最久未被讀取之頻繁資料鏈結關係集合之區段的共用指標。 In an embodiment, the controller further establishes an infrequent index group to maintain the infrequent data link relationship set, and establishes a frequent index group to maintain the frequent data link relationship set, wherein the infrequent index group It consists of an infrequent head indicator and an infrequent tail indicator, and the frequent indicator group is composed of a frequent head indicator and a frequent tail indicator. Sectors have multiple shared indicators in order. The infrequent header indicator is a shared indicator used to store the last infrequent data link relationship set that is read. The infrequent tail indicator is used to store the longest unread. The common indicator of the segments of the infrequent data link relationship set. The frequent header indicator is a common indicator used to store the last read of the frequent data link relationship set. The frequent tail indicator is used to store the last A common indicator for the segments of the frequent data link relationship set being read.

本發明亦提供一種資料儲存裝置包括具有一預取區域之一隨機存取記憶體以及一控制器。控制器用以將一資料鏈結關係表所儲存之複數資料鏈結關係集合的一部分載入預取區域中之複數區段,其中當預取區域之複數區段皆已被寫滿並且一第一資料鏈結關係集合需要被載入預取區域時,控制器更用以根據一非頻繁指標組選擇區段中之一第一區段,以載入 第一資料鏈結關係集合,其中當非頻繁指標組不具有對應之區段中之一者時,控制器更用將一頻繁指標組轉換為非頻繁指標組,並根據轉換後之非頻繁指標組選擇第一區段。 The present invention also provides a data storage device including a random access memory having a prefetch area and a controller. The controller is used to load a part of the plurality of data link relationship sets stored in a data link relationship table into a plurality of sections in the prefetch area, wherein when the plurality of sections in the prefetch area are all filled and a first When the data link relationship set needs to be loaded into the prefetch area, the controller is further configured to select one of the first sections according to an infrequent index group to load the first data link relationship set. When the frequent indicator group does not have one of the corresponding sections, the controller further converts a frequent indicator group into an infrequent indicator group, and selects the first section according to the converted infrequent indicator group.

本發明另提供一種資料維護方法適用於具有一快閃記憶體之一資料儲存裝置。快閃記憶體包括複數頁面,其中每一頁面具有一邏輯位址以及一實體位址。資料維護方法包括:在快閃記憶體被上電時,根據至少一讀取命令或者至少一寫入命令,在一隨機記憶體中之一預取區域之複數區段中,載入一資料鏈結關係表中之複數資料鏈結關係集合的一部份,其中每一資料鏈結關係集合具有頁面中之至少一者之邏輯位址以及實體位址的對應關係,並且每一資料鏈結關係集合相應於一集合指標,其中預取區域所儲存之資料鏈結關係集合中被讀取之次數小於一既定值之資料鏈結關係集合屬於非頻繁資料鏈結關係集合,以及預取區域所儲存之資料鏈結關係集合中被讀取到達既定值之資料鏈結關係集合屬於頻繁資料鏈結關係集合。 The invention also provides a data maintenance method applicable to a data storage device having a flash memory. The flash memory includes a plurality of pages, where each page has a logical address and a physical address. The data maintenance method includes: when the flash memory is powered on, according to at least one read command or at least one write command, a data chain is loaded into a plurality of sections of a prefetch area in a random memory. A part of a plurality of data link relationship sets in a link relationship table, wherein each data link relationship set has a correspondence relationship between at least one logical address and physical address of a page, and each data link relationship A set corresponds to a set of indicators, in which the data link relationship set stored in the prefetch area is read less than a predetermined number of data link relationship sets belongs to the infrequent data link relationship set, and the prefetch area is stored The data link relationship set in the data link relationship set that is read to reach a predetermined value belongs to the frequent data link relationship set.

在一實施例中,資料維護方法更包括建立一非頻繁指標組,以維護複數非頻繁資料鏈結關係集合;以及建立一頻繁指標組,以維護被複數頻繁資料鏈結關係集合,其中預取區域所儲存之資料鏈結關係集合中被讀取到達既定值之資料鏈結關係集合屬於頻繁資料鏈結關係集合。 In an embodiment, the data maintenance method further includes establishing an infrequent index group to maintain a plurality of infrequent data link relationship sets; and establishing a frequent index group to maintain a plurality of frequent data link relationship sets, wherein prefetching The data link relationship set that is read to reach a predetermined value in the data link relationship set stored in the area belongs to the frequent data link relationship set.

在一實施例中,資料維護方法更包括:建立一預取區域對應表,以在預取區域對應表中之複數區段對應欄紀錄相應於預取區域中之資料鏈結關係集合的集合指標;建立一順序表,以分別紀錄頻繁資料鏈結關係集合自預取區域中被讀取之 順序以及非頻繁資料鏈結關係集合自域取區域中被讀取之順序;以及建立一反序表,以分別紀錄頻繁資料鏈結關係集合自預取區域中被讀取之反向的順序以及非頻繁資料鏈結關係集合自預取區域中被讀取之反向的順序。 In one embodiment, the data maintenance method further includes: establishing a prefetch area correspondence table to record a set index corresponding to the data link relationship set in the prefetch area in the corresponding column of the plural section in the prefetch area correspondence table. ; Establishing an order table to record the order of frequent data link relationship sets being read from the prefetch area and the order of infrequent data link relationship sets being read from the domain fetch area; and establishing a reverse order table , Respectively, to record the reverse order of the frequent data link relationship set read from the prefetch area and the reverse order of the infrequent data link relationship set read from the prefetch area.

又另一實施例中,資料維護方法更包括:當預取區域已被寫滿並且需要載入新的資料鏈結關係集合時,判斷非頻繁尾指標是否為共用指標中之任一者;當非頻繁尾指標為共用指標中之任一者時,根據非頻繁尾指標判斷非頻繁資料鏈結關係集合中最久未被讀取之非頻繁資料鏈結關係集合;將第一資料鏈結關係集合的資料寫入非頻繁資料鏈結關係集合中最久未被讀取之非頻繁資料鏈結關係集合所屬的區段;當非頻繁尾指標不是共用指標中之任一者時,將頻繁尾指標中所儲存之共用指標寫入非頻繁尾指標,將頻繁頭指標中所儲存之共用指標寫入非頻繁頭指標,並且刪除頻繁尾指標以及非頻繁尾指標中所儲存之共用指標。 In still another embodiment, the data maintenance method further includes: when the prefetch area is full and a new data link relationship set needs to be loaded, determining whether the infrequent tail indicator is any of the common indicators; when When the infrequent tail indicator is any of the common indicators, the infrequent data link relationship set in the infrequent data link relationship set that has not been read for the longest time is determined according to the infrequent tail indicator; Data is written to the section of the infrequent data link relationship set that belongs to the infrequent data link relationship set that has not been read for the longest time; when the infrequent tail indicator is not any of the common indicators, the frequent tail indicator The stored common indicator is written into the infrequent tail indicator, the common indicator stored in the frequent head indicator is written into the infrequent header indicator, and the frequent tail indicator and the common indicator stored in the infrequent tail indicator are deleted.

100‧‧‧電子系統 100‧‧‧ electronic system

120‧‧‧主機 120‧‧‧Host

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

160‧‧‧控制器 160‧‧‧controller

162‧‧‧運算單元 162‧‧‧ Computing Unit

164‧‧‧永久記憶體 164‧‧‧Permanent Memory

166‧‧‧隨機存取記憶體 166‧‧‧RAM

180‧‧‧快閃記憶體 180‧‧‧Flash memory

TB1‧‧‧資料鏈結關係表 TB1‧‧‧Data Link Relation Table

MR_0~MR_MX‧‧‧對應關係 MR_0 ~ MR_MX‧‧‧ Correspondence

TS_0~TS_M‧‧‧資料鏈結關係集合 TS_0 ~ TS_M‧‧‧ Data Link Relationship Collection

CIX_0~CIX_N‧‧‧共用指標 CIX_0 ~ CIX_N‧‧‧Shared indicators

CA‧‧‧預取區域 CA‧‧‧ Prefetch Area

S_0~S_N‧‧‧區段 S_0 ~ S_N‧‧‧ section

SE_TB‧‧‧順序表 SE_TB‧‧‧Order List

SE_0~SE_N‧‧‧順序欄 SE_0 ~ SE_N‧‧‧Order column

SMR_TB‧‧‧預取區域對應表 SMR_TB‧‧‧Pre-fetch area mapping table

SMR_0~SMR_N‧‧‧區段對應欄 SMR_0 ~ SMR_N‧‧‧ section corresponding column

RSE_TB‧‧‧反序表 RSE_TB‧‧‧Reverse order

RSE_0~RSE_N‧‧‧反序欄 RSE_0 ~ RSE_N‧‧‧Reverse column

HIX‧‧‧頭指標 HIX‧‧‧Head Indicator

TIX‧‧‧尾指標 TIX‧‧‧Tail indicators

FR_HIX‧‧‧頻繁頭指標 FR_HIX‧‧‧ Frequent Head Indicator

FR_TIX‧‧‧頻繁尾指標 FR_TIX‧‧‧ Frequent Tail Indicator

LRU_HIX‧‧‧非頻繁頭指標 LRU_HIX‧‧‧Infrequent Head Indicator

LRU_TIX‧‧‧非頻繁尾指標 LRU_TIX‧‧‧Infrequent tail indicator

S900~S902、S1000~S1090、S2100~S2102、S2200~S2299‧‧‧步驟 S900 ~ S902, S1000 ~ S1090, S2100 ~ S2102, S2200 ~ S2299‧‧‧ steps

第1圖為本發明所提供之一電子系統之一種實施例的方塊圖。 FIG. 1 is a block diagram of an embodiment of an electronic system provided by the present invention.

第2圖為本發明所提供之一資料鏈結關係表之一種實施例的方塊圖。 FIG. 2 is a block diagram of an embodiment of a data link relationship table provided by the present invention.

第3圖為本發明所提供之一隨機存取記憶體中之複數表之一種實施例的示意圖。 FIG. 3 is a schematic diagram of an embodiment of a complex number table in a random access memory provided by the present invention.

第4圖為本發明所提供之一隨機存取記憶體中之複數表之 另一種實施例的示意圖。 FIG. 4 is a schematic diagram of another embodiment of a complex number table in a random access memory provided by the present invention.

第5圖為本發明所提供之一隨機存取記憶體中之複數表之另一種實施例的示意圖。 FIG. 5 is a schematic diagram of another embodiment of a complex number table in a random access memory provided by the present invention.

第6圖為本發明所提供之一隨機存取記憶體中之複數表之另一種實施例的示意圖。 FIG. 6 is a schematic diagram of another embodiment of a complex number table in a random access memory provided by the present invention.

第7A圖為本發明所提供之一隨機存取記憶體中之複數表之另一種實施例的示意圖。 FIG. 7A is a schematic diagram of another embodiment of a complex number table in a random access memory provided by the present invention.

第7B圖為本發明所提供之一隨機存取記憶體中之複數表之另一種實施例的示意圖。 FIG. 7B is a schematic diagram of another embodiment of a complex number table in a random access memory provided by the present invention.

第8圖為本發明所提供之一隨機存取記憶體中之複數表之另一種實施例的示意圖。 FIG. 8 is a schematic diagram of another embodiment of a complex number table in a random access memory provided by the present invention.

第9圖為本發明所提供之一資料維護方法之一種實施例的流程圖。 FIG. 9 is a flowchart of an embodiment of a data maintenance method provided by the present invention.

第10A~10F圖為本發明所提供之一資料維護方法之另一種實施例的流程圖。 10A-10F are flowcharts of another embodiment of a data maintenance method provided by the present invention.

第11~20圖為本發明所提供之一隨機存取記憶體中之表之另一種實施例的方塊圖。 11 to 20 are block diagrams of another embodiment of a table in a random access memory provided by the present invention.

第21圖為本發明所提供之一資料維護方法之另一種實施例的流程圖。 FIG. 21 is a flowchart of another embodiment of a data maintenance method provided by the present invention.

第22A~22H圖為本發明所提供之一資料維護方法之另一種實施例的流程圖。 22A to 22H are flowcharts of another embodiment of a data maintenance method provided by the present invention.

以下將詳細討論本發明各種實施例之裝置及使用方法。然而值得注意的是,本發明所提供之許多可行的發明概 念可實施在各種特定範圍中。這些特定實施例僅用於舉例說明本發明之裝置及使用方法,但非用於限定本發明之範圍。 The device and method of use of various embodiments of the present invention will be discussed in detail below. It is worth noting, however, that many of the possible inventive concepts provided by the present invention can be implemented in various specific ranges. These specific embodiments are only used to illustrate the device and method of use of the present invention, but not to limit the scope of the present invention.

第1圖為本發明所提供之一電子系統之一種實施例的方塊圖。電子系統100包括一主機120以及一資料儲存裝置140。資料儲存裝置140包括一快閃記憶體180以及一控制器160,且可根據主機120所下達的命令操作。控制器160包括一運算單元162、一永久記憶體(如,唯讀記憶體ROM)164以及隨機存取記憶體(RAM)166。永久記憶體164與所載之程式碼、資料組成韌體(firmware),由運算單元162執行,使控制器160基於該韌體控制該快閃記憶體180。隨機存取記憶體(RAM)166用以載入程式碼與參數以提供控制器160根據所載入的程式碼與參數動作。快閃記憶體180包括複數區塊,每一區塊包括複數頁面,每一頁面具有一邏輯位址以及一實體位址,其中實體位址為頁面在快閃記憶體180中固定的位址,邏輯位址為主機120以及控制器160給頁面定義之位址。另外,快閃記憶體180中更包括可由控制器160動態更新之一資料鏈結關係表TB1,其中資料鏈結關係表TB1用以紀錄所有頁面之邏輯位址以及實體位址的複數對應關係。值得注意的是,快閃記憶體180以區塊為最小單位進行抹除,並且頁面為最小單位進行寫入。 FIG. 1 is a block diagram of an embodiment of an electronic system provided by the present invention. The electronic system 100 includes a host 120 and a data storage device 140. The data storage device 140 includes a flash memory 180 and a controller 160, and can be operated according to a command issued by the host 120. The controller 160 includes an operation unit 162, a permanent memory (for example, a read-only memory ROM) 164, and a random access memory (RAM) 166. The permanent memory 164 and the loaded code and data form firmware, which is executed by the operation unit 162, so that the controller 160 controls the flash memory 180 based on the firmware. The random access memory (RAM) 166 is used to load codes and parameters to provide the controller 160 to act according to the loaded codes and parameters. The flash memory 180 includes a plurality of blocks, and each block includes a plurality of pages. Each page has a logical address and a physical address. The physical address is a fixed address of the page in the flash memory 180. The logical address is the address defined by the host 120 and the controller 160 for the page. In addition, the flash memory 180 further includes a data link relationship table TB1 that can be dynamically updated by the controller 160, where the data link relationship table TB1 is used to record the complex correspondence relationship between logical addresses and physical addresses of all pages. It is worth noting that the flash memory 180 is erased with the block as the smallest unit, and the page is written with the smallest unit.

第2圖為本發明所提供之一資料鏈結關係表之一種實施例的方塊圖。如第2圖所示,資料鏈結關係表TB1中包括所有頁面之邏輯位址以及實體位址的對應關係MR_P0~MR_PMX,其中每一對應關係MR_P0~MR_PMX分別對應到快閃記憶體180中之一頁面,並且對應關係 MR_P0~MR_PMX中之任兩者不對應到同一個頁面。另外,資料鏈結關係表TB1被分割為複數資料鏈結關係集合TS_0~TS_M,每一資料鏈結關係集合TS_0~TS_M具有多於一個對應關係。舉例而言,資料鏈結關係集合TS_0具有對應關係MR_P0~MR_PX、資料鏈結關係集合TS_1具有對應關係MR_P0~MR_P2X,依此類推。在本實施例中,每一資料鏈結關係集合TS_0~TS_M具有X+1個對應關係,但本發明不限於此。在其他實施例中,每一資料鏈結關係集合可具有不同數量之對應關係,並且資料鏈結關係集合所具有之鏈結關係的數量可由開發者自行決定或者由控制器160動態調整。值得注意的是,每一資料鏈結關係集合TS_0~TS_M相應於一集合指標。在一實施例中,集合指標可為0xAA、0xBB、0xCC、0x128等16進制數值。 FIG. 2 is a block diagram of an embodiment of a data link relationship table provided by the present invention. As shown in FIG. 2, the data link relationship table TB1 includes the correspondences between the logical addresses and physical addresses of all the pages MR_P0 ~ MR_PMX, where each correspondence MR_P0 ~ MR_PMX corresponds to one of the flash memories 180 respectively. One page, and any two of the corresponding relationships MR_P0 ~ MR_PMX do not correspond to the same page. In addition, the data link relationship table TB1 is divided into a plurality of data link relationship sets TS_0 ~ TS_M, and each data link relationship set TS_0 ~ TS_M has more than one corresponding relationship. For example, the data link relationship set TS_0 has a corresponding relationship MR_P0 ~ MR_PX, the data link relationship set TS_1 has a corresponding relationship MR_P0 ~ MR_P2X, and so on. In this embodiment, each data link relationship set TS_0 ~ TS_M has X + 1 corresponding relationships, but the present invention is not limited thereto. In other embodiments, each data link relationship set may have a different number of corresponding relationships, and the number of link relationships included in the data link relationship set may be determined by the developer or dynamically adjusted by the controller 160. It is worth noting that each data link relationship set TS_0 ~ TS_M corresponds to a set index. In one embodiment, the set indicator may be a hexadecimal value such as 0xAA, 0xBB, 0xCC, 0x128, and the like.

當資料儲存裝置140被上電後,控制器160可將資料鏈結關係表TB1載入隨機存取記憶體166中之一預取區域,以進行讀取以及更新。然而,隨著快閃記憶體180之記憶體容量的增加,資料鏈結關係表TB1也越來越大。在隨機存取記憶體166中所規劃的預取區域不夠儲存整個資料鏈結關係表TB1的情況下,控制器160則根據目前所需的資料將資料鏈結關係表TB1中之部分資料鏈結關係集合載入預取區域中。詳細而言,當預取區域CA還有空間可以載入資料鏈結關係集合TS_0~TS_M中之至少一者時,控制器160進行一載入程序,以將所需之資料鏈結關係集合載入預取區域的空白處。當預取區域已被寫滿並且需要載入新的資料鏈結關係集合TS_0~TS_M 時,控制器160進行一取代程序,以找出最久未被讀取之資料鏈結關係集合,以將新的資料鏈結關係集合覆蓋在最久未被讀取之資料鏈結關係集合上。當控制器160所需要的資料鏈結關係集合已存在在預取區域中時,控制器160則進行一更新程序,以更新最新的讀取狀態。 After the data storage device 140 is powered on, the controller 160 can load the data link relationship table TB1 into one of the prefetch areas in the random access memory 166 for reading and updating. However, as the memory capacity of the flash memory 180 increases, the data link relationship table TB1 also becomes larger and larger. In the case that the prefetch area planned in the random access memory 166 is insufficient to store the entire data link relationship table TB1, the controller 160 links some data in the data link relationship table TB1 according to the currently required data Relation sets are loaded into the prefetch area. In detail, when there is still space in the prefetch area CA to load at least one of the data link relationship sets TS_0 ~ TS_M, the controller 160 performs a loading procedure to load the required data link relationship sets. Into the blank space of the prefetch area. When the prefetch area is full and a new data link relationship set TS_0 ~ TS_M needs to be loaded, the controller 160 performs a replacement procedure to find the data link relationship set that has not been read for the longest time in order to update the new data link relationship set TS_0 ~ TS_M. The set of data link relationships is overlaid on the most recently read data link relationship set. When the data link relationship set required by the controller 160 already exists in the prefetch area, the controller 160 performs an update procedure to update the latest reading status.

第3圖為本發明所提供之一隨機存取記憶體中之表之一種實施例的方塊圖。如第3圖所示,當資料儲存裝置140被上電後,控制器160在隨機存取記憶體166中建立空白之一預取區域對應表SMR_TB、一反序表RSE_TB以及一順序表SE_TB,以記錄預取區域CA中資料的狀態。 FIG. 3 is a block diagram of an embodiment of a table in a random access memory provided by the present invention. As shown in FIG. 3, after the data storage device 140 is powered on, the controller 160 creates a blank prefetch area correspondence table SMR_TB, a reverse order table RSE_TB, and a sequence table SE_TB in the random access memory 166. To record the status of the data in the prefetch area CA.

預取區域CA具有複數區段S_0~S_N用以儲存資料鏈結關係表TB1中部分之資料鏈結關係集合,其中一個區段用以儲存一個資料鏈結關係集合。換言之,區段S_0~S_N的數量小於資料鏈結關係集合TS_0~TS_M之數量,也就是N<M。 The prefetch area CA has a plurality of sections S_0 ~ S_N for storing the data link relationship set in the data link relationship table TB1, and one section is used for storing a data link relationship set. In other words, the number of segments S_0 ~ S_N is smaller than the number of data link relationship sets TS_0 ~ TS_M, that is, N <M.

預取區域對應表SMR_TB具有複數區段對應欄SMR_0~SMR_N用以紀錄相應於預取區域CA中之資料鏈結關係集合TS_0~TS_M的集合指標,其中預取區域對應表SMR_TB中之區段對應欄SMR_0~SMR_N依序相應於預取區域CA中之區段S_0~S_N。值得注意的是,預取區域對應表SMR_TB中每一區段對應欄SMR_0~SMR_N的初始值皆為一特定值。在本實施例中,特定值為0xFFFF,但本發明不限於此。另外,資料鏈結關係集合TS_0~TS_M的集合指標皆不等於特定值。 The prefetched area correspondence table SMR_TB has a plurality of section corresponding columns SMR_0 ~ SMR_N to record the set index corresponding to the data link relationship set TS_0 ~ TS_M in the prefetched area CA, where the prefetched area correspondence table SMR_TB corresponds to the section The columns SMR_0 ~ SMR_N sequentially correspond to the sections S_0 ~ S_N in the prefetch area CA. It is worth noting that the initial values of the corresponding columns SMR_0 ~ SMR_N in each section of the prefetched region correspondence table SMR_TB are a specific value. In this embodiment, the specific value is 0xFFFF, but the present invention is not limited to this. In addition, the set indexes of the data link relationship sets TS_0 ~ TS_M are not equal to a specific value.

順序表SE_TB用以紀錄資料鏈結關係集合TS_0~TS_M自預取區域CA中被讀取之順序,其中順序表SE_TB 具有複數順序欄SE_0~SE_N依序相應於預取區域CA中之區段S_0~S_N。順序表SE_TB中之每一順序欄SE_0~SE_N係用以儲存另一順序欄的共用指標,以分別指向在相應於順序欄之區段之前上一個被讀取之資料鏈結關係集合之區段所相應之順序欄。值得注意的是,順序表SE_TB中每一順序欄SE_0~SE_N的初始值皆為一特定值。在本實施例中,特定值為0xFFFF,但本發明不限於此。 The sequence table SE_TB is used to record the order in which the data link relationship set TS_0 ~ TS_M is read from the prefetch area CA. The sequence table SE_TB has a plural sequence column SE_0 ~ SE_N corresponding to the section S_0 in the prefetch area CA in order. ~ S_N. Each sequence column SE_0 ~ SE_N in the sequence table SE_TB is used to store the common indicator of another sequence column to point to the section of the data link relationship set that was read before the section corresponding to the sequence column, respectively. The corresponding order column. It is worth noting that the initial value of each sequence column SE_0 ~ SE_N in the sequence table SE_TB is a specific value. In this embodiment, the specific value is 0xFFFF, but the present invention is not limited to this.

反序表RSE_TB用以紀錄資料鏈結關係集合TS_0~TS_M自預取區域CA中被讀取之反向的順序,其中反序表RSE_TB具有複數反序欄RSE_0~RSE_N依序相應於預取區域CA中之區段S_0~S_N。反序表RSE_TB中之每一反序欄RSE_0~RSE_N係用以儲存另一反序欄的共用指標,以分別指向在相應於反序欄之區段之後下一個被讀取之資料鏈結關係集合之區段所相應之反序欄。值得注意的是,反序表RSE_TB中每一反序欄RSE_0~RSE_N的初始值皆為一特定值。在本實施例中,特定值為0xFFFF,但本發明不限於此。 The reverse order table RSE_TB is used to record the reverse order of the data link relationship set TS_0 ~ TS_M read from the prefetch area CA. The reverse order table RSE_TB has a complex reverse order column RSE_0 ~ RSE_N corresponding to the prefetch area Sections S_0 ~ S_N in CA. Each reverse-order column RSE_0 ~ RSE_N in the reverse-order table RSE_TB is used to store the shared index of another reverse-order column, respectively, to point to the next data link relationship read after the section corresponding to the reverse-order column Reverse column corresponding to the section of the collection. It is worth noting that the initial value of each of the reverse order columns RSE_0 ~ RSE_N in the reverse order table RSE_TB is a specific value. In this embodiment, the specific value is 0xFFFF, but the present invention is not limited to this.

值得注意的是,在一實施例中,區段S_0~S_N依序具有特定之共用指標CIX_0~CIX_N。區段對應欄SMR_0~SMR_N與其相應之區段S_0~S_N具有相同之共用指標CIX_0~CIX_N。順序欄SE_0~SE_N與其相應之區段S_0~S_N具有相同之共用指標CIX_0~CIX_N。反序欄RSE_0~RSE_N與其相應之區段S_0~S_N具有相同之共用指標CIX_0~CIX_N。詳細而言,區段S_0、順序欄SE_0、區段對應欄SMR_0以及反序欄RSE_0之共用指標皆為CIX_0。區段S_1、順序欄SE_1、區段對 應欄SMR_1以及反序欄RSE_1之共用指標皆為CIX_1。區段S_2、順序欄SE_2、區段對應欄SMR_2以及反序欄RSE_2之共用指標皆為CIX_2,依此類推。值得注意的是,每一共用指標CIX_0~CIX_N皆不等於特定值。在一實施例中,共用指標CIX_0~CIX_N依序為0x0、0x1、0x2、0x3等十六進位數值,但本發明不限於此。 It is worth noting that, in an embodiment, the segments S_0 ~ S_N have specific common indexes CIX_0 ~ CIX_N in order. The section corresponding columns SMR_0 ~ SMR_N and the corresponding sections S_0 ~ S_N have the same common index CIX_0 ~ CIX_N. The sequence columns SE_0 ~ SE_N and their corresponding sections S_0 ~ S_N have the same common indicators CIX_0 ~ CIX_N. The reverse order columns RSE_0 ~ RSE_N and their corresponding sections S_0 ~ S_N have the same common index CIX_0 ~ CIX_N. In detail, the shared indicators of the segment S_0, the sequence column SE_0, the segment corresponding column SMR_0, and the reverse sequence column RSE_0 are all CIX_0. The shared index of segment S_1, sequence column SE_1, segment corresponding column SMR_1, and reverse sequence column RSE_1 are all CIX_1. The common indicators of the segment S_2, the sequence column SE_2, the segment corresponding column SMR_2, and the reverse sequence column RSE_2 are CIX_2, and so on. It is worth noting that each common indicator CIX_0 ~ CIX_N is not equal to a specific value. In an embodiment, the common indicators CIX_0 to CIX_N are sequentially hexadecimal values such as 0x0, 0x1, 0x2, and 0x3, but the present invention is not limited thereto.

綜上所述,控制器160建立預取區域對應表SMR_TB,以紀錄相應於預取區域CA中之資料鏈結關係集合TS_0~TS_M的集合指標。控制器160建立反序表RSE_TB,以紀錄資料鏈結關係集合TS_0~TS_M自預取區域CA中被讀取之反向的順序。控制器160建立順序表SE_TB,以紀錄資料鏈結關係集合TS_0~TS_M自預取區域CA中被讀取之順序。在一實施例中,控制器160更用以在隨機存取記憶體166中建立一頭指標HIX以及一尾指標TIX,其中頭指標HIX以及尾指標TIX也可以建立於其他記憶體或者電路中,本發明不限於此。頭指標HIX為預取區域CA中最後一個被讀取之區段S_0~S_N之共用指標CIX_0~CIX_N,以指向預取區域CA中最後一個被讀取之區段S_0~S_N。尾指標TIX為預取區域CA中最久未被讀取之區段S_0~S_N之共用指標CIX_0~CIX_N,以指向預取區域CA中最久未被讀取之區段S_0~S_N。值得注意的是,由於彼此相應之區段、順序欄、區段對應欄以及反序欄具有相同之共用指標,故頭指標HIX以及尾指標TIX同時也指向相應之順序欄、區段對應欄以及反序欄。在本實施例中,控制器160可根據尾指標TIX,選擇預取區域CA中之複數區段S_0~S_N中之一者。換言 之,控制器160可根據尾指標TIX選擇預取區域CA中最久未被讀取之區段(最久未被讀取之資料鏈結關係集合),以將新的資料鏈結關係集合載入所選擇之區段。另外,控制器160可根據一頭指標HIX、反序表RSE_TB中之資料以及順序表SE_TB中之資料,更新反序表RSE_TB以及順序表SE_TB。接著,以下段落將自第3圖至第8圖依序說明預取區域CA、預取區域對應表SMR_TB、反序表RSE_TB以及順序表SE_TB之間的關係。 In summary, the controller 160 establishes a prefetch area correspondence table SMR_TB to record a set index corresponding to the data link relationship set TS_0 ~ TS_M in the prefetch area CA. The controller 160 establishes a reverse order table RSE_TB, and records the reverse order of the data set TS_0 ~ TS_M from the prefetch area CA. The controller 160 creates an order table SE_TB, and records the order in which the data sets TS_0 ~ TS_M are read from the prefetch area CA. In one embodiment, the controller 160 is further configured to establish a head index HIX and a tail index TIX in the random access memory 166, wherein the head index HIX and the tail index TIX can also be established in other memories or circuits. The invention is not limited to this. The head index HIX is the common index CIX_0 ~ CIX_N of the last read sector S_0 ~ S_N in the prefetch area CA to point to the last read sector S_0 ~ S_N in the prefetch area CA. The tail index TIX is the common index CIX_0 ~ CIX_N in the pre-fetched area CA which is the longest unread section S_0 ~ S_N to point to the longest unread section S_0 ~ S_N in the prefetched area CA. It is worth noting that since the corresponding sections, sequence columns, section corresponding columns, and reverse sequence columns have the same shared indicators, the head indicator HIX and the tail indicator TIX also point to the corresponding order columns, section corresponding columns, and Reverse order bar. In this embodiment, the controller 160 may select one of the plurality of sections S_0 ~ S_N in the prefetch area CA according to the tail index TIX. In other words, the controller 160 may select the most unread section (the least recently read data link relationship set) in the prefetch area CA according to the tail index TIX to load the new data link relationship set into the Selected section. In addition, the controller 160 may update the reverse sequence table RSE_TB and the sequence table SE_TB according to a head index HIX, data in the reverse sequence table RSE_TB, and data in the sequence table SE_TB. Next, the relationship between the prefetch area CA, the prefetch area correspondence table SMR_TB, the reverse order table RSE_TB, and the order table SE_TB will be explained in order from FIG. 3 to FIG. 8 in the following paragraphs.

在第3圖初始狀態的實施例中,當控制器160接收到一讀取命令或者一寫入命令時,控制器160根據所接收之讀取命令或者寫入命令,找出包括讀取命令或者寫入命令所指定之頁面之一第一對應關係的一第一資料鏈結關係集合。舉例而言,讀取命令或者寫入命令指示之頁面的邏輯位址與實體位址的對應關係是儲存於資料鏈結關係集合TS_2,控制器160則根據所接收之讀取命令或者寫入命令得知所指定之頁面,並找到對應的資料鏈結關係集合TS_2。接著,控制器160根據預取區域對應表SMR_TB中是否存在相應於第一資料鏈結關係集合TS_2的集合指標,判斷資料鏈結關係集合TS_2是否已被載入預取區域CA。舉例而言,資料鏈結關係集合TS_2的集合指標為0xAA。如第3圖所示,若預取區域CA皆未寫入任何資料鏈結關係集合時,預取區域對應表SMR_TB中所有區段對應欄SMR_0~SMR_N皆為0xFFFF。因此,在本實施例中,控制器160判斷資料鏈結關係集合TS_2的集合指標0xAA不存在於預取區域對應表SMR_TB中。換言之,控制器160根據資料鏈結關係集合TS_2的集合指標0xAA不存在於預取區域對應表SMR_TB 中,判斷預取區域CA中不具有資料鏈結關係集合TS_2。接著,控制器160判斷預取區域CA是否具有空白之區段S_0~S_N。如第3圖所示,預取區域CA之區段S_0~S_N皆是空白的,控制器160選擇一空白之區段。在本實施例中,控制器160從最底部的區段開始選擇,故控制器160選擇區段S_N。接著,控制器160自快閃記憶體180中之資料鏈結關係表TB1讀取資料鏈結關係集合TS_2,以將資料鏈結關係集合TS_2載入所選擇之空白的區段S_N。接著,控制器160更新預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、頭指標HIX以及尾指標TIX,以記錄目前預取區域CA的狀態。如第4圖所示,控制器160將資料鏈結關係集合TS_2的集合指標0xAA寫入區段S_N所相應之區段對應欄SMR_N,將頭指標HIX以及尾指標TIX同時定義為區段S_N之共用指標CIX_N。值得注意的是,在本實施例中,順序表SE_TB以及反序表RSE_TB中相應於區段S_N之順序欄SE_N以及反序欄RSE_N維持特定值0xFFFF。最後,控制器160讀取儲存於預取區域CA之資料鏈結關係集合TS_2以執行所接收到之寫入命令以及讀取命令。 In the embodiment of the initial state in FIG. 3, when the controller 160 receives a read command or a write command, the controller 160 finds out whether the read command or the write command includes the read command or A first data link relationship set of a first correspondence relationship of a page specified by the write command. For example, the correspondence between the logical address and the physical address of the page indicated by the read or write command is stored in the data link relationship set TS_2, and the controller 160 is based on the received read or write command. Learn the designated page and find the corresponding data link relationship set TS_2. Next, the controller 160 determines whether the data link relationship set TS_2 has been loaded into the prefetch area CA according to whether a set index corresponding to the first data link relationship set TS_2 exists in the prefetch area correspondence table SMR_TB. For example, the set index of the data link relationship set TS_2 is 0xAA. As shown in FIG. 3, if no pre-fetch area CA is written with any data link relationship set, the corresponding columns SMR_0 ~ SMR_N of all sections in the pre-fetch area correspondence table SMR_TB are 0xFFFF. Therefore, in this embodiment, the controller 160 determines that the set index 0xAA of the data link relationship set TS_2 does not exist in the prefetched region correspondence table SMR_TB. In other words, the controller 160 determines that the data link relationship set TS_2 does not exist in the prefetch area CA according to the set index 0xAA of the data link relationship set TS_2 that does not exist in the prefetch area correspondence table SMR_TB. Next, the controller 160 determines whether the prefetch area CA has blank sections S_0 ~ S_N. As shown in FIG. 3, the sections S_0 ~ S_N of the prefetch area CA are all blank, and the controller 160 selects a blank section. In this embodiment, the controller 160 selects from the bottommost segment, so the controller 160 selects the segment S_N. Next, the controller 160 reads the data link relationship set TS_2 from the data link relationship table TB1 in the flash memory 180 to load the data link relationship set TS_2 into the selected blank section S_N. Next, the controller 160 updates the prefetch area correspondence table SMR_TB, the order table SE_TB, the reverse order table RSE_TB, the head index HIX, and the tail index TIX to record the current state of the prefetch area CA. As shown in FIG. 4, the controller 160 writes the set index 0xAA of the data link relationship set TS_2 into the corresponding section SMR_N of the section S_N, and simultaneously defines the head indicator HIX and the tail indicator TIX as the sections S_N. Common indicator CIX_N. It is worth noting that in this embodiment, the order column SE_N and the reverse column RSE_N in the sequence table SE_TB and the reverse sequence table RSE_TB corresponding to the section S_N maintain a specific value of 0xFFFF. Finally, the controller 160 reads the data link relationship set TS_2 stored in the prefetch area CA to execute the received write command and read command.

接著,在第4圖的實施例中,當控制器160接收到一讀取命令或者一寫入命令時,控制器160同樣地根據所接收之讀取命令或者寫入命令,找出包括讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合。舉例而言,在本實施例中,讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合為TS_8。接著,控制器160根據預取區域對應表SMR_TB中是否存在相應於資料鏈結關係集合 TS_8的集合指標,判斷資料鏈結關係集合TS_8是否已被載入預取區域CA。舉例而言,資料鏈結關係集合TS_8的集合指標為0xBB。如第4圖所示,預取區域CA只被寫入了資料鏈結關係集合TS_2,預取區域對應表SMR_TB中只有區段對應欄SMR_N為0xAA,其他皆為0xFFFF。因此,在本實施例中,控制器160判斷資料鏈結關係集合TS_8的集合指標0xBB不存在於預取區域對應表SMR_TB中。換言之,控制器160根據資料鏈結關係集合TS_8的集合指標0xBB不存在於預取區域對應表SMR_TB中,判斷預取區域CA中不具有資料鏈結關係集合TS_8。接著,控制器160判斷預取區域CA是否具有空白之區段。如第4圖所示,預取區域CA之區段S_0~S_N-1皆是空白的,控制器160選擇一空白之區段。在本實施例中,控制器160選擇區段S_N-1。接著,控制器160自快閃記憶體180中之資料鏈結關係表TB1讀取資料鏈結關係集合TS_8,以將資料鏈結關係集合TS_8載入所選擇之空白的區段S_N-1。接著,控制器160更新預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、頭指標HIX以及尾指標TIX,以記錄目前預取區域CA的狀態。如第4圖所示,控制器160根據頭指標HIX,獲得在預取區域CA中最後一個被讀取之資料鏈結關係集合TS_2所屬之一區段S_N,並且將區段S_N所相應之順序欄SE_N的共用指標CIX_N,寫入相應於目前之區段S_N-1的順序欄SE_N-1。接著,控制器160將相應於目前之區段S_N-1的反序欄RSE_N-1之共用指標CIX_N-1,寫入區段S_N所相應之反序欄RSE_N。接著,控制器160將頭指標HIX定義為目前區段S_N-1之共用指標CIX_N-1,並且將尾指標TIX維 持在共用指標CIX_N。更新後之預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、頭指標HIX以及尾指標TIX如第5圖所示。最後,控制器160讀取儲存於預取區域CA之資料鏈結關係集合TS_8以執行所接收到之寫入命令以及讀取命令。 Next, in the embodiment of FIG. 4, when the controller 160 receives a read command or a write command, the controller 160 similarly finds out a read command or a write command including the read command. A data link relationship set corresponding to one of the pages specified by the command or write command. For example, in this embodiment, a data link relationship set corresponding to one of the pages specified by the read command or the write command is TS_8. Next, the controller 160 determines whether the data link relationship set TS_8 has been loaded into the prefetch area CA according to whether a set index corresponding to the data link relationship set TS_8 exists in the prefetch area correspondence table SMR_TB. For example, the set index of the data link relationship set TS_8 is 0xBB. As shown in FIG. 4, the prefetch area CA is only written into the data link relationship set TS_2, and only the section corresponding column SMR_N in the prefetch area correspondence table SMR_TB is 0xAA, and the others are 0xFFFF. Therefore, in this embodiment, the controller 160 determines that the set index 0xBB of the data link relationship set TS_8 does not exist in the prefetch area correspondence table SMR_TB. In other words, the controller 160 determines that there is no data link relationship set TS_8 in the prefetch area CA according to the set index 0xBB of the data link relationship set TS_8 does not exist in the prefetch area correspondence table SMR_TB. Next, the controller 160 determines whether the prefetch area CA has a blank sector. As shown in FIG. 4, the sections S_0 ~ S_N-1 of the prefetch area CA are all blank, and the controller 160 selects a blank section. In the present embodiment, the controller 160 selects the section S_N-1. Then, the controller 160 reads the data link relationship set TS_8 from the data link relationship table TB1 in the flash memory 180 to load the data link relationship set TS_8 into the selected blank section S_N-1. Next, the controller 160 updates the prefetch area correspondence table SMR_TB, the order table SE_TB, the reverse order table RSE_TB, the head index HIX, and the tail index TIX to record the current state of the prefetch area CA. As shown in FIG. 4, the controller 160 obtains a segment S_N to which the last data link relationship set TS_2 read in the prefetch area CA according to the header index HIX, and performs the corresponding order of the segments S_N. The common index CIX_N in the column SE_N is written in the sequence column SE_N-1 corresponding to the current section S_N-1. Next, the controller 160 writes the common index CIX_N-1 corresponding to the reverse sequence column RSE_N-1 of the current sector S_N-1 into the reverse sequence column RSE_N corresponding to the sector S_N. Next, the controller 160 defines the head index HIX as the common index CIX_N-1 of the current section S_N-1, and maintains the tail index TIX at the common index CIX_N. The updated prefetch area correspondence table SMR_TB, sequence table SE_TB, reverse sequence table RSE_TB, head index HIX, and tail index TIX are shown in FIG. 5. Finally, the controller 160 reads the data link relationship set TS_8 stored in the prefetch area CA to execute the received write command and read command.

假設控制器160陸續接收到相應於不同之資料鏈結關係集合的寫入命令以及讀取命令,控制器160則重複上述第4圖轉換到第5圖的步驟,將資料鏈結關係集合依序寫入S_N-2~S_0中,如第6圖所示。換言之,控制器160重複執行載入程序,並且寫滿所有預取區域CA。值得注意的是,在本實施例中,由於順序表SE_TB以及反序表RSE_TB的初始值即為特定值(0xFFFF),因此在載入程序中不需要再將特定值寫入目前區段所相應之反序欄以及預取區域CA中最久未被讀取之區段所相應之順序欄中。在其他實施例中,若順序表SE_TB以及反序表RSE_TB的與所設定之特定值不同,控制器160則需要在載入程序的最後一個步驟裡將特定值寫入目前區段所相應之反序欄以及預取區域CA中最久未被讀取之區段所相應之順序欄中。 Assuming that the controller 160 successively receives write commands and read commands corresponding to different sets of data link relationships, the controller 160 repeats the above steps of converting from FIG. 4 to FIG. 5 and sequentially sets the data link relationships set Write to S_N-2 ~ S_0, as shown in Figure 6. In other words, the controller 160 repeatedly executes the loading procedure and fills all the prefetch areas CA. It is worth noting that in this embodiment, since the initial value of the sequence table SE_TB and the reverse sequence table RSE_TB is a specific value (0xFFFF), there is no need to write the specific value into the corresponding section in the loading program. The reverse order column and the order column corresponding to the most recently unread section in the prefetch area CA. In other embodiments, if the sequence table SE_TB and the reverse sequence table RSE_TB are different from the specified specific value, the controller 160 needs to write the specific value to the corresponding inverse of the current section in the last step of the loading procedure. The sequence column and the sequence column corresponding to the least recently read segment in the prefetch area CA.

接著,以下為更新程序的說明。在第6圖的實施例中,當控制器160接收到一讀取命令或者一寫入命令時,控制器160同樣地根據所接收之讀取命令或者寫入命令,找出包括讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合。舉例而言,在本實施例中,讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合為TS_0。接著,控制器160根據預取區域對應表SMR_TB中是否 存在相應於資料鏈結關係集合TS_0的集合指標0x5,判斷資料鏈結關係集合TS_0是否已被載入預取區域CA。在本實施例中,如第6圖所示,資料鏈結關係集合TS_0之集合指標0x5已存在於預取區域對應表SMR_TB中之區域對應欄SMR_2之中。因此,在本實施例中,控制器160判斷資料鏈結關係集合TS_0的集合指標0x5存在於預取區域對應表SMR_TB中。換言之,控制器160根據資料鏈結關係集合TS_0的集合指標0x5存在於預取區域對應表SMR_TB中,判斷預取區域CA中已具有資料鏈結關係集合TS_0的資料。接著,控制器160更新預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、頭指標HIX以及尾指標TIX,以記錄目前預取區域CA的狀態。如第6圖所示,控制器160讀取目前區段S_2之順序欄SE_2,以獲得相應於在目前區段S_2之前一個被寫入之區段為區段S_3。接著,控制器160將相應於目前區段S_2之反序欄RSE_2中所儲存之共用指標CIX_1,寫入相應於區段S_3之反序欄RSE_3。換言之,控制器160將原本指向反序欄RSE_2之反序欄RSE_3,改指向反序欄RSE_1。接著,控制器160根據目前區段S_2之共用指標CIX_2,讀取反序表RSE_TB中相應於目前區段S_2之反序欄RSE_2中的值,並且根據反序欄RSE_2中之共用指標CIX_1找到在目前區段S_2之後下一個被讀取之區段S_1之共用指標CIX_1。接著,控制器160在相應於區段S_1之順序欄SE_1中寫入目前區段S_2所相應之順序欄SE_2中所儲存之共用指標CIX_3。換言之,控制器160將原本指向順序欄SE_2之順序欄SE_1,改指向順序欄SE_3。接著,控制器160根據頭指標HIX,獲得在預取 區域CA中最後一個被讀取之資料鏈結關係集合TS_1所屬之一區段S_0,並且將區段S_0所相應之順序欄SE_0的共用指標CIX_0,寫入相應於目前之區段S_2的順序欄SE_2。接著,控制器160將相應於目前之區段S_2的反序欄RSE_2之共用指標CIX_2,寫入區段S_0所相應之反序欄RSE_0。最後控制器160,將頭指標HIX定義為目前區段S_2之共用指標CIX_2,將尾指標TIX維持在共用指標CIX_N,並且將一特定值寫入目前區段S_2所相應之反序欄RSE_2中。更新後之預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、頭指標HIX以及尾指標TIX如第7A圖所示。接著,控制器160根據用以儲存集合指標0x5的區段對應欄SMR_2之共用指標CIX_2,讀取預取區域CA中所相應之區段S_2,以獲得資料鏈結關係集合TS_0。換言之,控制器160讀取儲存於預取區域CA之資料鏈結關係集合TS_0以執行所接收到之寫入命令以及讀取命令。 The following is a description of the update procedure. In the embodiment of FIG. 6, when the controller 160 receives a read command or a write command, the controller 160 similarly finds out whether the read command or the write command includes the read command or the write command. A data link relationship set corresponding to one of the pages specified by the write command. For example, in this embodiment, a data link relationship set corresponding to one of the pages specified by the read command or the write command is TS_0. Next, the controller 160 determines whether the data link relationship set TS_0 has been loaded into the prefetch area CA according to whether a set index 0x5 corresponding to the data link relationship set TS_0 exists in the prefetch area correspondence table SMR_TB. In this embodiment, as shown in FIG. 6, the set index 0x5 of the data link relationship set TS_0 already exists in the region corresponding column SMR_2 in the prefetch region corresponding table SMR_TB. Therefore, in this embodiment, the controller 160 determines that the set index 0x5 of the data link relationship set TS_0 exists in the prefetched region correspondence table SMR_TB. In other words, the controller 160 determines that the data of the data link relationship set TS_0 already exists in the prefetch area CA according to the set index 0x5 of the data link relationship set TS_0 in the prefetch area correspondence table SMR_TB. Next, the controller 160 updates the prefetch area correspondence table SMR_TB, the order table SE_TB, the reverse order table RSE_TB, the head index HIX, and the tail index TIX to record the current state of the prefetch area CA. As shown in FIG. 6, the controller 160 reads the sequence column SE_2 of the current sector S_2 to obtain a sector corresponding to a sector written before the current sector S_2 as the sector S_3. Next, the controller 160 writes the shared index CIX_1 stored in the reverse order column RSE_2 corresponding to the current section S_2 into the reverse order column RSE_3 corresponding to the section S_3. In other words, the controller 160 points originally to the reverse-order column RSE_3 of the reverse-order column RSE_2, and instead points to the reverse-order column RSE_1. Next, the controller 160 reads the value in the reverse order column RSE_2 corresponding to the current sector S_2 in the reverse order column RSE_2 according to the common index CIX_2 of the current sector S_2, and finds the The common index CIX_1 of the next sector S_1 read after the current sector S_2. Then, the controller 160 writes the common indicator CIX_3 stored in the sequence column SE_2 corresponding to the current section S_2 into the sequence column SE_1 corresponding to the section S_1. In other words, the controller 160 points originally to the sequence column SE_1 of the sequence column SE_2, and instead points to the sequence column SE_3. Next, the controller 160 obtains a segment S_0 to which the last data link relationship set TS_1 read in the prefetch area CA belongs according to the header index HIX, and sets the shared index of the sequence column SE_0 corresponding to the segment S_0. CIX_0, write the sequence column SE_2 corresponding to the current section S_2. Then, the controller 160 writes the common index CIX_2 corresponding to the reverse sequence column RSE_2 of the current segment S_2 into the reverse sequence column RSE_0 corresponding to the current segment S_2. Finally, the controller 160 defines the head indicator HIX as the common indicator CIX_2 of the current section S_2, maintains the tail indicator TIX at the common indicator CIX_N, and writes a specific value into the reverse sequence column RSE_2 corresponding to the current section S_2. The updated prefetch region correspondence table SMR_TB, sequence table SE_TB, reverse sequence table RSE_TB, head index HIX, and tail index TIX are shown in FIG. 7A. Next, the controller 160 reads the corresponding segment S_2 in the prefetch area CA according to the common index CIX_2 of the segment corresponding column SMR_2 for storing the set index 0x5 to obtain the data link relationship set TS_0. In other words, the controller 160 reads the data link relationship set TS_0 stored in the prefetch area CA to execute the received write command and read command.

值得注意的是,在更新程序的另一個實施例中,當寫入命令以及讀取命令所相應之資料鏈結關係集合為預取區域CA中最久為被讀取之資料鏈結關係集合時,控制器160的動作則與上述第7A圖所示之操作不同。舉例而言,在本實施例中,讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合為TS_2。接著,控制器160根據預取區域對應表SMR_TB中是否存在相應於資料鏈結關係集合TS_2的集合指標0xAA,判斷資料鏈結關係集合TS_2是否已被載入預取區域CA。在本實施例中,如第6圖所示,資料鏈結關係集合TS_2之集合指標0xAA已存在於預取區域對應表SMR_TB中之區域 對應欄SMR_N之中。因此,在本實施例中,控制器160判斷資料鏈結關係集合TS_2的集合指標0xAA存在於預取區域對應表SMR_TB中。換言之,控制器160根據資料鏈結關係集合TS_2的集合指標0xAA存在於預取區域對應表SMR_TB中,判斷預取區域CA中已具有資料鏈結關係集合TS_2的資料。值得注意的是,在本實施例中,由第6圖之尾指標TIX可知,資料鏈結關係集合為TS_2為預取區域CA中最久為被讀取之資料鏈結關係集合。接著,控制器160更新預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、頭指標HIX以及尾指標TIX,以記錄目前預取區域CA的狀態。如第6圖所示,控制器160根據目前區段S_N之共用指標CIX_N,讀取反序表RSE_TB中相應於目前區段S_N之反序欄RSE_N中的值,並且根據反序欄RSE_N中之共用指標CIX_N-1找到在目前區段S_N之後下一個被讀取之區段S_N-1之共用指標CIX_N-1。接著,控制器160在相應於區段S_N-1之順序欄SE_N-1中寫入目前區段S_N所相應之順序欄SE_N中所儲存之值,其中由於目前區段S_N係為最久未被讀取之區段,故其順序欄SE_N中所儲存之值為特定值。接著,控制器160根據頭指標HIX,獲得在預取區域CA中最後一個被讀取之資料鏈結關係集合TS_1所屬之一區段S_0,並且將區段S_0所相應之順序欄SE_0的共用指標CIX_0,寫入相應於目前之區段S_N的順序欄SE_N。接著,控制器160將相應於目前之區段S_N的反序欄RSE_N之共用指標CIX_N,寫入區段S_0所相應之反序欄RSE_0。最後控制器160,將頭指標HIX定義為目前區段S_N之共用指標CIX_N,將尾指標TIX定義為在目前區段S_N之 後下一個被讀取之區段S_N-1之共用指標CIX_N-1,並且將特定值寫入目前頭指標所指之共用指標CIX_N所相應的反序欄RSE_N中。更新後之預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、頭指標HIX以及尾指標TIX如第7B圖所示。接著,控制器160根據用以儲存集合指標0xAA的區段對應欄SMR_N之共用指標CIX_N,讀取預取區域CA中所相應之區段S_N,以獲得資料鏈結關係集合TS_2。換言之,控制器160讀取儲存於預取區域CA之資料鏈結關係集合TS_2以執行所接收到之寫入命令以及讀取命令。 It is worth noting that, in another embodiment of the update program, when the data link relationship set corresponding to the write command and the read command is the longest read data link relationship set in the prefetch area CA The operation of the controller 160 is different from that shown in FIG. 7A. For example, in this embodiment, a data link relationship set corresponding to one of the pages specified by the read command or the write command is TS_2. Next, the controller 160 determines whether the data link relationship set TS_2 has been loaded into the prefetch area CA according to whether a set index 0xAA corresponding to the data link relationship set TS_2 exists in the prefetch area correspondence table SMR_TB. In this embodiment, as shown in FIG. 6, the set index 0xAA of the data link relationship set TS_2 already exists in the area corresponding column SMR_N in the prefetch area corresponding table SMR_TB. Therefore, in this embodiment, the controller 160 determines that the set index 0xAA of the data link relationship set TS_2 exists in the prefetched region correspondence table SMR_TB. In other words, the controller 160 determines that the data of the data link relationship set TS_2 already exists in the prefetch area CA according to the set index 0xAA of the data link relationship set TS_2 in the prefetch area correspondence table SMR_TB. It is worth noting that, in this embodiment, it can be known from the tail index TIX in FIG. 6 that the data link relationship set is TS_2, which is the longest read data link relationship set in the prefetch area CA. Next, the controller 160 updates the prefetch area correspondence table SMR_TB, the order table SE_TB, the reverse order table RSE_TB, the head index HIX, and the tail index TIX to record the current state of the prefetch area CA. As shown in FIG. 6, the controller 160 reads the value in the reverse order table RSE_TB corresponding to the current section S_N in the reverse order column RSE_N according to the common index CIX_N of the current section S_N, and according to the value in the reverse order column RSE_N The common indicator CIX_N-1 finds the common indicator CIX_N-1 of the sector S_N-1 that is read next after the current sector S_N. Next, the controller 160 writes the value stored in the sequence column SE_N corresponding to the current section S_N in the sequence column SE_N-1 corresponding to the section S_N-1, where the current section S_N is the longest unread Take the section, so the value stored in the sequence column SE_N is a specific value. Next, the controller 160 obtains a segment S_0 to which the last data link relationship set TS_1 read in the prefetch area CA belongs according to the header index HIX, and sets the shared index of the sequence column SE_0 corresponding to the segment S_0. CIX_0, write the sequence column SE_N corresponding to the current section S_N. Next, the controller 160 writes the common index CIX_N corresponding to the reverse column RSE_N of the current sector S_N into the reverse sequence column RSE_0 corresponding to the sector S_0. Finally, the controller 160 defines the head index HIX as the common index CIX_N of the current sector S_N, and the tail index TIX as the common index CIX_N-1 of the sector S_N-1 that is read next after the current sector S_N. And the specific value is written in the reverse order column RSE_N corresponding to the common indicator CIX_N indicated by the current head indicator. The updated prefetch area correspondence table SMR_TB, sequence table SE_TB, reverse sequence table RSE_TB, head index HIX, and tail index TIX are shown in FIG. 7B. Next, the controller 160 reads the corresponding segment S_N in the prefetch area CA according to the common index CIX_N of the segment corresponding column SMR_N used to store the set index 0xAA to obtain the data link relationship set TS_2. In other words, the controller 160 reads the data link relationship set TS_2 stored in the prefetch area CA to execute the received write command and read command.

接著,以下為取代程序的說明。在第7A圖的實施例中,當控制器160接收到一讀取命令或者一寫入命令時,控制器160同樣地根據所接收之讀取命令或者寫入命令,找出包括讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合。舉例而言,在本實施例中,讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合為TS_77。接著,控制器160根據預取區域對應表SMR_TB中是否存在相應於資料鏈結關係集合TS_77的集合指標0x333,判斷資料鏈結關係集合TS_77是否已被載入預取區域CA。在本實施例中,假設預取區域CA並沒有資料鏈結關係集合TS_77之資料,故集合指標0x333也不存在於預取區域對應表SMR_TB中之任何一個區域對應欄SMR_0~SMR_N之中。控制器160根據資料鏈結關係集合TS_77的集合指標0x333不存在於預取區域對應表SMR_TB中,判斷預取區域CA中不具有資料鏈結關係集合TS_77。接著,控制器160判斷預取區域CA是否具有空白之區 段。如第7A圖所示,預取區域CA之區段S_0~S_N皆不是空白的。接著,控制器160根據尾指標TIX判斷預取區域CA中最久未被讀取之資料鏈結關係集合,以將資料鏈結關係集合TS_77的資料寫入預取區域CA中最久未被讀取之資料鏈結關係集合所屬的區段。如第7A圖所示,控制器160根據尾指標TIX中之共用指標CIX_N,判斷預取區域CA中最久未被讀取之資料鏈結關係集合為資料鏈結關係集合TS_2,並且根據共用指標CIX_N獲得具有最久未被讀取之的區段為區段S_N。接著,控制器160自快閃記憶體180中之資料鏈結關係表TB1讀取資料鏈結關係集合TS_77,以將資料鏈結關係集合TS_77載入所獲得之區段S_N,以取代原本很久未被讀取之資料鏈結關係集合TS_2。接著,控制器160更新預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、頭指標HIX以及尾指標TIX,以記錄目前預取區域CA的狀態。首先,控制器160將相應於資料鏈結關係集合TS_77之集合指標0x333,寫入預取區域對應表SMR_TB中相應於區段S_N的區段對應欄SMR_N。如第7A圖所示,控制器160根據頭指標HIX,獲得在預取區域CA中最後一個被讀取之資料鏈結關係集合TS_0所屬之一區段S_2,並且將區段S_2所相應之順序欄SE_2的共用指標CIX_2,寫入相應於目前之區段S_N的順序欄SE_N。接著,控制器160將相應於目前之區段S_N的反序欄RSE_N之共用指標CIX_N,寫入區段S_2所相應之反序欄RSE_2。接著,控制器160讀取目前之區段S_N的反序欄RSE_N,以獲得在目前之區段S_N之後下一個被讀取之區段S_N-1的共用指標CIX_N-1。接著,控制器160將頭指標HIX定 義為目前區段S_N之共用指標CIX_N,並且將尾指標TIX定義為在目前之區段S_N之後下一個被讀取之區段S_N-1的共用指標CIX_N-1。最後,控制器160將特定值寫入在目前之區段S_N之後下一個被讀取之區段S_N-1所相應的順序欄SE_N-1中,以及將特定值寫入相應於目前區段S_N之反序欄RSE_N中。更新後之預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、頭指標HIX以及尾指標TIX如第8圖所示。最後,控制器160讀取儲存於預取區域CA之資料鏈結關係集合TS_8以執行所接收到之寫入命令以及讀取命令。 The following is a description of the replacement procedure. In the embodiment of FIG. 7A, when the controller 160 receives a read command or a write command, the controller 160 similarly finds out whether the read command or the write command includes the read command or the write command. A data link relationship set corresponding to one of the pages specified by the write command. For example, in this embodiment, a data link relationship set corresponding to one of the pages specified by the read command or the write command is TS_77. Next, the controller 160 determines whether the data link relationship set TS_77 has been loaded into the prefetch area CA according to whether a set index 0x333 corresponding to the data link relationship set TS_77 exists in the prefetch area correspondence table SMR_TB. In this embodiment, it is assumed that the prefetch area CA does not have data of the data link relationship set TS_77, so the set index 0x333 does not exist in any of the area corresponding columns SMR_0 ~ SMR_N in the prefetch area corresponding table SMR_TB. The controller 160 determines that there is no data link relationship set TS_77 in the prefetch area CA according to the set index 0x333 of the data link relationship set TS_77 that does not exist in the prefetch area correspondence table SMR_TB. Next, the controller 160 determines whether the prefetch area CA has a blank area. As shown in FIG. 7A, the sections S_0 ~ S_N of the prefetch area CA are not blank. Next, the controller 160 judges the data link relationship set in the prefetch area CA that has not been read for the longest time according to the tail index TIX, so as to write the data in the data link relationship set TS_77 to the longest unread data in the prefetch area CA. The section to which the data link relationship collection belongs. As shown in FIG. 7A, the controller 160 judges the data link relationship set TS_2 that has not been read for the longest time in the prefetch area CA according to the common index CIX_N in the tail index TIX, and according to the common index CIX_N The sector with the longest unread is obtained as sector S_N. Next, the controller 160 reads the data link relationship set TS_77 from the data link relationship table TB1 in the flash memory 180 to load the data link relationship set TS_77 into the obtained section S_N to replace the original long-term The read data link relationship set TS_2. Next, the controller 160 updates the prefetch area correspondence table SMR_TB, the order table SE_TB, the reverse order table RSE_TB, the head index HIX, and the tail index TIX to record the current state of the prefetch area CA. First, the controller 160 writes a set index 0x333 corresponding to the data link relationship set TS_77 into a section corresponding column SMR_N corresponding to the section S_N in the prefetch area corresponding table SMR_TB. As shown in FIG. 7A, the controller 160 obtains a segment S_2 to which the last data link relationship set TS_0 read in the prefetch area CA according to the header index HIX, and sorts the segment S_2 in the corresponding order. The shared index CIX_2 of the column SE_2 is written in the sequence column SE_N corresponding to the current section S_N. Next, the controller 160 writes the common index CIX_N corresponding to the reverse column RSE_N of the current sector S_N into the reverse sequence column RSE_2 corresponding to the sector S_2. Next, the controller 160 reads the reverse order column RSE_N of the current section S_N to obtain the common index CIX_N-1 of the next section S_N-1 that is read after the current section S_N. Next, the controller 160 defines the head indicator HIX as the common indicator CIX_N of the current section S_N, and defines the tail indicator TIX as the common indicator CIX_N- of the next section S_N-1 that is read after the current section S_N. 1. Finally, the controller 160 writes the specific value into the sequence column SE_N-1 corresponding to the next read section S_N-1 after the current section S_N, and writes the specific value into the corresponding section S_N. In the reverse order column RSE_N. The updated prefetch area correspondence table SMR_TB, sequence table SE_TB, reverse sequence table RSE_TB, head index HIX, and tail index TIX are shown in FIG. 8. Finally, the controller 160 reads the data link relationship set TS_8 stored in the prefetch area CA to execute the received write command and read command.

第9圖為本發明所提供之一資料維護方法之一種實施例的流程圖。第9圖所示之資料維護方法適用於第1圖所示之資料儲存裝置140。流程開始於步驟S900。 FIG. 9 is a flowchart of an embodiment of a data maintenance method provided by the present invention. The data maintenance method shown in FIG. 9 is applicable to the data storage device 140 shown in FIG. 1. The process starts at step S900.

在步驟S900中,在快閃記憶體160被上電後,控制器160根據所接收之至少一讀取命令或者至少一寫入命令,在隨機記憶體166中之一預取區域CA中,載入一資料鏈結關係表TB1中之複數資料鏈結關係集合TS_0~TS_N的一部份。 In step S900, after the flash memory 160 is powered on, the controller 160 loads one of the prefetch areas CA in the random memory 166 according to the received at least one read command or at least one write command. Part of a plurality of data link relationship sets TS_0 ~ TS_N in a data link relationship table TB1.

接著,在步驟S902中,控制器160根據所載入之資料鏈結關係表TB1的被讀取的順序,在隨機記憶體166中建立一預取區域對應表SMR_TB、一反序表RSE_TB以及一順序表SE_TB。詳細而言,控制器160在隨機記憶體166中建立預取區域對應表SMR_TB,以紀錄相應於預取區域CA中之資料鏈結關係集合的集合指標。控制器160在隨機記憶體166中建立反序表RSE_TB,以紀錄在預取區域CA中之資料鏈結關係集合自預取區域CA中被讀取之反向的順序。控制器160在隨機記憶體166 中建立順序表SE_TB,以紀錄在預取區域CA中之資料鏈結關係集合自預取區域CA中被讀取之順序。值得注意的是,在步驟S902中所述之被讀取的順序係指資料鏈結關係表TB1自預取區域CA中被控制器160讀取以執行寫入命令以及讀取命令之順序。另外,在另一實施例中,控制器160亦可根據所載入之資料鏈結關係表TB1的被讀取的順序,設置一頭指標HIX以及一尾指標TIX。當預取區域CA已被寫滿並且需要載入新的資料鏈結關係集合時,根據尾指標TIX,選擇預取區域CA中之區段S_0~S_N中之一者,以將新的資料鏈結關係集合載入所選擇之區段。在新的上述資料鏈結關係集合載入所選擇之上述區段後,控制器160可根據頭指標、反序表中之資料以及順序表SE_TB中之資料,更新上序表以及順序表。 Next, in step S902, the controller 160 establishes a prefetched region correspondence table SMR_TB, a reverse sequence table RSE_TB, and a Sequence table SE_TB. In detail, the controller 160 establishes a prefetched region correspondence table SMR_TB in the random memory 166 to record a set index corresponding to a data link relationship set in the prefetched region CA. The controller 160 creates a reverse order table RSE_TB in the random memory 166 to record the reverse order of the data link relationship set in the prefetch area CA being read from the prefetch area CA. The controller 160 creates a sequence table SE_TB in the random memory 166 to record the order in which the data link relationship set in the prefetch area CA is read from the prefetch area CA. It should be noted that the order of reading in step S902 refers to the order in which the data link relationship table TB1 is read by the controller 160 from the prefetch area CA to execute the write command and the read command. In addition, in another embodiment, the controller 160 may also set a head index HIX and a tail index TIX according to the order in which the loaded data link relationship table TB1 is read. When the prefetch area CA is full and a new data link relationship set needs to be loaded, one of the sections S_0 ~ S_N in the prefetch area CA is selected according to the tail index TIX, so as to link the new data chain. The knot relationship set loads the selected section. After the new above-mentioned data link relationship set is loaded into the selected above-mentioned section, the controller 160 may update the upper-order table and the sequence table according to the header index, the data in the reverse-order table and the data in the sequence table SE_TB.

第10圖為本發明所提供之一資料維護方法之一種實施例的流程圖。第10圖所示之資料維護方法適用於第1圖所示之資料儲存裝置140。流程開始於步驟S1000。 FIG. 10 is a flowchart of an embodiment of a data maintenance method provided by the present invention. The data maintenance method shown in FIG. 10 is applicable to the data storage device 140 shown in FIG. 1. The process starts at step S1000.

在步驟S1000中,控制器160接收一讀取命令或者一寫入命令。讀取命令以及寫入命令係用以對快閃記憶體180中之特定的頁面進行讀取或者寫入,讀取命令以及寫入命令可為自主機120所接收之命令或者由控制器160本身維護資料所需要的讀取以及寫入動作所產生的寫入命令以及讀取命令。 In step S1000, the controller 160 receives a read command or a write command. The read command and the write command are used to read or write a specific page in the flash memory 180. The read command and the write command may be commands received from the host 120 or the controller 160 itself. Write and read commands generated by the read and write operations required to maintain the data.

接著,在步驟S1002中,控制器160根據在步驟S1000中所接收之讀取命令或者寫入命令,判斷包括讀取命令或者寫入命令所指定之頁面的一第一對應關係之一第一資料鏈結關係集合。舉例而言,讀取命令或者寫入命令指示之頁面 的邏輯位址與實體位址的對應關係是儲存於資料鏈結關係集合TS_2,控制器160則根據所接收之讀取命令或者寫入命令得知所指定之頁面,並找到對應的資料鏈結關係集合TS_2。 Next, in step S1002, the controller 160 determines, based on the read command or write command received in step S1000, one of the first data including a first correspondence relationship of the page specified by the read command or write command. Link relationship collection. For example, the correspondence between the logical address and the physical address of the page indicated by the read or write command is stored in the data link relationship set TS_2, and the controller 160 is based on the received read or write command. Learn the designated page and find the corresponding data link relationship set TS_2.

接著,在步驟S1004中,控制器160根據預取區域對應表SMR_TB中是否存在相應於第一資料鏈結關係集合的一第一集合指標,判斷第一資料鏈結關係集合是否已被載入預取區域CA中。當第一資料鏈結關係集合未被載入預取區域CA時,流程進行至步驟S1006;否則,流程進行至步驟S1060,以進行一更新程序。 Next, in step S1004, the controller 160 determines whether a first data link relationship set has been loaded into the pre-set according to whether a first set index corresponding to the first data link relationship set exists in the prefetch area correspondence table SMR_TB. Take area CA. When the first data link relationship set is not loaded into the prefetch area CA, the flow proceeds to step S1006; otherwise, the flow proceeds to step S1060 to perform an update procedure.

在步驟S1006中,控制器160判斷預取區域CA中是否具有空白之區段。值得注意的是,在本實施例中,空白的區段表示在預取區域CA中尚未被載入任何資料鏈結關係集合的區段。當預取區域CA中具有空白之區段時,流程進行至步驟S1008以執行一載入程序;否則,流程進行至步驟S1030,以執行一取代程序。 In step S1006, the controller 160 determines whether there is a blank section in the prefetch area CA. It is worth noting that, in this embodiment, the blank section indicates a section that has not been loaded with any data link relationship set in the prefetch area CA. When there is a blank section in the prefetch area CA, the flow proceeds to step S1008 to execute a loading procedure; otherwise, the flow proceeds to step S1030 to execute a replacement procedure.

在步驟S1008中,控制器160自快閃記憶體180中之一資料鏈結關係表TB1讀取第一資料鏈結關係集合,以將第一資料鏈結關係集合載入所選擇之空白的一第一區段。舉例而言,如第3圖所示,預取區域CA之區段S_0~S_N皆是空白的,控制器160選擇一空白之區段。在本實施例中,控制器160從最底部的區段開始選擇,故控制器160選擇區段S_N。接著,控制器160自快閃記憶體180中之資料鏈結關係表TB1讀取資料鏈結關係集合TS_2,以將資料鏈結關係集合TS_2載入所選擇之空白的區段S_N。在另一實施例中,如第4圖所示,預取區域CA之 區段S_0~S_N-1皆是空白的,控制器160則自區段S_0~S_N-1中選擇一空白之區段。在本實施例中,由於控制器160係用以從最底部的區段開始選擇,故控制器160選擇區段S_N,控制器160選擇區段S_N-1,但本發明不限於此。接著,控制器160自快閃記憶體180中之資料鏈結關係表TB1讀取資料鏈結關係集合TS_8,以將資料鏈結關係集合TS_8載入所選擇之空白的區段S_N-1。 In step S1008, the controller 160 reads the first data link relationship set from one of the data link relationship tables TB1 in the flash memory 180 to load the first data link relationship set into the selected blank one. First section. For example, as shown in FIG. 3, the sections S_0 ~ S_N of the prefetch area CA are all blank, and the controller 160 selects a blank section. In this embodiment, the controller 160 selects from the bottommost segment, so the controller 160 selects the segment S_N. Next, the controller 160 reads the data link relationship set TS_2 from the data link relationship table TB1 in the flash memory 180 to load the data link relationship set TS_2 into the selected blank section S_N. In another embodiment, as shown in FIG. 4, the sections S_0 ~ S_N-1 of the prefetch area CA are all blank, and the controller 160 selects a blank section from the sections S_0 ~ S_N-1. . In this embodiment, since the controller 160 is used to select from the bottommost section, the controller 160 selects the section S_N and the controller 160 selects the section S_N-1, but the present invention is not limited thereto. Then, the controller 160 reads the data link relationship set TS_8 from the data link relationship table TB1 in the flash memory 180 to load the data link relationship set TS_8 into the selected blank section S_N-1.

接著,在步驟S1010中,控制器160將相應於第一資料鏈結關係集合之第一集合指標,寫入預取區域對應表SMR_TB中相應於第一區段的區段對應欄。舉例而言,在第4圖之實施例中,控制器160係將集合指標為0xAA的資料鏈結關係集合TS_2寫入區段S_N。因此,控制器160則在步驟S1010中將資料鏈結關係集合TS_2的集合指標0xAA寫入區段S_N所相應之區段對應欄SMR_N。在第5圖之實施例中,控制器160係將集合指標為0xBB的資料鏈結關係集合TS_8寫入區段S_N-1。因此,控制器160則在步驟S1010中將資料鏈結關係集合TS_8的集合指標0xBB寫入區段S_N-1所相應之區段對應欄SMR_N-1。 Next, in step S1010, the controller 160 writes a first set index corresponding to the first data link relationship set into a section corresponding column corresponding to the first section in the prefetch area corresponding table SMR_TB. For example, in the embodiment of FIG. 4, the controller 160 writes the data link relationship set TS_2 whose set index is 0xAA into the section S_N. Therefore, the controller 160 writes the set index 0xAA of the data link relationship set TS_2 into the section corresponding column SMR_N corresponding to the section S_N in step S1010. In the embodiment of FIG. 5, the controller 160 writes the data link relationship set TS_8 whose set index is 0xBB into the section S_N-1. Therefore, the controller 160 writes the set index 0xBB of the data link relationship set TS_8 into the section corresponding column SMR_N-1 corresponding to the section S_N-1 in step S1010.

接著,在步驟S1012中,控制器160判斷第一區段是否為預取區域CA中第一個被載入的資料鏈結關係集合。換言之,控制器160判斷預取區域CA中之其他區段是否皆為空白。當預取區域CA中第一個被載入的資料鏈結關係集合時,流程進行至步驟S1014;否則,流程進行至步驟S1018。值得注意的是,控制器160亦可在步驟S1006中判斷是否有空白之區段的過程中進行判斷第一區段是否為預取區域CA中第一個被載 入的資料鏈結關係集合的步驟。 Next, in step S1012, the controller 160 determines whether the first section is the first loaded data link relationship set in the prefetch area CA. In other words, the controller 160 determines whether all other sections in the prefetch area CA are blank. When the first loaded data link relationship set in the prefetch area CA is set, the flow proceeds to step S1014; otherwise, the flow proceeds to step S1018. It is worth noting that the controller 160 can also determine whether the first section is the first set of data link relationships loaded in the prefetch area CA in the process of determining whether there is a blank section in step S1006. step.

在步驟S1014中,控制器160將一頭指標HIX以及一尾指標TIX同時定義為第一區之一第一共用指標。舉例而言,在第4圖的實施例中,資料鏈結關係集合TS_2係第一個被寫入預取區域CA的資料鏈結關係集合,其中資料鏈結關係集合TS_2係被寫入區段S_N。因此,在步驟S1014中,控制器160將將頭指標HIX以及尾指標TIX同時定義為區段S_N之共用指標CIX_N。接著,流程進行至步驟S1090。 In step S1014, the controller 160 simultaneously defines a head indicator HIX and a tail indicator TIX as one of the first common indicators in the first area. For example, in the embodiment of FIG. 4, the data link relationship set TS_2 is the first data link relationship set written in the prefetch area CA, where the data link relationship set TS_2 is written into the section S_N. Therefore, in step S1014, the controller 160 will simultaneously define the head index HIX and the tail index TIX as the common index CIX_N of the segment S_N. Then, the flow proceeds to step S1090.

在步驟S1018中,控制器160根據頭指標HIX,獲得在預取區域CA中最後一個被讀取之資料鏈結關係集合所屬之一第二區段。值得注意的是,在本實施例中,預取區域CA最後一個被讀取之資料鏈結關係集合指的是,目前之預取區域CA中最後一個被控制器160自預取區域CA中讀取以進行所接收之讀取命令或者寫入命令之資料鏈結關係集合。 In step S1018, the controller 160 obtains a second section to which the last data link relationship set read in the prefetch area CA according to the header index HIX. It is worth noting that, in this embodiment, the last set of data link relationships read in the prefetch area CA refers to the last prefetch area CA that was read by the controller 160 from the prefetch area CA. A set of data link relationships for receiving a read command or a write command.

接著,在步驟S1020中,控制器160將順序表SE_TB中相應於第二區段所相應之一第二順序欄的共用指標,寫入相應於第一區段的第一順序欄。舉例而言,在第五圖的實施例中,資料鏈結關係集合TS_8不係第一個被寫入預取區域CA的資料鏈結關係集合,其中資料鏈結關係集合TS_8係被寫入區段S_N-1(第一區段)。在更新隨機存取記憶體166中之表前,控制器160在步驟S1018中,根據目前頭指標HIX(如第4圖所示),獲得在預取區域CA中最後一個被讀取之資料鏈結關係集合TS_2所屬之一區段S_N(第二區段)。接著,在步驟S1020中,控制器160將區段S_N(第二區段)所相應之順序欄SE_N(第二順序欄) 的共用指標CIX_N,寫入相應於目前之區段S_N-1(第一區段)的順序欄SE_N-1(第一順序爛)。 Next, in step S1020, the controller 160 writes the common index of the second order column corresponding to the second section in the sequence table SE_TB into the first order column corresponding to the first section. For example, in the embodiment of the fifth figure, the data link relationship set TS_8 is not the first data link relationship set written in the prefetch area CA, where the data link relationship set TS_8 is written into the area Segment S_N-1 (first segment). Before updating the table in the random access memory 166, the controller 160 obtains the last read data chain in the prefetch area CA according to the current head index HIX (as shown in FIG. 4) in step S1018. A section S_N (second section) to which the relationship set TS_2 belongs. Next, in step S1020, the controller 160 writes the common index CIX_N of the sequence column SE_N (second sequence column) corresponding to the section S_N (second section) into the current section S_N-1 (the second section) A section) of the sequence column SE_N-1 (the first sequence is bad).

接著,在步驟S1022中,控制器160將反序表RSE_TB中相應於第一區段之第一反序欄的共用指標,寫入第二區段所相應之一第二反序欄。舉例而言,在第五圖的實施例中,控制器160在步驟S1022中將相應於目前之區段S_N-1(第一區段)的反序欄RSE_N-1(第一反序欄)之共用指標CIX_N-1,寫入區段S_N(第二區段)所相應之反序欄RSE_N中。 Next, in step S1022, the controller 160 writes the common index corresponding to the first reverse order column of the first section in the reverse order table RSE_TB into a second reverse order column corresponding to the second section. For example, in the embodiment of the fifth figure, the controller 160 in step S1022 corresponds to the reverse order column RSE_N-1 (first reverse order column) corresponding to the current section S_N-1 (first section). The common index CIX_N-1 is written in the reverse sequence column RSE_N corresponding to the sector S_N (second sector).

接著,在步驟S1024中,控制器160將頭指標HIX定義為第一區段之一第一共用指標。舉例而言,在第五圖的實施例中,控制器160在步驟S1024中,將頭指標HIX定義為目前區段S_N-1(第一區段)之共用指標CIX_N-1(第一共用指標),並且將尾指標TIX維持在共用指標CIX_N(第二共用指標)。接著,流程進行至步驟S1090。 Next, in step S1024, the controller 160 defines the head index HIX as a first common index of one of the first sections. For example, in the embodiment of the fifth figure, the controller 160 defines the head indicator HIX as the common indicator CIX_N-1 (the first common indicator) of the current section S_N-1 (the first section) in step S1024. ), And the tail indicator TIX is maintained at the common indicator CIX_N (second common indicator). Then, the flow proceeds to step S1090.

在步驟S1030中,控制器160根據尾指標TIX判斷預取區域CA中最久未被讀取之資料鏈結關係集合所屬的一第三區段。值得注意的是,在本實施例中,預取區域CA中最久未被讀取之資料鏈結關係集合指的是,目前之預取區域CA中最久未被控制器160自預取區域CA中讀取以進行所接收之讀取命令或者寫入命令之資料鏈結關係集合。 In step S1030, the controller 160 determines, according to the tail index TIX, a third section to which the most recently unread data link relationship set in the prefetch area CA belongs. It is worth noting that, in this embodiment, the set of data link relationships in the prefetch area CA that has not been read for the longest time refers to the current prefetch area CA that has not been read by the controller 160 in the prefetch area CA for the longest A collection of data link relationships for reading to perform a received read command or write command.

接著,在步驟S1032中,控制器160將第一資料鏈結關係集合的資料寫入第三區段。舉例而言,在第8圖之實施例中,讀取命令或者寫入命令所指定之頁面之一對應關係包括於資料鏈結關係集合TS_77(第一資料鏈結關係集合)。控制器 160在步驟S1004中已判斷預取區域對應表SMR_TB中不存在相應於資料鏈結關係集合TS_77的集合指標0x333,並且控制器160在步驟S1006中已判斷預取區域CA中已不具有空白之區段。因此,在步驟S1030中,控制器160根據更動前之第7A圖所示之尾指標TIX判斷預取區域CA中最久未被讀取之資料鏈結關係集合為資料鏈結關係集合TS_2,並且資料鏈結關係集合TS_2所相應之區段為區段S_N(第三區段)。因此,在步驟S1032中,控制器160自快閃記憶體180中之資料鏈結關係表TB1讀取資料鏈結關係集合TS_77(第一資料鏈結關係集合),以將資料鏈結關係集合TS_77載入所獲得之區段S_N(第三區段),以取代原本很久未被讀取之資料鏈結關係集合TS_2。。 Next, in step S1032, the controller 160 writes the data of the first data link relationship set into the third section. For example, in the embodiment of FIG. 8, a correspondence relationship of one of the pages specified by the read command or the write command is included in the data link relationship set TS_77 (the first data link relationship set). The controller 160 has determined in step S1004 that the set index 0x333 corresponding to the data link relationship set TS_77 does not exist in the prefetch area correspondence table SMR_TB, and the controller 160 has determined in step S1006 that there is no blank in the prefetch area CA. Section. Therefore, in step S1030, the controller 160 determines that the data link relationship set that has not been read for the longest time in the prefetch area CA is the data link relationship set TS_2 according to the tail index TIX shown in FIG. 7A before the change. The section corresponding to the link relationship set TS_2 is section S_N (third section). Therefore, in step S1032, the controller 160 reads the data link relationship set TS_77 (the first data link relationship set) from the data link relationship table TB1 in the flash memory 180 to collect the data link relationship set TS_77. Load the obtained segment S_N (third segment) to replace the data link relationship set TS_2 that has not been read for a long time. .

接著,在步驟S1034中,控制器160將相應於第一資料鏈結關係集合之第一集合指標,寫入預取區域對應表SMR_TB中相應於第三區段的區段對應欄。在第8圖之實施例中,控制器160接著在步驟S1034中將相應於資料鏈結關係集合TS_77(第一資料鏈結關係集合)之集合指標0x333(第一集合指標),寫入預取區域對應表SMR_TB中相應於區段S_N(第三區段)的區段對應欄SMR_N。 Next, in step S1034, the controller 160 writes the first set index corresponding to the first data link relationship set into the section corresponding column corresponding to the third section in the prefetch area corresponding table SMR_TB. In the embodiment of FIG. 8, the controller 160 then writes a set index 0x333 (first set index) corresponding to the data link relationship set TS_77 (first data link relationship set) in step S1034 to the prefetch In the area correspondence table SMR_TB, a section correspondence column SMR_N corresponding to the section S_N (third section).

接著,在步驟S1036中,控制器160根據頭指標HIX,獲得在預取區域CA中最後一個被讀取之資料鏈結關係集合所屬之一第四區段。 Next, in step S1036, the controller 160 obtains a fourth section to which the last data link relationship set read in the prefetch area CA according to the header index HIX.

接著,在步驟S1038中,控制器160將順序表SE_TB中之相應於第四區段之一第四順序欄的共用指標,寫入順序表SE_TB中相應於第三區段之一第三順序欄。舉例而言,在第8 圖之實施例中,控制器160在步驟S1036中根據更動前第7A圖所示之頭指標HIX,獲得在預取區域CA中最後一個被讀取之資料鏈結關係集合TS_0係屬於之區段S_2(第四區段)。接著,在步驟S1038中,控制器160將區段S_2(第四區段)所相應之順序欄SE_2(第四順序欄)的共用指標CIX_2,寫入相應於目前之區段S_N(第三區段)的順序欄SE_N(第三順序欄)。 Next, in step S1038, the controller 160 writes the common index in the sequence table SE_TB corresponding to the fourth order column of one of the fourth sections into the third order column corresponding to one of the third sections in the order table SE_TB. . For example, in the embodiment of FIG. 8, the controller 160 obtains the last data link relationship read in the prefetch area CA according to the head index HIX shown in FIG. 7A before the change in step S1036. The set TS_0 belongs to the section S_2 (fourth section). Next, in step S1038, the controller 160 writes the common index CIX_2 of the sequence column SE_2 (the fourth sequence column) corresponding to the section S_2 (the fourth section) into the current section S_N (the third zone) Paragraph) sequence column SE_N (third sequence column).

接著,在步驟S1040中,控制器160將反序表RSE_TB中相應於第三區段之一第三反序欄的共用指標,寫入反序表RSE_TB中相應於第四區段之一第四反序欄。舉例而言,在第8圖之實施例中,控制器160將相應於目前之區段S_N(第三區段)的反序欄RSE_N(第三反敘欄)之共用指標CIX_N,寫入區段S_2(第四區段)所相應之反序欄RSE_2(第四反序欄)。 Next, in step S1040, the controller 160 writes the common index corresponding to the third reverse order column in the reverse order table RSE_TB corresponding to one of the third sections into the reverse order table RSE_TB corresponding to one of the fourth sections. Reverse order bar. For example, in the embodiment of FIG. 8, the controller 160 writes a common index CIX_N corresponding to the reverse sequence column RSE_N (third reverse column) of the current section S_N (third section) to the area The reverse order column RSE_2 (fourth reverse order column) corresponding to the segment S_2 (fourth section).

接著,在步驟S1044中,控制器160讀取第三反序欄,以獲得反序欄RSE_0~RSE_N中一第五反序欄RSE_0~RSE_N之共用指標。換言之,控制器160讀取目前被寫入之第三區段所相應之第三反序欄,以獲得原本在目前之第三區段之後下一個被讀取之一第五區段。 Next, in step S1044, the controller 160 reads the third reverse-order column to obtain a common indicator of a fifth reverse-order column RSE_0 ~ RSE_N in the reverse-order column RSE_0 ~ RSE_N. In other words, the controller 160 reads the third reverse sequence column corresponding to the currently written third sector to obtain a fifth sector that was originally read next to the current third sector.

接著,在步驟S1044中,控制器160將尾指標TIX定義為相應於第五反序欄之一第五共用指標以及將頭指標HIX定義為第三順序欄之一第三共用指標。舉例而言,在第8圖之實施例中,控制器160在步驟S1044中讀取目前之區段S_N(第三區段)的反序欄RSE_N(第三反序欄),以獲得原本在目前之區段S_N(第三區段)之後下一個被讀取之區段S_N-1的共用指標 CIX_N-1(第五反序欄的共用指標)。接著,控制器160將頭指標HIX定義為目前區段S_N(第三區段)之共用指標CIX_N,並且將尾指標TIX定義為原本在目前之區段S_N之後下一個被讀取之區段S_N-1(第五區段)的共用指標CIX_N-1(第五共用指標)。 Next, in step S1044, the controller 160 defines the tail index TIX as a fifth common index corresponding to one of the fifth reverse order columns and the head index HIX as a third common index as one of the third order columns. For example, in the embodiment of FIG. 8, the controller 160 reads the reverse order column RSE_N (third reverse order column) of the current section S_N (third section) in step S1044 to obtain the original The common index CIX_N-1 (the common index in the fifth reverse column) of the current sector S_N (the third sector) is read next to the sector S_N-1. Next, the controller 160 defines the head indicator HIX as the common indicator CIX_N of the current section S_N (third section), and defines the tail indicator TIX as the section S_N that was originally read next after the current section S_N. A common index CIX_N-1 (the fifth common index) of -1 (the fifth sector).

接著,在步驟S1046中,控制器160將一特定值寫入第三反序欄以及相應於第五共用指標之一第五順序欄。換言之,控制器160將特定值寫入目前頭指標所指向之共用指標所相應的反序欄中,並且將特定值寫入目前尾指標所指向之共用指標所相應的順序欄中。如第8圖所示,控制器160將特定值寫入相應於目前區段S_N(第三區段)之反序欄RSE_N以及共用指標CIX_N-1(第五反序欄的共用指標)所相應之順序欄SE_N-1(第五順序欄)。接著,流程進行至步驟S1090。 Next, in step S1046, the controller 160 writes a specific value into the third reverse sequence column and the fifth sequence column corresponding to one of the fifth common indicators. In other words, the controller 160 writes the specific value into the reverse order column corresponding to the common indicator pointed to by the current head indicator, and writes the specific value into the sequence column corresponding to the common indicator pointed to by the current tail indicator. As shown in FIG. 8, the controller 160 writes a specific value into the reverse order column RSE_N and the common index CIX_N-1 (the fifth reverse order common index) corresponding to the current sector S_N (third sector). Sequence column SE_N-1 (the fifth sequence column). Then, the flow proceeds to step S1090.

在步驟S1060中,控制器160讀取相應於儲存第一資料鏈結關係集合之一第六區段所相應的一第六反序欄,以獲得在第一資料鏈結關係集合之後下一個被讀取之第七區段。換言之,控制器160讀取在一反序表RSE_TB中一第六區段所相應之一第六反序欄,以獲得在第六區段之後下一個被讀取之一第七區段。舉例而言,在第7A圖的實施例中,讀取命令或者寫入命令所指定之頁面之一對應關係包括於資料鏈結關係集合為TS_0。如更動前的第6圖所示,資料鏈結關係集合TS_0之集合指標0x5已存在於預取區域對應表SMR_TB中之區域對應欄SMR_2之中。因此,控制器160在步驟S1004中已根據預取區域對應表SMR_TB存在相應於資料鏈結關係集合TS_0的集合指標0x5,判斷資料鏈結關係集合TS_0已被載入預取區域CA。接 著,控制器160在步驟S1060中根據目前區段S_2(第六區段)之共用指標CIX_2,讀取反序表RSE_TB中相應於目前區段S_2(第六區段)之反序欄RSE_2(第六反序欄)中的值,並且根據反序欄RSE_2(第六反序欄)中之共用指標CIX_1找到在目前區段S_2(第六區段)之後下一個被讀取之區段為區段S_1。在第7B圖的實施例中,讀取命令或者寫入命令所指定之頁面之一對應關係包括於資料鏈結關係集合為TS_2。如更動前的第6圖所示,資料鏈結關係集合TS_2之集合指標0xAA已存在於預取區域對應表SMR_TB中之區域對應欄SMR_N之中。因此,控制器160在步驟S1004中已根據預取區域對應表SMR_TB存在相應於資料鏈結關係集合TS_N的集合指標0xAA,判斷資料鏈結關係集合TS_2已被載入預取區域CA。接著,控制器160在步驟S1060中根據目前區段S_N(第六區段)之共用指標CIX_N,讀取反序表RSE_TB中相應於目前區段S_N(第六區段)之反序欄RSE_N(第六反序欄)中的值,並且根據反序欄RSE_N(第六反序欄)中之共用指標CIX_N-1找到在目前區段S_N(第六區段)之後下一個被讀取之區段為區段S_N-1。 In step S1060, the controller 160 reads a sixth reverse order column corresponding to the sixth section in which one of the first data link relationship sets is stored, so as to obtain the next data link after the first data link relationship set. Read the seventh sector. In other words, the controller 160 reads a sixth reverse sequence column corresponding to a sixth sector in a reverse sequence table RSE_TB to obtain a seventh sector that is next read after the sixth sector. For example, in the embodiment of FIG. 7A, a correspondence relationship of one of the pages specified by the read command or the write command is included in the data link relationship set as TS_0. As shown in FIG. 6 before the change, the set index 0x5 of the data link relationship set TS_0 already exists in the region corresponding column SMR_2 in the prefetch region corresponding table SMR_TB. Therefore, in step S1004, the controller 160 has determined that the data link relationship set TS_0 has been loaded into the prefetch area CA according to the existence of the set index 0x5 corresponding to the data link relationship set TS_0 in the prefetch area correspondence table SMR_TB. Next, in step S1060, the controller 160 reads the reverse order column RSE_2 in the reverse order table RSE_TB corresponding to the current sector S_2 (sixth sector) according to the common index CIX_2 of the current sector S_2 (sixth sector). Value in the sixth reverse order column), and according to the shared index CIX_1 in the reverse order column RSE_2 (the sixth reverse order column), the next section read after the current section S_2 (the sixth section) is Section S_1. In the embodiment of FIG. 7B, a correspondence relationship of one of the pages specified by the read command or the write command is included in the data link relationship set as TS_2. As shown in FIG. 6 before the change, the set index 0xAA of the data link relationship set TS_2 already exists in the region corresponding column SMR_N in the prefetch region corresponding table SMR_TB. Therefore, in step S1004, the controller 160 has determined that the data link relationship set TS_2 has been loaded into the prefetch area CA according to the existence of the set index 0xAA corresponding to the data link relationship set TS_N in the prefetch area correspondence table SMR_TB. Next, in step S1060, the controller 160 reads the reverse order column RSE_N corresponding to the current section S_N (sixth section) in the reverse order table RSE_TB according to the common index CIX_N of the current section S_N (sixth section). Value in the sixth reverse order column), and find the next area to be read after the current section S_N (sixth section) according to the common index CIX_N-1 in the reverse order column RSE_N (sixth reverse order column). The segment is a segment S_N-1.

接著,在步驟S1062中,控制器160在順序表SE_TB中相應於第七區段之一第七順序欄中,寫入第六區段所相應之一第六順序欄中所儲存之共用指標。舉例而言,在第7A圖的實施例中,控制器160在步驟S1060中已獲得在目前區段S_2(第六區段)之後下一個被讀取之區段為區段S_1(第七區段)。因此,在步驟S1062中,控制器160在相應於區段S_1(第七區段)之順序欄SE_1(第七順序欄)中寫入目前區段S_2(第六區段)所相應 之順序欄SE_2(第六順序欄)中所儲存之共用指標CIX_3。換言之,控制器160將原本指向順序欄SE_2(第六順序欄)之順序欄SE_1(第七順序欄),改指向在第一資料鏈結關係集合之前上一個被讀取之區段S_3所相應之順序欄SE_3。在第7B圖的實施例中,控制器160在步驟S1060中已獲得在目前區段S_N(第六區段)之後下一個被讀取之區段為區段S_N-1(第七區段)。因此,在步驟S1062中,控制器160在相應於區段S_N-1(第七區段)之順序欄SE_N-1(第七順序欄)中寫入目前區段S_N(第六區段)所相應之順序欄SE_N(第六順序欄)中所儲存之值。 Next, in step S1062, the controller 160 writes the shared index stored in the sixth sequence column corresponding to the sixth sector in the seventh sequence column corresponding to one of the seventh sectors in the sequence table SE_TB. For example, in the embodiment of FIG. 7A, the controller 160 has obtained in step S1060 that the next sector read after the current sector S_2 (sixth sector) is sector S_1 (seventh sector). segment). Therefore, in step S1062, the controller 160 writes the sequence column corresponding to the current sector S_2 (sixth sector) in the sequence column SE_1 (seventh sequence column) corresponding to the sector S_1 (seventh sector). The shared indicator CIX_3 stored in SE_2 (sixth order column). In other words, the controller 160 points originally to the sequence column SE_1 (seventh sequence column) of the sequence column SE_2 (sixth sequence column), and points to the corresponding section S_3 that was read before the first data link relationship set. Sequence column SE_3. In the embodiment of FIG. 7B, the controller 160 has obtained in step S1060 that the next sector read after the current sector S_N (sixth sector) is sector S_N-1 (seventh sector). . Therefore, in step S1062, the controller 160 writes the current section S_N (sixth section) in the order column SE_N-1 (seventh order column) corresponding to the section S_N-1 (seventh section). The value stored in the corresponding sequence column SE_N (sixth sequence column).

接著,在步驟S1064中,控制器160根據頭指標HIX,獲得在預取區域CA中最後一個被讀取之資料鏈結關係集合所屬之一第八區段。 Next, in step S1064, the controller 160 obtains an eighth section to which the last data link relationship set read in the prefetch area CA belongs according to the header index HIX.

接著,在步驟S1065中,控制器160根據尾指標TIX,判斷預取區域CA中最久未被讀取之資料鏈結關係集合所屬的區段是否為第六區段。當最久未被讀取之資料鏈結關係集合所屬的區段為第六區段時,流程進行至步驟S1080;否則,流程進行至步驟S1066。換言之,控制器160在本步驟中判斷目前所要讀取之資料鏈結關係集合是否為預取區域CA中最久未被讀取的資料鏈結關係集合。 Next, in step S1065, the controller 160 determines whether the sector to which the data link relationship set that has been read the least recently in the prefetch area CA belongs is the sixth sector according to the tail index TIX. When the section to which the data link relationship set that has not been read for the longest time belongs to the sixth section, the flow proceeds to step S1080; otherwise, the flow proceeds to step S1066. In other words, the controller 160 determines in this step whether the currently set data link relationship set to be read is the data link relationship set that has not been read for the longest time in the prefetch area CA.

在步驟S1066中,控制器160讀取相應於第六區段之第六順序欄,以獲得相應於在第六區段之前一個被寫入之一第九區段之一第九共用指標。在第7A圖之實施例中,控制器160在步驟S1065中,根據尾指標TIX判斷目前區段S_2(第六區段)所儲存之資料鏈結關係集合TS_0不是預取區域CA中最久未被 讀取之資料鏈結關係集合。接著,控制器160在步驟S1066中讀取相應於目前區段S_2(第六區段)之順序欄SE_2(第六順序欄),以獲得相應於在目前區段S_2(第六區段)之前一個被寫入之區段為區段S_3(第九區段)。 In step S1066, the controller 160 reads a sixth sequence column corresponding to the sixth sector to obtain a ninth common index corresponding to one of the ninth sectors written before the sixth sector. In the embodiment of FIG. 7A, the controller 160 determines in step S1065 according to the tail index TIX that the data link relationship set TS_0 stored in the current section S_2 (sixth section) is not the longest time in the prefetch area CA. The collection of data link relationships read. Next, the controller 160 reads a sequence column SE_2 (sixth sequence column) corresponding to the current section S_2 (sixth section) in step S1066 to obtain a sequence corresponding to the current section S_2 (sixth section). One sector to be written is sector S_3 (ninth sector).

接著,在步驟S1068中,控制器160將第六反序欄中所儲存之共用指標,寫入相應於第九共用指標之一第九反序欄。舉例而言,在第7A圖的實施例中,控制器160在步驟S1068中將相應於目前區段S_2(第六區段)之反序欄RSE_2(第六反序欄)中所儲存之共用指標CIX_1,寫入相應於區段S_3(第九區段)之反序欄RSE_3(第九反序欄)。 Next, in step S1068, the controller 160 writes the shared index stored in the sixth reverse order column into the ninth reverse order column corresponding to one of the ninth shared index. For example, in the embodiment of FIG. 7A, the controller 160 in step S1068 corresponds to the share stored in the reverse order column RSE_2 (sixth reverse order column) corresponding to the current section S_2 (sixth section). The index CIX_1 is written in the reverse order column RSE_3 (the ninth reverse order column) corresponding to the section S_3 (the ninth section).

接著,在步驟S1070中,控制器160在順序欄SE_0~SE_N中相應於第六區段之第六順序欄中,寫入順序表SE_TB中第八區段所相應之一第八順序欄的共用指標。舉例而言,在第7A圖的實施例中,控制器160在步驟S1064中根據第6圖中之頭指標HIX,獲得在預取區域CA中最後一個被讀取之資料鏈結關係集合TS_1所屬之一區段S_0(第八區段),並且將區段S_0(第八區段)所相應之順序欄SE_0(第八順序欄)的共用指標CIX_0,寫入相應於目前之區段S_2(第六區段)的順序欄SE_2(第六順序欄)。 Next, in step S1070, the controller 160 writes the sharing of the eighth sequence column corresponding to the eighth segment in the sequence table SE_TB in the sixth sequence column corresponding to the sixth segment in the sequence columns SE_0 ~ SE_N. index. For example, in the embodiment of FIG. 7A, the controller 160 obtains the last data link relationship set TS_1 read in the prefetch area CA according to the head index HIX in FIG. 6 in step S1064. One segment S_0 (eighth segment), and write the common index CIX_0 of the sequence column SE_0 (eighth sequence column) corresponding to the segment S_0 (eighth segment) into the current segment S_2 ( The sixth column) is a sequence column SE_2 (sixth sequence column).

接著,在步驟S1072中,控制器160將反序表RSE_TB中相應於第六區段之第六反序欄的共用指標,寫入反序表RSE_TB中相應於最後一個被讀取之第八區段之一第八反序欄。舉例而言,在第7A圖的實施例中,控制器160在步驟S1072中將相應於目前之區段S_2(第六區段)的反序欄RSE_2(第六反 序欄)之共用指標CIX_2,寫入區段S_0(第八區段)所相應之反序欄RSE_0(第八反序欄)。 Next, in step S1072, the controller 160 writes the common index corresponding to the sixth reverse order column of the sixth section in the reverse order table RSE_TB into the reverse order table RSE_TB corresponding to the eighth area that was last read. One of the eighth inverse columns. For example, in the embodiment of FIG. 7A, the controller 160 sets the common index CIX_2 of the reverse order column RSE_2 (the sixth reverse order column) corresponding to the current section S_2 (the sixth section) in step S1072. , Write the reverse sequence column RSE_0 (eighth reverse sequence column) corresponding to the sector S_0 (eighth sector).

接著,在步驟S1074中,控制器160將頭指標HIX定義為第六順序欄之一第六共用指標。舉例而言,在第7A圖的實施例中,控制器160在步驟S1074中將頭指標HIX定義為目前區段S_2之共用指標CIX_2,並且將尾指標TIX維持在共用指標CIX_N。 Next, in step S1074, the controller 160 defines the head index HIX as a sixth common index in one of the sixth order columns. For example, in the embodiment of FIG. 7A, the controller 160 defines the head index HIX as the common index CIX_2 of the current section S_2 in step S1074, and maintains the tail index TIX at the common index CIX_N.

接著,在步驟S1076中,控制器160將一特定值寫入第六反序欄。舉例而言,在第7A圖的實施例中,控制器160在步驟S1076中,將一特定值寫入目前區段S_2(第六區段)所相應之反序欄RSE_2(第六反序欄)中。接著,流程進行值步驟S1090。 Next, in step S1076, the controller 160 writes a specific value into the sixth reverse order column. For example, in the embodiment of FIG. 7A, the controller 160 writes a specific value into the reverse sequence column RSE_2 (the sixth reverse sequence column) corresponding to the current section S_2 (the sixth section) in step S1076. )in. Next, the flow proceeds to step S1090.

在步驟S1080中,控制器160在相應於第六區段之第六順序欄中,寫入順序表SE_TB中第八區段所相應之一第八順序欄的共用指標。在第7B圖之實施例中,控制器160在步驟S1065中,根據尾指標TIX判斷目前區段S_N(第六區段)所儲存之資料鏈結關係集合TS_2不是預取區域CA中最久未被讀取之資料鏈結關係集合。接著,控制器160在步驟S1080中讀取相應於目前區段S_2(第六區段)之順序欄SE_2(第六順序欄),以獲得相應於在目前區段S_2(第六區段)之前一個被寫入之區段為區段S_3(第九區段)。 In step S1080, the controller 160 writes the common index of the eighth sequence column corresponding to the eighth sector in the sequence table SE_TB in the sixth sequence column corresponding to the sixth sector. In the embodiment of FIG. 7B, the controller 160 determines in step S1065 according to the tail index TIX that the data link relationship set TS_2 stored in the current section S_N (sixth section) is not the oldest in the prefetch area CA. The collection of data link relationships read. Next, the controller 160 reads a sequence column SE_2 (sixth sequence column) corresponding to the current section S_2 (sixth section) in step S1080 to obtain a sequence corresponding to the current section S_2 (sixth section). One sector to be written is sector S_3 (ninth sector).

接著,在步驟S1082中,控制器160將反序表RSE_TB中相應於第六區段之第六反序欄的共用指標,寫入反序表RSE_TB中相應於最後一個被讀取之第八區段之一第八反 序欄。舉例而言,在第7B圖之實施例中,控制器160已在步驟S1064中獲得最後一個被讀取之區段為區段S_0(第八區段)。因此,控制器160在步驟S1082中將相應於目前之區段S_N(第六區段)的反序欄RSE_N(第六反序欄)之共用指標CIX_N,寫入區段S_0(第八區段)所相應之反序欄RSE_0(第八反序欄)。 Next, in step S1082, the controller 160 writes the shared index corresponding to the sixth reverse order column of the sixth section in the reverse order table RSE_TB into the reverse order table RSE_TB corresponding to the eighth area that is read last. One of the eighth inverse columns. For example, in the embodiment of FIG. 7B, the controller 160 has obtained the last sector read in step S1064 as the sector S_0 (eighth sector). Therefore, the controller 160 writes the common index CIX_N in the reverse order column RSE_N (the sixth reverse order column) corresponding to the current section S_N (the sixth section) in step S1082 into the section S_0 (the eighth section) ) Corresponding to the reverse sequence column RSE_0 (eighth reverse sequence column).

接著,在步驟S1084中,控制器160將頭指標HIX定義為第六順序欄之一第六共用指標,並且將尾指標TIX定義為第七區段之一第七共用指標。舉例而言,在第7B圖之實施例中,控制器160在步驟S1084中將頭指標HIX定義為目前區段S_2(第六區段)之共用指標CIX_2,將尾指標TIX維持在共用指標CIX_N。 Next, in step S1084, the controller 160 defines the head index HIX as a sixth common index in one of the sixth order columns, and defines the tail index TIX as a seventh common index in one of the seventh sections. For example, in the embodiment of FIG. 7B, the controller 160 defines the head indicator HIX as the common indicator CIX_2 of the current section S_2 (sixth section) in step S1084, and maintains the tail indicator TIX at the common indicator CIX_N. .

接著,步驟S1086中,控制器160將一特定值寫入第六反序欄。換言之,控制器160將特定值寫入目前頭指標所指之共用指標CIX_N所相應的反序欄RSE_N中。接著,流程進行至步驟S1090。 Next, in step S1086, the controller 160 writes a specific value into the sixth reverse order column. In other words, the controller 160 writes the specific value into the reverse order column RSE_N corresponding to the common indicator CIX_N indicated by the current head indicator. Then, the flow proceeds to step S1090.

在步驟S1090中,控制器160自預取區域CA讀取第一資料鏈結關係集合中之資料,以執行在步驟S1000中所接收之寫入命令或者讀取命令。流程結束於步驟S1090。 In step S1090, the controller 160 reads the data in the first data link relationship set from the prefetch area CA to execute the write command or the read command received in step S1000. The flow ends in step S1090.

值得注意的是,通常對儲存於快閃記憶體180中之一個檔案進行讀寫會導致相關的資料鏈結關係集合被重複地讀取。換言之,通常某些與對讀寫檔案無關的命令所相關之資料鏈結關係集合僅會被讀取一次。有鑑於此,本發明另提供一實施例,用以將被頻繁讀取之資料鏈結關係集合以及沒有被頻繁讀取之資料鏈結關係集合分為兩個系統進行維護,其中預取 區域CA所儲存之資料鏈結關係集合中被讀取之次數小於一既定值之資料鏈結關係集合屬於非頻繁資料鏈結關係集合,並且預取區域CA所儲存之資料鏈結關係集合中被讀取到達既定值之資料鏈結關係集合屬於頻繁資料鏈結關係集合。在一實施例中,既定值為1,但本發明不限於此。在其他實施例中,既定值亦可為2、3、4、5、6、7、或8,其中開發者可基於在不同情況下對快閃記憶體180進行讀取或者寫入的模式設計既定值。 It is worth noting that generally reading and writing a file stored in the flash memory 180 will cause the related data link relationship set to be read repeatedly. In other words, some data link relationships related to commands that are not related to reading and writing files are usually read only once. In view of this, another embodiment of the present invention is provided to divide the frequently read data link relationship set and the not frequently read data link relationship set into two systems for maintenance, in which the prefetch area CA The data link relationship set that is read less than a predetermined value in the stored data link relationship set belongs to the infrequent data link relationship set, and is read from the data link relationship set stored in the prefetch area CA The set of data link relationships that reach a given value belongs to the set of frequent data link relationships. In one embodiment, the predetermined value is 1, but the present invention is not limited thereto. In other embodiments, the predetermined value can also be 2, 3, 4, 5, 6, 7, or 8. The developer can design based on the mode of reading or writing the flash memory 180 in different situations. Established value.

第11圖為本發明所提供之一隨機存取記憶體中之表之另一種實施例的方塊圖。如第11圖所示,當資料儲存裝置140被上電後,控制器160在隨機存取記憶體166中建立空白之一預取區域對應表SMR_TB、一反序表RSE_TB以及一順序表SE_TB,以記錄預取區域CA中資料的狀態。 FIG. 11 is a block diagram of another embodiment of a table in a random access memory provided by the present invention. As shown in FIG. 11, after the data storage device 140 is powered on, the controller 160 creates a blank prefetch area correspondence table SMR_TB, a reverse sequence table RSE_TB, and a sequence table SE_TB in the random access memory 166. To record the status of the data in the prefetch area CA.

預取區域CA具有複數區段S_0~S_N用以儲存資料鏈結關係表TB1中部分之資料鏈結關係集合,其中一個區段用以儲存一個資料鏈結關係集合。換言之,區段S_0~S_N的數量小於資料鏈結關係集合TS_0~TS_M之數量,也就是N<M。 The prefetch area CA has a plurality of sections S_0 ~ S_N for storing the data link relationship set in the data link relationship table TB1, and one section is used for storing a data link relationship set. In other words, the number of segments S_0 ~ S_N is smaller than the number of data link relationship sets TS_0 ~ TS_M, that is, N <M.

預取區域對應表SMR_TB具有複數區段對應欄SMR_0~SMR_N用以紀錄相應於預取區域CA中之資料鏈結關係集合TS_0~TS_M的集合指標,其中預取區域對應表SMR_TB中之區段對應欄SMR_0~SMR_N依序相應於預取區域CA中之區段S_0~S_N。值得注意的是,預取區域對應表SMR_TB中每一區段對應欄SMR_0~SMR_N的初始值皆為一特定值。在本實施例中,特定值為0xFFFF,但本發明不限於此。另外,資料鏈 結關係集合TS_0~TS_M的集合指標皆不等於特定值。 The prefetched area correspondence table SMR_TB has a plurality of section corresponding columns SMR_0 ~ SMR_N to record the set index corresponding to the data link relationship set TS_0 ~ TS_M in the prefetched area CA, where the prefetched area correspondence table SMR_TB corresponds to the section The columns SMR_0 ~ SMR_N sequentially correspond to the sections S_0 ~ S_N in the prefetch area CA. It is worth noting that the initial values of the corresponding columns SMR_0 ~ SMR_N in each section of the prefetched region correspondence table SMR_TB are a specific value. In this embodiment, the specific value is 0xFFFF, but the present invention is not limited to this. In addition, the set indexes of the data link relationship sets TS_0 ~ TS_M are not equal to a specific value.

順序表SE_TB用以分別紀錄頻繁資料鏈結關係集合自預取區域CA中被讀取之順序以及非頻繁資料鏈結關係集合自域取區域中被讀取之順序,其中順序表SE_TB具有複數順序欄SE_0~SE_N依序相應於預取區域CA中之區段S_0~S_N。值得注意的是,在本實施例中,順序表SE_TB中之順序欄SE_0~SE_N可記錄兩種順序(頻繁資料鏈結關係集合自預取區域CA中被讀取之順序以及非頻繁資料鏈結關係集合自域取區域中被讀取之順序)。詳細而言,與頻繁資料鏈結關係集合所屬之區段具有相同之共用指標之順序欄屬於頻繁順序欄,與非頻繁資料鏈結關係集合所屬之區段具有相同之共用指標之順序欄屬於非頻繁順序欄。換言之,順序欄之屬性是動態根據所相應之區段中所儲存之繁資料鏈結關係集合的態樣(頻繁或者非頻繁)而決定的。每一頻繁順序欄係用以儲存另一頻繁順序欄的共用指標,以分別指向在相應於頻繁順序欄之區段之前上一個被讀取之頻繁資料鏈結關係集合之區段所相應之頻繁順序欄。每一非頻繁順序欄係用以儲存另一非頻繁順序欄的共用指標,以分別指向在相應於非頻繁順序欄之區段之前上一個被讀取之非頻繁資料鏈結關係集合之區段所相應之非頻繁順序欄。值得注意的是,順序表SE_TB中每一順序欄SE_0~SE_N的初始值皆為-特定值。在本實施例中,特定值為0xFFFF,但本發明不限於此。 The sequence table SE_TB is used to record the order in which the frequent data link relationship set is read from the prefetch area CA and the order in which the infrequent data link relationship set is read from the domain fetch area. The sequence table SE_TB has a plural order. The columns SE_0 ~ SE_N sequentially correspond to the sections S_0 ~ S_N in the prefetch area CA. It is worth noting that in this embodiment, the order columns SE_0 ~ SE_N in the order table SE_TB can record two orders (the order in which the frequent data link relationship set is read from the prefetch area CA and the infrequent data link The order in which relation sets are read from the domain fetch area). In detail, the order column with the same common index as the section to which the frequent data link relationship set belongs belongs to the frequent order column, and the order column with the same common index to the section to which the frequent data link relationship set belongs belongs to the non- Frequent order bar. In other words, the attributes of the sequence column are dynamically determined according to the appearance (frequent or infrequent) of the complex data link relationship set stored in the corresponding section. Each frequent order column is used to store a common indicator of another frequent order column, which respectively points to the corresponding frequent corresponding to the section of the frequent data link relationship set that was read before the section corresponding to the frequent order column. Order bar. Each infrequently ordered column is used to store a common indicator of another infrequently ordered column to point to the section of the infrequent data link relationship set that was read before the section corresponding to the infrequently ordered column, respectively. The corresponding infrequent order column. It is worth noting that the initial value of each sequence column SE_0 ~ SE_N in the sequence table SE_TB is a -specific value. In this embodiment, the specific value is 0xFFFF, but the present invention is not limited to this.

反序表RSE_TB用以分別紀錄頻繁資料鏈結關係集合自預取區域CA中被讀取之反向的順序以及非頻繁資料鏈 結關係集合自預取區域CA中被讀取之反向的順序,其中反序表RSE_TB具有複數反序欄RSE_0~RSE_N依序相應於預取區域CA中之區段S_0~S_N。值得注意的是,在本實施例中,反序表RSE_TB中之反序欄RSE_0~RSE_N可記錄兩種順序(頻繁資料鏈結關係集合自預取區域CA中被讀取之反向的順序以及非頻繁資料鏈結關係集合自域取區域中被讀取之反向的順序)。詳細而言,與頻繁資料鏈結關係集合所屬之區段具有相同之共用指標之反序欄屬於頻繁反序欄,與非頻繁資料鏈結關係集合所屬之區段具有相同之共用指標之反序欄屬於非頻繁反序欄。換言之,反序欄RSE_0~RSE_N之屬性是動態根據所相應之區段中所儲存之繁資料鏈結關係集合的態樣(頻繁或者非頻繁)而決定的。每一頻繁反序欄RSE_0~RSE_N係用以儲存另一頻繁反序欄的共用指標,以分別指向在相應於頻繁反序欄之區段之後下一個被讀取之頻繁資料鏈結關係集合之區段所相應之頻繁反序欄。每一非頻繁反序欄RSE_0~RSE_N係用以儲存另一非頻繁反序欄的共用指標,以分別指向在相應於非頻繁反序欄之區段之後下一個被讀取之非頻繁資料鏈結關係集合之區段所相應之非頻繁反序欄。值得注意的是,反序表RSE_TB中每一反序欄RSE_0~RSE_N的初始值皆為一特定值。在本實施例中,特定值為0xFFFF,但本發明不限於此。 The reverse order table RSE_TB is used to record the reverse order of the frequent data link relationship set read from the prefetch area CA and the reverse order of the infrequent data link relationship set read from the prefetch area CA. Among them, the reverse order table RSE_TB has a plurality of reverse order columns RSE_0 ~ RSE_N corresponding to the sections S_0 ~ S_N in the prefetch area CA in order. It is worth noting that in this embodiment, the reverse order columns RSE_0 ~ RSE_N in the reverse order table RSE_TB can record two orders (the reverse order of the frequent data link relationship set read from the prefetch area CA and The set of infrequent data link relationships is read in reverse order from the domain fetch area). In detail, the reverse order column with the same shared index as the section to which the frequent data link relationship set belongs belongs to the frequent reverse order column, and the reverse order column with the same shared index to the section where the frequent data link relationship set belongs to The columns are infrequent reverse columns. In other words, the attributes of the reverse sequence columns RSE_0 ~ RSE_N are dynamically determined according to the appearance (frequent or infrequent) of the complex data link relationship set stored in the corresponding section. Each frequent reverse order column RSE_0 ~ RSE_N is used to store a common indicator of another frequent reverse order column, which respectively points to the next frequent data link relationship set that is read after the section corresponding to the frequent reverse order column. Frequent reverse order column corresponding to the segment. Each infrequent reverse order column RSE_0 ~ RSE_N is used to store the common indicator of another infrequent reverse order column, respectively, to point to the next infrequent data chain that is read after the section corresponding to the infrequent reverse order column. Infrequent reverse columns corresponding to the sections of the relationship set. It is worth noting that the initial value of each of the reverse order columns RSE_0 ~ RSE_N in the reverse order table RSE_TB is a specific value. In this embodiment, the specific value is 0xFFFF, but the present invention is not limited to this.

值得注意的是,在一實施例中,區段S_0~S_N依序具有特定之共用指標CIX_0~CIX_N。區段對應欄SMR_0~SMR_N與其相應之區段S_0~S_N具有相同之共用指標CIX_0~CIX_N。順序欄SE_0~SE_N與其相應之區段S_0~S_N具 有相同之共用指標CIX_0~CIX_N。反序欄RSE_0~RSE_N與其相應之區段S_0~S_N具有相同之共用指標CIX_0~CIX_N。詳細而言,區段S_0、順序欄SE_0、區段對應欄SMR_0以及反序欄RSE_0之共用指標皆為CIX_0。區段S_1、順序欄SE_1、區段對應欄SMR_1以及反序欄RSE_1之共用指標皆為CIX_1。區段S_2、順序欄SE_2、區段對應欄SMR_2以及反序欄RSE_2之共用指標皆為CIX_2,依此類推。值得注意的是,每一共用指標CIX_0~CIX_N皆不等於特定值。在一實施例中,共用指標CIX_0~CIX_N依序為0x0、0x1、0x2、0x3等十六進位數值,但本發明不限於此。 It is worth noting that, in an embodiment, the segments S_0 ~ S_N have specific common indexes CIX_0 ~ CIX_N in order. The section corresponding columns SMR_0 ~ SMR_N and the corresponding sections S_0 ~ S_N have the same common index CIX_0 ~ CIX_N. The sequence columns SE_0 ~ SE_N and their corresponding sections S_0 ~ S_N have the same common indicators CIX_0 ~ CIX_N. The reverse order columns RSE_0 ~ RSE_N and their corresponding sections S_0 ~ S_N have the same common index CIX_0 ~ CIX_N. In detail, the shared indicators of the segment S_0, the sequence column SE_0, the segment corresponding column SMR_0, and the reverse sequence column RSE_0 are all CIX_0. The shared indicators of the segment S_1, the sequence column SE_1, the segment corresponding column SMR_1, and the reverse sequence column RSE_1 are all CIX_1. The common indicators of the segment S_2, the sequence column SE_2, the segment corresponding column SMR_2, and the reverse sequence column RSE_2 are CIX_2, and so on. It is worth noting that each common indicator CIX_0 ~ CIX_N is not equal to a specific value. In an embodiment, the common indicators CIX_0 to CIX_N are sequentially hexadecimal values such as 0x0, 0x1, 0x2, and 0x3, but the present invention is not limited thereto.

綜上所述,控制器160建立預取區域對應表SMR_TB,以紀錄相應於預取區域CA中之資料鏈結關係集合TS_0~TS_M的集合指標。控制器160建立反序表RSE_TB,以分別紀錄頻繁資料鏈結關係集合自預取區域CA中被讀取之反向的順序以及非頻繁資料鏈結關係集合自預取區域CA中被讀取之反向的順序。控制器160建立順序表SE_TB,以分別紀錄頻繁資料鏈結關係集合自預取區域CA中被讀取之順序以及非頻繁資料鏈結關係集合自域取區域中被讀取之順序。在一實施例中,控制器160更用以在隨機存取記憶體166中建立一非頻繁指標組以及一頻繁指標組,其中非頻繁指標組用以維護非頻繁資料鏈結關係集合,並且頻繁指標組用以維護被頻繁資料鏈結關係集合。在一實施例中,非頻繁指標組係由一非頻繁頭指標LRU_HIX以及一非頻繁尾指標LRU_TIX所構成,並且頻繁指標組係由一頻繁頭指標FR_HIX以及一頻繁尾指標FR_TIX所構 成。在其他實施例中,非頻繁頭指標LRU_HIX、非頻繁尾指標LRU_TIX、頻繁頭指標FR_HIX以及頻繁尾指標FR_TIX也可以建立於其他記憶體或者電路中,本發明不限於此。非頻繁頭指標LRU_HIX為用以儲存最後一個被讀取之非頻繁資料鏈結關係集合之區段的共用指標,以指向預取區域CA中最後一個被讀取之非頻繁資料鏈結關係集合。非頻繁尾指標LRU_TIX為用以儲存最久未被讀取之非頻繁資料鏈結關係集合之區段的共用指標,以指向預取區域CA中最久未被讀取之非頻繁資料鏈結關係集合。頻繁頭指標FR_HIX為用以儲存最後一個被讀取之頻繁資料鏈結關係集合之區段的共用指標,以指向預取區域CA中最後一個被讀取之頻繁資料鏈結關係集合。頻繁尾指標FR_TIX為用以儲存最久未被讀取之頻繁資料鏈結關係集合之區段的共用指標,以指向預取區域CA中最久未被讀取之頻繁資料鏈結關係集合。值得注意的是,由於彼此相應之區段、順序欄、區段對應欄以及反序欄具有相同之共用指標,故非頻繁頭指標LRU_HIX、非頻繁尾指標LRU_TIX、頻繁頭指標FR_HIX以及頻繁尾指標FR_TIX同時也指向相應之順序欄、區段對應欄以及反序欄。值得注意的是,在一實施例中,非頻繁頭指標LRU_HIX以及非頻繁尾指標LRU_TIX的初始值可為共用指標CIX_N,並且頻繁頭指標FR_HIX以及頻繁尾指標FR_TIX之初始值可為一特定值,該特定值與所有共用指標CIX_0~CIX_N不同。在另一實施例中,非頻繁頭指標LRU_HIX、非頻繁尾指標LRU_TIX、頻繁頭指標FR_HIX以及頻繁尾指標FR_TIX之初始值皆為一特定值,該特定值與所有共用指標CIX_0~CIX_N不 同。 In summary, the controller 160 establishes a prefetch area correspondence table SMR_TB to record a set index corresponding to the data link relationship set TS_0 ~ TS_M in the prefetch area CA. The controller 160 establishes a reverse order table RSE_TB to record the reverse order of the frequent data link relationship set read from the prefetch area CA and the non-frequent data link relationship set read from the prefetch area CA. Reverse order. The controller 160 establishes a sequence table SE_TB to record the order in which the frequent data link relationship set is read from the prefetch area CA and the order in which the infrequent data link relationship set is read from the domain fetch area. In an embodiment, the controller 160 is further configured to establish an infrequent index group and a frequent index group in the random access memory 166, wherein the infrequent index group is used to maintain an infrequent data link relationship set, and frequently The index group is used to maintain a collection of frequently linked data relationships. In one embodiment, the infrequent indicator group is composed of an infrequent header indicator LRU_HIX and an infrequent tail indicator LRU_TIX, and the frequent indicator group is composed of a frequent header indicator FR_HIX and a frequent tail indicator FR_TIX. In other embodiments, the infrequent header indicator LRU_HIX, the infrequent tail indicator LRU_TIX, the frequent header indicator FR_HIX, and the frequent tail indicator FR_TIX can also be established in other memories or circuits, and the present invention is not limited thereto. The infrequent header index LRU_HIX is a shared index for storing the last read infrequent data link relationship set segment to point to the last read infrequent data link relationship set in the prefetch area CA. The infrequent tail indicator LRU_TIX is a shared indicator for storing the segments of the infrequent data link relationship set that has not been read for the longest time, and points to the infrequent data link relationship set that has been read for the longest time in the prefetch area CA. The frequent header index FR_HIX is a shared index used to store the section of the last frequently read data link relationship set read to point to the last frequently read data link relationship set read in the prefetch area CA. The frequent tail index FR_TIX is a shared index used to store the segments of the frequent data link relationship set that have not been read for the longest time, so as to point to the most frequently read data link relationship set in the prefetch area CA. It is worth noting that because the corresponding sections, sequence columns, section corresponding columns, and reverse sequence columns have the same common indicators, the infrequent header indicator LRU_HIX, the infrequent tail indicator LRU_TIX, the frequent header indicator FR_HIX, and the frequent tail indicator FR_TIX also points to the corresponding order column, section corresponding column, and reverse order column. It is worth noting that, in an embodiment, the initial values of the infrequent header indicator LRU_HIX and the infrequent tail indicator LRU_TIX may be the common indicator CIX_N, and the initial values of the frequent header indicator FR_HIX and the frequent tail indicator FR_TIX may be specific values. This specific value is different from all common indicators CIX_0 ~ CIX_N. In another embodiment, the initial values of the infrequent header indicator LRU_HIX, the infrequent tail indicator LRU_TIX, the frequent header indicator FR_HIX, and the frequent tail indicator FR_TIX are all a specific value, which is different from all common indicators CIX_0 ~ CIX_N.

在本實施例中,任何資料鏈結關係集合TS_0~TS_M被上載至預取區域CA後,都屬於非頻繁資料鏈結關係集合,直到另一命令致使控制器160對已上載至預取區域CA之非頻繁資料鏈結關係集合進行讀取,被讀取之非頻繁資料鏈結關係集合則屬於頻繁資料鏈結關係集合。另外,控制器160可根據非頻繁尾指標LRU_TIX,選擇預取區域CA中之複數區段S_0~S_N中之一者。換言之,控制器160可根據非頻繁尾指標LRU_TIX選擇預取區域CA中最久未被讀取之非頻繁資料鏈結關係集合,以將新的資料鏈結關係集合載入用以儲存所選擇之非頻繁資料鏈結關係集合的區段。當預取區域CA中之所有資料鏈結關係集合皆屬於頻繁資料鏈結關係集合並且控制器160需要上載其他新的資料鏈結關係集合時,代表控制器160開始對另一個檔案進行讀取。因此,當非頻繁尾指標LRU_TIX並未指向任何一個共用指標時,控制器160會將頻繁指標組轉移為非頻繁指標組,並且刪除頻繁指標組中之數值。 In this embodiment, after any data link relationship set TS_0 ~ TS_M is uploaded to the prefetch area CA, it belongs to the infrequent data link relationship set until another command causes the controller 160 to upload the data to the prefetch area CA. The infrequent data link relationship set is read, and the read infrequent data link relationship set belongs to the frequent data link relationship set. In addition, the controller 160 may select one of the plural sections S_0 ~ S_N in the prefetch area CA according to the infrequent tail index LRU_TIX. In other words, the controller 160 may select an infrequent data link relationship set that has not been read for the longest time in the prefetch area CA according to the infrequent tail index LRU_TIX to load a new data link relationship set to store the selected A section of a collection of frequent data link relationships. When all the data link relationship sets in the prefetch area CA belong to the frequent data link relationship set and the controller 160 needs to upload other new data link relationship sets, the controller 160 starts reading another file. Therefore, when the infrequent tail indicator LRU_TIX does not point to any common indicator, the controller 160 transfers the frequent indicator group to the infrequent indicator group and deletes the value in the frequent indicator group.

詳細而言,當預取區域對應表SMR_TB中不存在控制器160目前需要讀取之一第一資料鏈結關係集合的第一集合指標時,控制器160判斷預取區域CA是否具有空白之區段。當控制器160判斷預取區域CA之區段S_0~S_N具有空白之一第一區段時,控制器160自快閃記憶體180中之資料鏈結關係表TB1讀取第一資料鏈結關係集合,將第一資料鏈結關係集合載入空白之第一區段。當控制器160判斷預取區域CA不具有空白之區段時,控制器160判斷非頻繁尾指標LRU_TIX是否為共用指標 中之任一者。當非頻繁尾指標LRU_TIX為共用指標中之任一者時,控制器160根據非頻繁尾指標LRU_TIX判斷非頻繁資料鏈結關係集合中最久未被讀取之非頻繁資料鏈結關係集合,以將第一資料鏈結關係集合的資料寫入非頻繁資料鏈結關係集合中最久未被讀取之非頻繁資料鏈結關係集合所屬的區段。當非頻繁尾指標LRU_TIX不是共用指標中之任一者時,控制器160將頻繁尾指標FR_TIX中所儲存之共用指標寫入非頻繁尾指標LRU_TIX,將頻繁頭指標FR_HIX中所儲存之共用指標寫入非頻繁頭指標LRU_HIX,並且刪除頻繁尾指標FR_TIX以及非頻繁尾指標LRU_TIX中的共用指標。在另一實施例中,控制器160亦可在將頻繁頭指標FR_HIX中所儲存之共用指標寫入非頻繁頭指標LRU_HIX後,將與共用指標不同之一特定值寫入頻繁尾指標FR_TIX以及非頻繁尾指標LRU_TIX。另外,控制器160更用以根據非頻繁指標組以及頻繁指標組更新順序表SE_TB以及反序表RSE_TB。 In detail, when the first collection index of the first data link relationship set that the controller 160 currently needs to read does not exist in the prefetch area correspondence table SMR_TB, the controller 160 determines whether the prefetch area CA has a blank area segment. When the controller 160 determines that the sections S_0 ~ S_N of the prefetch area CA have a blank first section, the controller 160 reads the first data link relationship from the data link relationship table TB1 in the flash memory 180 Set to load the first data link relationship set into the blank first section. When the controller 160 determines that the prefetch area CA does not have a blank sector, the controller 160 determines whether the infrequent tail index LRU_TIX is any of the common indexes. When the infrequent tail indicator LRU_TIX is any of the common indicators, the controller 160 determines the infrequent data link relationship set that has not been read for the longest time in the infrequent data link relationship set according to the infrequent tail indicator LRU_TIX, so that The data of the first data link relationship set is written into the section of the infrequent data link relationship set that belongs to the infrequent data link relationship set that has not been read for the longest time. When the infrequent tail indicator LRU_TIX is not any of the common indicators, the controller 160 writes the common indicator stored in the frequent tail indicator FR_TIX into the infrequent tail indicator LRU_TIX and writes the common indicator stored in the frequent head indicator FR_HIX. Enter the infrequent header indicator LRU_HIX, and delete the common indicator in the frequent tail indicator FR_TIX and the infrequent tail indicator LRU_TIX. In another embodiment, the controller 160 may also write the common indicator stored in the frequent header indicator FR_HIX into the non-frequent header indicator LRU_HIX, and write a specific value different from the common indicator into the frequent tail indicator FR_TIX and non- Frequent tail indicator LRU_TIX. In addition, the controller 160 is further configured to update the sequence table SE_TB and the reverse sequence table RSE_TB according to the infrequent indicator group and the frequent indicator group.

在第11圖初始狀態的實施例中,當控制器160接收到一讀取命令或者一寫入命令時,控制器160根據所接收之讀取命令或者寫入命令,找出包括讀取命令或者寫入命令所指定之頁面之一第一對應關係的一第一資料鏈結關係集合。舉例而言,讀取命令或者寫入命令指示之頁面的邏輯位址與實體位址的對應關係是儲存於資料鏈結關係集合TS_2,控制器160則根據所接收之讀取命令或者寫入命令得知所指定之頁面,並找到對應的資料鏈結關係集合TS_2。接著,控制器160根據預取區域對應表SMR_TB中是否存在相應於第一資料鏈結關係集合 TS_2的集合指標,判斷資料鏈結關係集合TS_2是否已被載入預取區域CA。相似於第4圖之實施例,舉例而言,資料鏈結關係集合TS_2的集合指標為0xAA。如第11圖所示,若預取區域CA皆未寫入任何資料鏈結關係集合時,預取區域對應表SMR_TB中所有區段對應欄SMR_0~SMR_N皆為0xFFFF。因此,在本實施例中,控制器160判斷資料鏈結關係集合TS_2的集合指標0xAA不存在於預取區域對應表SMR_TB中。換言之,控制器160根據資料鏈結關係集合TS_2的集合指標0xAA不存在於預取區域對應表SMR_TB中,判斷預取區域CA中不具有資料鏈結關係集合TS_2。接著,相似於第4圖之實施例,控制器160在判斷預取區域CA具有空白之區段S_0~S_N後,選擇一空白之區段S_N,並自快閃記憶體180中之資料鏈結關係表TB1讀取資料鏈結關係集合TS_2,以將資料鏈結關係集合TS_2載入所選擇之空白的區段S_N。接著,控制器160更新預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、非頻繁指標組以及頻繁指標組,以記錄目前預取區域CA的狀態。如第12圖所示,控制器160將資料鏈結關係集合TS_2的集合指標0xAA寫入區段S_N所相應之區段對應欄SMR_N。值得注意的是,由於資料鏈結關係集合TS_2是新載入之資料,故資料鏈結關係集合TS_2屬於非頻繁資料鏈結關係集合。因此,控制器160將非頻繁頭指標LRU_HIX以及非頻繁尾指標LRU_TIX同時定義為區段S_N之共用指標CIX_N。值得注意的是,在本實施例中,順序表SE_TB以及反序表RSE_TB中相應於區段S_N之順序欄SE_N以及反序欄RSE_N維持特定值0xFFFF,並且頻繁頭指標 FR_HIX以及頻繁尾指標FR_TIX維持原本之狀態。最後,控制器160讀取儲存於預取區域CA之資料鏈結關係集合TS_2以執行所接收到之寫入命令以及讀取命令。值得注意的是,由於順序欄SE_N以及反序欄RSE_N與具有非頻繁資料鏈結關係集合TS_2之區段S_N具有相同之共用指標CIX_N。因此,在本實施例中,順序欄SE_N屬於非頻繁順序欄,反序欄RSE_N屬於非頻繁反序欄。 In the embodiment of the initial state in FIG. 11, when the controller 160 receives a read command or a write command, the controller 160 finds out whether the read command or the write command includes the read command or A first data link relationship set of a first correspondence relationship of a page specified by the write command. For example, the correspondence between the logical address and the physical address of the page indicated by the read or write command is stored in the data link relationship set TS_2, and the controller 160 is based on the received read or write command. Learn the designated page and find the corresponding data link relationship set TS_2. Next, the controller 160 determines whether the data link relationship set TS_2 has been loaded into the prefetch area CA according to whether a set index corresponding to the first data link relationship set TS_2 exists in the prefetch area correspondence table SMR_TB. Similar to the embodiment in FIG. 4, for example, the set index of the data link relationship set TS_2 is 0xAA. As shown in FIG. 11, if no pre-fetch area CA is written with any data link relationship set, the corresponding columns SMR_0 to SMR_N of all sections in the pre-fetch area correspondence table SMR_TB are 0xFFFF. Therefore, in this embodiment, the controller 160 determines that the set index 0xAA of the data link relationship set TS_2 does not exist in the prefetched region correspondence table SMR_TB. In other words, the controller 160 determines that the data link relationship set TS_2 does not exist in the prefetch area CA according to the set index 0xAA of the data link relationship set TS_2 that does not exist in the prefetch area correspondence table SMR_TB. Next, similar to the embodiment of FIG. 4, the controller 160 selects a blank sector S_N after judging that the prefetch area CA has a blank sector S_0 ~ S_N, and links the data in the flash memory 180 The relation table TB1 reads the data link relation set TS_2 to load the data link relation set TS_2 into the selected blank section S_N. Next, the controller 160 updates the prefetch area correspondence table SMR_TB, the order table SE_TB, the reverse order table RSE_TB, the infrequent indicator group, and the frequent indicator group to record the current state of the prefetch area CA. As shown in FIG. 12, the controller 160 writes the set index 0xAA of the data link relationship set TS_2 into the section corresponding column SMR_N corresponding to the section S_N. It is worth noting that since the data link relationship set TS_2 is newly loaded data, the data link relationship set TS_2 belongs to the infrequent data link relationship set. Therefore, the controller 160 defines both the infrequent head indicator LRU_HIX and the infrequent tail indicator LRU_TIX as the common indicator CIX_N of the section S_N. It is worth noting that, in this embodiment, the sequence column SE_N and the reverse column RSE_N of the sequence table SE_TB and the reverse sequence table RSE_TB maintain a specific value of 0xFFFF, and the frequent head indicator FR_HIX and the frequent tail indicator FR_TIX are maintained. The original state. Finally, the controller 160 reads the data link relationship set TS_2 stored in the prefetch area CA to execute the received write command and read command. It is worth noting that, since the sequence column SE_N and the reverse sequence column RSE_N and the section S_N with the infrequent data link relationship set TS_2 have the same common index CIX_N. Therefore, in this embodiment, the order column SE_N belongs to the infrequent order column, and the reverse order column RSE_N belongs to the infrequent order column.

接著,在第12圖的實施例中,當控制器160接收到一讀取命令或者一寫入命令時,控制器160同樣地根據所接收之讀取命令或者寫入命令,找出包括讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合。舉例而言,在本實施例中,讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合為TS_8。接著,控制器160根據預取區域對應表SMR_TB中是否存在相應於資料鏈結關係集合TS_8的集合指標,判斷資料鏈結關係集合TS_8是否已被載入預取區域CA。舉例而言,資料鏈結關係集合TS_8的集合指標為0xBB。如第12圖所示,預取區域CA只被寫入了資料鏈結關係集合TS_2,預取區域對應表SMR_TB中只有區段對應欄SMR_N為0xAA,其他皆為0xFFFF。相似於第5圖之實施例,控制器160判斷資料鏈結關係集合TS_8的集合指標0xBB不存在於預取區域對應表SMR_TB中,並且選擇一空白之區段S_N-1。接著,控制器160自快閃記憶體180中之資料鏈結關係表TB1讀取資料鏈結關係集合TS_8,以將資料鏈結關係集合TS_8載入所選擇之空白的區段S_N-1。接著,控制器160更新預取區域對應表 SMR_TB、順序表SE_TB、反序表RSE_TB、非頻繁指標組以及頻繁指標組,以記錄目前預取區域CA的狀態。值得注意的是,由於資料鏈結關係集合TS_8是新載入之資料,故資料鏈結關係集合TS_8屬於非頻繁資料鏈結關係集合。因此,如第12圖所示,控制器160根據非頻繁頭指標LRU_HIX,獲得在預取區域CA中最後一個被讀取之非頻繁資料鏈結關係集合TS_2所屬之一區段S_N,並且將區段S_N所相應之順序欄SE_N的共用指標CIX_N,寫入相應於目前之區段S_N-1的順序欄SE_N-1。接著,控制器160將相應於目前之區段S_N-1的反序欄RSE_N-1之共用指標CIX_N-1,寫入區段S_N所相應之反序欄RSE_N。接著,控制器160將非頻繁頭指標LRU_HIX定義為目前區段S_N-1之共用指標CIX_N-1,將非頻繁尾指標LRU_TIX維持在共用指標CIX_N,並且維持頻繁頭指標FR_HIX與頻繁尾指標FR_TIX之值。更新後之預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、非頻繁頭指標LRU_HIX以及非頻繁尾指標LRU_TIX如第13圖所示。最後,控制器160讀取儲存於預取區域CA之資料鏈結關係集合TS_8以執行所接收到之寫入命令以及讀取命令。值得注意的是,由於順序欄SE_N-1以及反序欄RSE_N-1與具有非頻繁資料鏈結關係集合TS_8之區段S_N-1具有相同之共用指標CIX_N-1。因此,在本實施例中,順序欄SE_N-1屬於非頻繁順序欄,反序欄RSE_N-1屬於非頻繁反序欄。 Next, in the embodiment of FIG. 12, when the controller 160 receives a read command or a write command, the controller 160 similarly finds out a read command or a write command including the read command. A data link relationship set corresponding to one of the pages specified by the command or write command. For example, in this embodiment, a data link relationship set corresponding to one of the pages specified by the read command or the write command is TS_8. Next, the controller 160 determines whether the data link relationship set TS_8 has been loaded into the prefetch area CA according to whether a set index corresponding to the data link relationship set TS_8 exists in the prefetch area correspondence table SMR_TB. For example, the set index of the data link relationship set TS_8 is 0xBB. As shown in FIG. 12, the prefetch area CA is only written into the data link relationship set TS_2, and only the section corresponding column SMR_N in the prefetch area correspondence table SMR_TB is 0xAA, and the others are 0xFFFF. Similar to the embodiment in FIG. 5, the controller 160 determines that the set index 0xBB of the data link relationship set TS_8 does not exist in the prefetch area correspondence table SMR_TB, and selects a blank section S_N-1. Then, the controller 160 reads the data link relationship set TS_8 from the data link relationship table TB1 in the flash memory 180 to load the data link relationship set TS_8 into the selected blank section S_N-1. Next, the controller 160 updates the prefetch area correspondence table SMR_TB, the sequence table SE_TB, the reverse sequence table RSE_TB, the infrequent indicator group, and the frequent indicator group to record the current state of the prefetch area CA. It is worth noting that because the data link relationship set TS_8 is newly loaded data, the data link relationship set TS_8 belongs to the infrequent data link relationship set. Therefore, as shown in FIG. 12, the controller 160 obtains a section S_N to which the last infrequent data link relationship set TS_2 read in the prefetch area CA according to the infrequent header index LRU_HIX, and changes the area The common index CIX_N of the sequence column SE_N corresponding to the segment S_N is written into the sequence column SE_N-1 corresponding to the current section S_N-1. Next, the controller 160 writes the common index CIX_N-1 corresponding to the reverse sequence column RSE_N-1 of the current sector S_N-1 into the reverse sequence column RSE_N corresponding to the sector S_N. Next, the controller 160 defines the infrequent head indicator LRU_HIX as the common indicator CIX_N-1 of the current section S_N-1, maintains the infrequent tail indicator LRU_TIX at the common indicator CIX_N, and maintains the frequency of the frequent head indicator FR_HIX and the frequent tail indicator FR_TIX. value. The updated prefetch area correspondence table SMR_TB, sequence table SE_TB, reverse sequence table RSE_TB, infrequent header indicator LRU_HIX, and infrequent tail indicator LRU_TIX are shown in FIG. 13. Finally, the controller 160 reads the data link relationship set TS_8 stored in the prefetch area CA to execute the received write command and read command. It is worth noting that, since the sequence column SE_N-1 and the reverse sequence column RSE_N-1 and the section S_N-1 having the infrequent data link relationship set TS_8 have the same common index CIX_N-1. Therefore, in this embodiment, the order column SE_N-1 belongs to the infrequent order column, and the reverse order column RSE_N-1 belongs to the infrequent order column.

假設控制器160陸續接收到相應於新的資料鏈結關係集合的寫入命令以及讀取命令,控制器160則重複上述第 12圖轉換到第13圖的步驟,將資料鏈結關係集合依序寫入S_N-2~S_0中,如第14圖所示。換言之,控制器160重複執行載入程序,並且寫滿所有預取區域CA。值得注意的是,在本實施例中,由於順序表SE_TB以及反序表RSE_TB的初始值即為特定值(0xFFFF),因此在載入程序中不需要再將特定值寫入目前區段所相應之反序欄以及預取區域CA中最久未被讀取之區段所相應之順序欄中。在其他實施例中,若順序表SE_TB以及反序表RSE_TB的與所設定之特定值不同,控制器160則需要在載入程序的最後一個步驟裡將特定值寫入目前區段所相應之反序欄以及預取區域CA中最久未被讀取之區段所相應之順序欄中。值得注意的是,在上述過程中,由於都沒有接收到任何需要讀取已上載至預取區域CA中之資料鏈結關係集合,故頻繁頭指標FR_HIX以及頻繁尾指標FR_TIX皆維持不變。另外,在第14圖之實施例中,所有之順序欄SE_0~SE_N皆屬於非頻繁順序欄,所有反序欄RSE_0~RSE_N皆屬於非頻繁反序欄。關於頻繁資料鏈結集合之方法,請參考下述之說明。另外,關於非頻繁資料鏈結集合之更新程序,可將非頻繁頭指標LRU_HIX視作頭指標HIX並將非頻繁尾指標LRU_TIX視作尾指標TIX後參考第7A~8圖之說明,其中頻繁頭指標FR_HIX以及頻繁尾指標FR_TIX維持不變。 Assuming that the controller 160 successively receives a write command and a read command corresponding to the new data link relationship set, the controller 160 repeats the above steps of converting from FIG. 12 to FIG. 13 and sequentially sets the data link relationship set. Write to S_N-2 ~ S_0, as shown in Figure 14. In other words, the controller 160 repeatedly executes the loading procedure and fills all the prefetch areas CA. It is worth noting that in this embodiment, since the initial value of the sequence table SE_TB and the reverse sequence table RSE_TB is a specific value (0xFFFF), there is no need to write the specific value into the corresponding section in the loading program. The reverse order column and the order column corresponding to the most recently unread section in the prefetch area CA. In other embodiments, if the sequence table SE_TB and the reverse sequence table RSE_TB are different from the specified specific value, the controller 160 needs to write the specific value to the corresponding inverse of the current section in the last step of the loading procedure. The sequence column and the sequence column corresponding to the least recently read segment in the prefetch area CA. It is worth noting that in the above process, since no data link relationship set that has been uploaded to the prefetch area CA needs to be read, the frequent head indicator FR_HIX and the frequent tail indicator FR_TIX remain unchanged. In addition, in the embodiment of FIG. 14, all the order columns SE_0 ~ SE_N belong to the infrequent order column, and all the reverse order columns RSE_0 to RSE_N belong to the infrequent order column. For the method of frequent data link collection, please refer to the following description. In addition, regarding the update procedure of the infrequent data link set, the infrequent head indicator LRU_HIX can be regarded as the head indicator HIX, and the infrequent tail indicator LRU_TIX can be regarded as the tail indicator TIX. Refer to the description of Figs. The indicator FR_HIX and the frequent tail indicator FR_TIX remain unchanged.

接著,以下為更新程序的說明。在第14圖的實施例中,當控制器160接收到一讀取命令或者一寫入命令時,控制器160同樣地根據所接收之讀取命令或者寫入命令,找出包括讀取命令或者寫入命令所指定之頁面之一對應關係的一資 料鏈結關係集合。舉例而言,在本實施例中,讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合為TS_12。接著,控制器160根據預取區域對應表SMR_TB中是否存在相應於資料鏈結關係集合TS_12的集合指標0xABC,判斷資料鏈結關係集合TS_12是否已被載入預取區域CA。在本實施例中,如第14圖所示,資料鏈結關係集合TS_12之集合指標0xABC已存在於預取區域對應表SMR_TB中之區域對應欄SMR_3之中。因此,在本實施例中,控制器160判斷資料鏈結關係集合TS_12的集合指標0xABC存在於預取區域對應表SMR_TB中。換言之,控制器160根據資料鏈結關係集合TS_12的集合指標0xABC存在於預取區域對應表SMR_TB中,判斷預取區域CA中已具有資料鏈結關係集合TS_12的資料,其中具有資料鏈結關係集合TS_12之區段S_3為目前區段。由於資料鏈結關係集合TS_12已被上載至預取區域CA。換言之,在預取區域CA中之資料鏈結關係集合TS_12被讀取之次數已達到既定值”1”。因此,在本實施例中,資料鏈結關係集合TS_12屬於頻率資料鏈結關係集合。接著,控制器160更新預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、非頻率指標組以及頻率指標組,以記錄目前預取區域CA的狀態。如第14圖所示,控制器160讀取目前區段S_3之順序欄SE_3,以獲得相應於在目前區段S_3之前一個被寫入之區段為區段S_4。接著,控制器160將相應於目前區段S_3之反序欄RSE_3中所儲存之共用指標CIX_2,寫入相應於區段S_4之反序欄RSE_4。換言之,控制器160將原本指向反序欄RSE_3之反序欄RSE_4,改指向反序欄 RSE_2。接著,控制器160根據目前區段S_3之共用指標CIX_3,讀取反序表RSE_TB中相應於目前區段S_3之反序欄RSE_3中的值,並且根據反序欄RSE_3中之共用指標CIX_2找到在目前區段S_3之後下一個被讀取之區段S_2之共用指標CIX_2。接著,控制器160在相應於區段S_2之順序欄SE_2中寫入目前區段S_2所相應之順序欄SE_2中所儲存之共用指標CIX_4。換言之,控制器160將原本指向順序欄SE_3之順序欄SE_2,改指向順序欄SE_4。值得注意的是,藉由將原本指向順序欄SE_3之順序欄SE_2改指向順序欄SE_4以及將原本指向反序欄RSE_3之反序欄RSE_4改指向反序欄RSE_2的步驟,順序欄SE_3以及反序欄RSE_3已脫離了非頻繁之系統。換言之,順序表SE_TB以及反序表RSE_TB中所紀錄之非頻繁資料鏈結關係集合被讀取的順序已不包括順序欄SE_3以及反序欄RSE_3所相應之資料鏈結關係集合TS_12。接著,控制器160將特定值(0xFFFF)寫入與目前區段S_3具有相同共用指標CIX_3之順序欄SE_3,以作為順序表SE_TB中頻繁順序欄之起始,並且將特定值(0xFFFF)寫入與目前區段S_3具有相同共用指標CIX_3之反序欄RSE_3,以作為順序表RSE_TB中頻繁順序欄之起始。最後控制器160,將頻繁頭指標FR_HIX定義為目前區段S_3之共用指標CIX_3,將頻繁尾指標FR_TIX定義為目前區段S_3之共用指標CIX_3並且維持非頻繁指標組之數值。更新後之預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、頻繁指標組以及非頻繁指標組,如第15圖所示。接著,控制器160根據用以儲存集合指標0xABC的區段對應欄SMR_3之共用指標CIX_3,讀 取預取區域CA中所相應之區段S_3,以獲得資料鏈結關係集合TS_12。換言之,控制器160讀取儲存於預取區域CA之資料鏈結關係集合TS_12以執行所接收到之寫入命令以及讀取命令。值得注意的是,由於順序欄SE_3以及反序欄RSE_3與具有非頻繁資料鏈結關係集合TS_12之區段S_3具有相同之共用指標CIX_3。因此,在本實施例中,順序欄SE_3屬於非頻繁順序欄,反序欄RSE_3屬於非頻繁反序欄。 The following is a description of the update procedure. In the embodiment of FIG. 14, when the controller 160 receives a read command or a write command, the controller 160 similarly finds out whether the read command or the write command includes the read command or the write command. A data link relationship set corresponding to one of the pages specified by the write command. For example, in this embodiment, a data link relationship set corresponding to one of the pages specified by the read command or the write command is TS_12. Next, the controller 160 determines whether the data link relationship set TS_12 has been loaded into the prefetch area CA according to whether a set index 0xABC corresponding to the data link relationship set TS_12 exists in the prefetch area correspondence table SMR_TB. In this embodiment, as shown in FIG. 14, the set index 0xABC of the data link relationship set TS_12 already exists in the region corresponding column SMR_3 in the prefetched region corresponding table SMR_TB. Therefore, in this embodiment, the controller 160 determines that the set index 0xABC of the data link relationship set TS_12 exists in the prefetched region correspondence table SMR_TB. In other words, the controller 160 judges that the data of the data link relationship set TS_12 already exists in the prefetch area CA according to the set index 0xABC of the data link relationship set TS_12 in the prefetch area correspondence table SMR_TB, which has the data link relationship set Section S_3 of TS_12 is the current section. Due to the data link relationship set TS_12 has been uploaded to the prefetch area CA. In other words, the number of times the data link relationship set TS_12 in the prefetch area CA has been read has reached the predetermined value "1". Therefore, in this embodiment, the data link relationship set TS_12 belongs to the frequency data link relationship set. Next, the controller 160 updates the prefetch area correspondence table SMR_TB, the sequence table SE_TB, the reverse sequence table RSE_TB, the non-frequency indicator group, and the frequency indicator group to record the current state of the prefetch area CA. As shown in FIG. 14, the controller 160 reads the sequence column SE_3 of the current sector S_3 to obtain a sector corresponding to a sector written before the current sector S_3 as the sector S_4. Next, the controller 160 writes the shared index CIX_2 stored in the reverse order column RSE_3 corresponding to the current section S_3 into the reverse order column RSE_4 corresponding to the section S_4. In other words, the controller 160 points originally to the reverse-order column RSE_4 of the reverse-order column RSE_3, and instead points to the reverse-order column RSE_2. Next, the controller 160 reads the value in the reverse order table RSE_TB corresponding to the current section S_3 in the reverse order column RSE_3 according to the common index CIX_3 of the current section S_3, and finds the value in the reverse order column RSE_3. The common index CIX_2 of the next sector S_2 read after the current sector S_3. Next, the controller 160 writes the common index CIX_4 stored in the sequence column SE_2 corresponding to the current sector S_2 into the sequence column SE_2 corresponding to the sector S_2. In other words, the controller 160 points originally to the sequence column SE_2 of the sequence column SE_3, and instead points to the sequence column SE_4. It is worth noting that by changing the sequence column SE_2 originally pointing to the sequence column SE_3 to the sequence column SE_4 and the sequence column RSE_4 originally pointing to the reverse sequence column RSE_3 to the reverse sequence column RSE_2, the sequence column SE_3 and the reverse sequence Column RSE_3 has been removed from the infrequent system. In other words, the order of reading the infrequent data link relationship set recorded in the sequence table SE_TB and the reverse sequence table RSE_TB does not include the data link relationship set TS_12 corresponding to the sequence column SE_3 and the reverse sequence column RSE_3. Next, the controller 160 writes the specific value (0xFFFF) into the sequence column SE_3 having the same common index CIX_3 as the current section S_3 as the start of the frequent sequence column in the sequence table SE_TB, and writes the specific value (0xFFFF) The reverse sequence column RSE_3, which has the same common index CIX_3 as the current section S_3, is used as the start of the frequent sequence column in the sequence table RSE_TB. Finally, the controller 160 defines the frequent head indicator FR_HIX as the common indicator CIX_3 of the current section S_3, and defines the frequent tail indicator FR_TIX as the common indicator CIX_3 of the current section S_3 and maintains the value of the non-frequent indicator group. The updated prefetch area correspondence table SMR_TB, sequence table SE_TB, reverse sequence table RSE_TB, frequent indicator group and infrequent indicator group, as shown in FIG. 15. Next, the controller 160 reads the corresponding segment S_3 in the prefetch area CA according to the common index CIX_3 of the segment corresponding column SMR_3 for storing the set index 0xABC to obtain the data link relationship set TS_12. In other words, the controller 160 reads the data link relationship set TS_12 stored in the prefetch area CA to execute the received write command and read command. It is worth noting that, because the sequence column SE_3 and the reverse sequence column RSE_3 have the same common index CIX_3 as the section S_3 with the infrequent data link relationship set TS_12. Therefore, in this embodiment, the order column SE_3 belongs to the infrequent order column, and the reverse order column RSE_3 belongs to the infrequent order column.

接著,在第15圖的實施例中,當控制器160接收到一讀取命令或者一寫入命令時,控制器160同樣地根據所接收之讀取命令或者寫入命令,找出包括讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合。舉例而言,在本實施例中,讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合為TS_10。接著,控制器160根據預取區域對應表SMR_TB中是否存在相應於資料鏈結關係集合TS_10的集合指標0xCC,判斷資料鏈結關係集合TS_10是否已被載入預取區域CA。在本實施例中,如第15圖所示,資料鏈結關係集合TS_10之集合指標0xCC已存在於預取區域對應表SMR_TB中之區域對應欄SMR_N-2之中。因此,在本實施例中,控制器160判斷資料鏈結關係集合TS_10的集合指標0xCC存在於預取區域對應表SMR_TB中。換言之,控制器160根據資料鏈結關係集合TS_10的集合指標0xCC存在於預取區域對應表SMR_TB中,判斷預取區域CA中已具有資料鏈結關係集合TS_10的資料,其中具有資料鏈結關係集合TS_10之區段S_N-2為目前區段。由於資料鏈結關係集合TS_10已被上載至預取區 域CA。換言之,在預取區域CA中之資料鏈結關係集合TS_10被讀取之次數已達到既定值”1”。因此,在本實施例中,資料鏈結關係集合TS_10屬於頻率資料鏈結關係集合。接著,控制器160更新預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、非頻率指標組以及頻率指標組,以記錄目前預取區域CA的狀態。如第15圖所示,控制器160讀取目前區段S_N-2之順序欄SE_N-2,以獲得相應於在目前區段S_N-2之前一個被寫入之區段為區段S_N-1。接著,控制器160將相應於目前區段S_N-2之反序欄RSE_N-2中所儲存之共用指標CIX_N-3,寫入相應於區段S_N-1之反序欄RSE_N-1。換言之,控制器160將原本指向反序欄RSE_N-2之反序欄RSE_N-1,改指向反序欄RSE_N-3。接著,控制器160根據目前區段S_N-2之共用指標CIX_N-2,讀取反序表RSE_TB中相應於目前區段S_N-2之反序欄RSE_N-2中的值,並且根據反序欄RSE_N-2中之共用指標CIX_N-3找到在目前區段S_N-2之後下一個被讀取之區段S_N-3之共用指標CIX_N-3。接著,控制器160在相應於區段S_N-3之順序欄SE_N-3中寫入目前區段S_N-2所相應之順序欄SE_N-2中所儲存之共用指標CIX_N-1。換言之,控制器160將原本指向順序欄SE_N-2之順序欄SE_N-3,改指向順序欄SE_N-1。值得注意的是,藉由將原本指向順序欄SE_N-2之順序欄SE_N-3改指向順序欄SE_N-1以及將原本指向反序欄RSE_N-2之反序欄RSE_N-1改指向反序欄RSE_N-3的步驟,順序欄SE_N-2以及反序欄RSE_N-2已脫離了非頻繁之系統。換言之,順序表SE_TB以及反序表RSE_TB中所紀錄之非頻繁資料 鏈結關係集合被讀取的順序已不包括順序欄SE_3以及反序欄RSE_3所相應之資料鏈結關係集合TS_12。接著,控制器160根據頻繁頭指標FR_HIX,獲得在預取區域CA中最後一個被讀取之頻繁資料鏈結關係集合TS_12所屬之一區段S_3,並且將區段S_3所相應之順序欄SE_3的共用指標CIX_3,寫入相應於目前之區段S_N-2的順序欄SE_N-2。接著,控制器160根據頻繁尾指標FR_TIX,獲得在預取區域CA中最久未被讀取之頻繁資料鏈結關係集合TS_12所屬之一區段S_3,並將相應於目前之區段S_N-2的反序欄RSE_N-2之共用指標CIX_N-2,寫入區段S_3所相應之反序欄RSE_3中。值得注意的是,在本實施例中,預取區域CA裡只有一個頻繁資料鏈結關係TS_12,故頻繁資料鏈結關係TS_12為最後一個也是最久未被讀取之頻繁資料鏈結關係。最後控制器160,將頻繁頭指標FR_HIX定義為目前區段S_N-2之共用指標CIX_N-2,將頻繁尾指標TIX維持在共用指標CIX_3,並且將一特定值寫入目前區段S_N-2所相應之反序欄RSE_N-2中。另外,控制器160亦維持非頻繁指標組中之數值。更新後之預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、頻繁指標組以及非頻繁指標組,如第16圖所示。接著,控制器160根據用以儲存集合指標0xCC的區段對應欄SMR_N-2之共用指標CIX_N-2,讀取預取區域CA中所相應之區段S_N-2,以獲得資料鏈結關係集合TS_10。換言之,控制器160讀取儲存於預取區域CA之資料鏈結關係集合TS_10以執行所接收到之寫入命令以及讀取命令。值得注意的是,由於順序欄SE_N-2以及反序欄RSE_N-2與具有非頻繁資料鏈結關係集合 TS_10之區段S_N-2具有相同之共用指標CIX_N-2。因此,在本實施例中,順序欄SE_N-2屬於非頻繁順序欄,反序欄RSE_N-2屬於非頻繁反序欄。 Next, in the embodiment of FIG. 15, when the controller 160 receives a read command or a write command, the controller 160 similarly finds out that the read includes a read command according to the received read command or write command. A data link relationship set corresponding to one of the pages specified by the command or write command. For example, in this embodiment, a data link relationship set corresponding to one of the pages specified by the read command or the write command is TS_10. Next, the controller 160 determines whether the data link relationship set TS_10 has been loaded into the prefetch area CA according to whether a set index 0xCC corresponding to the data link relationship set TS_10 exists in the prefetch area correspondence table SMR_TB. In this embodiment, as shown in FIG. 15, the set index 0xCC of the data link relationship set TS_10 already exists in the region corresponding column SMR_N-2 in the prefetch region corresponding table SMR_TB. Therefore, in this embodiment, the controller 160 determines that the set index 0xCC of the data link relationship set TS_10 exists in the prefetched region correspondence table SMR_TB. In other words, the controller 160 judges that the data of the data link relationship set TS_10 already exists in the prefetch area CA according to the set index 0xCC of the data link relationship set TS_10 in the prefetch area correspondence table SMR_TB, and the data link relationship set The section S_N-2 of TS_10 is the current section. The collection TS_10 has been uploaded to the prefetch area CA due to the data link relationship. In other words, the number of times the data link relationship set TS_10 in the prefetch area CA has been read has reached the predetermined value "1". Therefore, in this embodiment, the data link relationship set TS_10 belongs to the frequency data link relationship set. Next, the controller 160 updates the prefetch area correspondence table SMR_TB, the sequence table SE_TB, the reverse sequence table RSE_TB, the non-frequency indicator group, and the frequency indicator group to record the current state of the prefetch area CA. As shown in FIG. 15, the controller 160 reads the sequence column SE_N-2 of the current section S_N-2 to obtain a section corresponding to the one written before the current section S_N-2 as the section S_N-1. . Next, the controller 160 writes the shared index CIX_N-3 stored in the reverse order column RSE_N-2 corresponding to the current section S_N-2 into the reverse order column RSE_N-1 corresponding to the section S_N-1. In other words, the controller 160 points originally to the reverse-order column RSE_N-1 of the reverse-order column RSE_N-2, and instead points to the reverse-order column RSE_N-3. Next, the controller 160 reads the value in the reverse order column RSE_N-2 in the reverse order table RSE_TB corresponding to the current sector S_N-2 according to the common index CIX_N-2 of the current sector S_N-2, and according to the reverse order column The common indicator CIX_N-3 in RSE_N-2 finds the common indicator CIX_N-3 of the sector S_N-3 that is read next after the current sector S_N-2. Next, the controller 160 writes the shared index CIX_N-1 stored in the sequence column SE_N-2 corresponding to the current sector S_N-2 into the sequence column SE_N-3 corresponding to the sector S_N-3. In other words, the controller 160 points the sequence column SE_N-3, which is originally the sequence column SE_N-2, to the sequence column SE_N-1. It is worth noting that by changing the original order column SE_N-3 to the order column SE_N-3 to the order column SE_N-1 and the original order column RSE_N-2 to the reverse order column RSE_N-1 to the reverse order column The steps of RSE_N-3, the sequence column SE_N-2 and the reverse sequence column RSE_N-2 have been removed from the infrequent system. In other words, the order of reading the infrequent data link relationship sets recorded in the sequence table SE_TB and the reverse sequence table RSE_TB does not include the data link relationship set TS_12 corresponding to the sequence column SE_3 and the reverse sequence column RSE_3. Next, the controller 160 obtains a segment S_3 to which the last frequently read data link relationship set TS_12 belongs in the prefetch area CA according to the frequent header index FR_HIX, and sets the sequence column SE_3 corresponding to the segment S_3. The common indicator CIX_3 is written in the sequence column SE_N-2 corresponding to the current section S_N-2. Next, the controller 160 obtains a segment S_3 to which the frequent data link relationship set TS_12 belongs which has not been read for the longest time in the prefetch area CA according to the frequent tail index FR_TIX, and will correspond to the current segment S_N-2. The common index CIX_N-2 of the reverse sequence column RSE_N-2 is written in the reverse sequence column RSE_3 corresponding to the sector S_3. It is worth noting that in this embodiment, there is only one frequent data link relationship TS_12 in the prefetch area CA, so the frequent data link relationship TS_12 is the last and most frequently read data link relationship that has not been read for a long time. Finally, the controller 160 defines the frequent head indicator FR_HIX as the common indicator CIX_N-2 of the current section S_N-2, maintains the frequent tail indicator TIX at the common indicator CIX_3, and writes a specific value into the current section S_N-2. Corresponding reverse order column RSE_N-2. In addition, the controller 160 also maintains the values in the infrequent indicator group. The updated prefetch area correspondence table SMR_TB, sequence table SE_TB, reverse sequence table RSE_TB, frequent indicator group and infrequent indicator group, as shown in FIG. 16. Next, the controller 160 reads the corresponding segment S_N-2 in the prefetch area CA according to the common index CIX_N-2 of the segment corresponding column SMR_N-2 for storing the collection index 0xCC to obtain the data link relationship set TS_10. In other words, the controller 160 reads the data link relationship set TS_10 stored in the prefetch area CA to execute the received write command and read command. It is worth noting that since the sequence column SE_N-2 and the reverse sequence column RSE_N-2 and the section S_N-2 with the infrequent data link relationship set TS_10 have the same common index CIX_N-2. Therefore, in this embodiment, the order column SE_N-2 belongs to the infrequent order column, and the reverse order column RSE_N-2 belongs to the infrequent order column.

接著,在第16圖的實施例中,當控制器160接收到一讀取命令或者一寫入命令時,控制器160同樣地根據所接收之讀取命令或者寫入命令,找出包括讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合。舉例而言,在本實施例中,讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合為TS_77。接著,控制器160根據預取區域對應表SMR_TB中是否存在相應於資料鏈結關係集合TS_77的集合指標0x333,判斷資料鏈結關係集合TS_77是否已被載入預取區域CA。在本實施例中,假設預取區域CA並沒有資料鏈結關係集合TS_77之資料,故集合指標0x333也不存在於預取區域對應表SMR_TB中之任何一個區域對應欄SMR_0~SMR_N之中。控制器160根據資料鏈結關係集合TS_77的集合指標0x333不存在於預取區域對應表SMR_TB中,判斷預取區域CA中不具有資料鏈結關係集合TS_77。接著,控制器160判斷預取區域CA是否具有空白之區段。如第16圖所示,預取區域CA之區段S_0~S_N皆不是空白的。接著,控制器160判斷非頻繁尾指標LRU_TIX是否為共用指標CIX_0~CIX_N中之任一者。如第16圖所示,非頻繁尾指標LRU_TIX為共用指標CIX_N。接著,控制器160根據非頻繁尾指標LRU_TIX判斷預取區域CA中最久未被讀取之非頻繁資料鏈結關係集合,以將資料鏈結關係集合TS_77的資料寫入預取區域CA中最久未被 讀取之非頻繁資料鏈結關係集合所屬的區段。如第16圖所示,控制器160根據非頻繁尾指標LRU_TIX中之共用指標CIX_N,判斷預取區域CA中最久未被讀取之非頻繁資料鏈結關係集合為資料鏈結關係集合TS_2,並且根據共用指標CIX_N獲得具有最久未被讀取之非頻繁資料鏈結關係集合的區段為區段S_N。接著,控制器160自快閃記憶體180中之資料鏈結關係表TB1讀取資料鏈結關係集合TS_77,以將資料鏈結關係集合TS_77載入所獲得之區段S_N,以取代原本很久未被讀取之非頻繁資料鏈結關係集合TS_2。接著,控制器160更新預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、頻繁指標組以及非頻繁指標組,以記錄目前預取區域CA的狀態。首先,控制器160將相應於資料鏈結關係集合TS_77之集合指標0x333,寫入預取區域對應表SMR_TB中相應於區段S_N的區段對應欄SMR_N。如第16圖所示,控制器160根據非頻繁頭指標LRU_HIX,獲得在預取區域CA中最後一個被讀取之非頻繁資料鏈結關係集合TS_1所屬之一區段S_0,並且將區段S_0所相應之順序欄SE_0的共用指標CIX_0,寫入相應於目前之區段S_N的順序欄SE_N。接著,控制器160將相應於目前之區段S_N的反序欄RSE_N之共用指標CIX_N,寫入區段S_0所相應之反序欄RSE_0。接著,控制器160讀取目前之區段S_N的反序欄RSE_N,以獲得在目前之區段S_N之後下一個被讀取之區段S_N-1的共用指標CIX_N-1。接著,控制器160將非頻繁頭指標LRU_HIX定義為目前區段S_N之共用指標CIX_N,將非頻繁尾指標LRU_TIX定義為在目前之區段S_N之後下一個被讀取之區 段S_N-1的共用指標CIX_N-1,並且維持頻繁指標組之數值。最後,控制器160將特定值寫入在目前之區段S_N之後下一個被讀取之區段S_N-1所相應的順序欄SE_N-1中,以及將特定值寫入相應於目前區段S_N之反序欄RSE_N中。更新後之預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、非頻繁指標組以及頻繁指標組如第17圖所示。最後,控制器160讀取儲存於預取區域CA之資料鏈結關係集合TS_77以執行所接收到之寫入命令以及讀取命令。 Next, in the embodiment of FIG. 16, when the controller 160 receives a read command or a write command, the controller 160 similarly finds out that the read includes a read command according to the received read command or write command. A data link relationship set corresponding to one of the pages specified by the command or write command. For example, in this embodiment, a data link relationship set corresponding to one of the pages specified by the read command or the write command is TS_77. Next, the controller 160 determines whether the data link relationship set TS_77 has been loaded into the prefetch area CA according to whether a set index 0x333 corresponding to the data link relationship set TS_77 exists in the prefetch area correspondence table SMR_TB. In this embodiment, it is assumed that the prefetch area CA does not have data of the data link relationship set TS_77, so the set index 0x333 does not exist in any of the area corresponding columns SMR_0 ~ SMR_N in the prefetch area corresponding table SMR_TB. The controller 160 determines that there is no data link relationship set TS_77 in the prefetch area CA according to the set index 0x333 of the data link relationship set TS_77 that does not exist in the prefetch area correspondence table SMR_TB. Next, the controller 160 determines whether the prefetch area CA has a blank sector. As shown in FIG. 16, the sections S_0 ~ S_N of the prefetch area CA are not blank. Next, the controller 160 determines whether the infrequent tail indicator LRU_TIX is any one of the common indicators CIX_0 to CIX_N. As shown in Figure 16, the non-frequent tail indicator LRU_TIX is the common indicator CIX_N. Next, the controller 160 judges the infrequent data link relationship set that has not been read for the longest time in the prefetch area CA according to the infrequent tail index LRU_TIX, so as to write the data of the data link relationship set TS_77 into the longest time in the prefetch area CA The section to which the infrequent data link relationship set being read belongs. As shown in FIG. 16, the controller 160 determines the infrequent data link relationship set in the prefetch area CA that has not been read for the longest time is the data link relationship set TS_2 according to the common index CIX_N in the infrequent tail index LRU_TIX, The segment having the infrequent data link relationship set that has not been read for the longest time according to the common index CIX_N is the segment S_N. Next, the controller 160 reads the data link relationship set TS_77 from the data link relationship table TB1 in the flash memory 180 to load the data link relationship set TS_77 into the obtained section S_N to replace the original long-term The read infrequent data link relationship set TS_2. Next, the controller 160 updates the prefetch area correspondence table SMR_TB, the order table SE_TB, the reverse order table RSE_TB, the frequent indicator group, and the infrequent indicator group to record the current state of the prefetch area CA. First, the controller 160 writes a set index 0x333 corresponding to the data link relationship set TS_77 into a section corresponding column SMR_N corresponding to the section S_N in the prefetch area corresponding table SMR_TB. As shown in FIG. 16, the controller 160 obtains a segment S_0 to which the infrequent data link relationship set TS_1 last read in the prefetch area CA according to the infrequent header index LRU_HIX, and changes the segment S_0 The corresponding common index CIX_0 of the sequence column SE_0 is written in the sequence column SE_N corresponding to the current sector S_N. Next, the controller 160 writes the common index CIX_N corresponding to the reverse column RSE_N of the current sector S_N into the reverse sequence column RSE_0 corresponding to the sector S_0. Next, the controller 160 reads the reverse order column RSE_N of the current section S_N to obtain the common index CIX_N-1 of the next section S_N-1 that is read after the current section S_N. Next, the controller 160 defines the infrequent head indicator LRU_HIX as the common indicator CIX_N of the current sector S_N, and the infrequent tail index LRU_TIX as the common of the next sector S_N-1 that is read after the current sector S_N The indicator CIX_N-1, and the value of the frequent indicator group is maintained. Finally, the controller 160 writes the specific value into the sequence column SE_N-1 corresponding to the next read section S_N-1 after the current section S_N, and writes the specific value into the corresponding section S_N. In the reverse order column RSE_N. The updated prefetch area correspondence table SMR_TB, sequence table SE_TB, reverse sequence table RSE_TB, infrequent indicator group and frequent indicator group are shown in FIG. 17. Finally, the controller 160 reads the data link relationship set TS_77 stored in the prefetch area CA to execute the received write command and read command.

假設控制器160陸續接收到相應於已上載於預取區域CA的頻繁資料鏈結關係集合的寫入命令以及讀取命令,控制器160則重複上述第15圖轉換到第16圖的步驟,以更新順序表SE_TB、反序表RSE_TB以及頻繁指標組,直到預取區域CA中所有之資料皆為頻繁資料鏈結關係集合,如第18圖所示。值得注意的是,在預取區域CA僅剩下最後一個非頻繁資料鏈結關係集合TS_8時,非頻繁資料鏈結關係集合TS_8所相應之順序欄SE_N-1以及反敘欄RSE_N-1皆會為特定值(0xFFFF)。換言之,當控制器160要對非頻繁資料鏈結關係集合TS_8進行讀取並且發現其所相應之順序欄SE_N-1以及反敘欄RSE_N-1皆為特定值(0xFFFF)時,控制器160判斷即將轉換為頻繁資料鏈結關係集合之非頻繁資料鏈結關係集合TS_8為最後一個非頻繁資料鏈結關係集合。因此,控制器160會在資料鏈結關係集合TS_8所相應之資料更新至頻繁資料系統後,將非頻繁頭指標LRU_HIX以及非頻繁尾指標LRU_TIX中之共用指標刪除,如第18圖所示。 Assume that the controller 160 successively receives the write command and the read command corresponding to the frequent data link relationship set that has been uploaded to the prefetch area CA. The controller 160 repeats the steps of the above-mentioned conversion from FIG. 15 to FIG. Update the sequence table SE_TB, the reverse sequence table RSE_TB, and the frequent indicator group until all the data in the prefetch area CA are frequent data link relationship sets, as shown in FIG. 18. It is worth noting that when the last non-frequent data link relationship set TS_8 is left in the pre-fetch area CA, the order columns SE_N-1 and the counter-listing columns RSE_N-1 corresponding to the infrequent data link relationship set TS_8 will both Is a specific value (0xFFFF). In other words, when the controller 160 reads the infrequent data link relationship set TS_8 and finds that the corresponding sequence column SE_N-1 and the reverse column RSE_N-1 are both specific values (0xFFFF), the controller 160 judges The infrequent data link relationship set TS_8, which is about to be converted into a frequent data link relationship set, is the last infrequent data link relationship set. Therefore, the controller 160 deletes the common indicators in the infrequent head indicator LRU_HIX and the infrequent tail indicator LRU_TIX after the corresponding data of the data link relationship set TS_8 is updated to the frequent data system, as shown in FIG. 18.

接著,在第18圖的實施例中,當控制器160接收到一讀取命令或者一寫入命令時,控制器160同樣地根據所接收之讀取命令或者寫入命令,找出包括讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合。舉例而言,在本實施例中,讀取命令或者寫入命令所指定之頁面之一對應關係的一資料鏈結關係集合為TS_88。接著,控制器160根據預取區域對應表SMR_TB中是否存在相應於資料鏈結關係集合TS_88的集合指標0x444,判斷資料鏈結關係集合TS_88是否已被載入預取區域CA。在本實施例中,預取區域CA並沒有資料鏈結關係集合TS_88之資料,故集合指標0x444也不存在於預取區域對應表SMR_TB中之任何一個區域對應欄SMR_0~SMR_N之中。控制器160根據資料鏈結關係集合TS_88的集合指標0x444不存在於預取區域對應表SMR_TB中,判斷預取區域CA中不具有資料鏈結關係集合TS_88。接著,控制器160判斷預取區域CA是否具有空白之區段。如第18圖所示,預取區域CA之區段S_0~S_N皆不是空白的。接著,控制器160判斷非頻繁尾指標LRU_TIX是否為共用指標CIX_0~CIX_N中之任一者。如第18圖所示,非頻繁尾指標LRU_TIX為空白或者預設值。因此,控制器160將頻繁尾指標FR_TIX中之共用指標CIX_N-1寫入非頻繁尾指標LRU_TIX中,將頻繁頭指標FR_HIX中之共用指標CIX_N-2寫入頻繁尾指標LRU_HIX中,並且刪除頻繁尾指標FR_TIX以及頻繁頭指標FR_HIX中之共用指標,如第19圖所示。接著,控制器160根據非頻繁尾指標LRU_TIX判斷預取區域CA中最久未被讀取之非頻繁資料鏈結關係集合,以將資料 鏈結關係集合TS_88的資料寫入預取區域CA中最久未被讀取之非頻繁資料鏈結關係集合所屬的區段。如第19圖所示,控制器160根據非頻繁尾指標LRU_TIX中之共用指標CIX_N-1,判斷預取區域CA中最久未被讀取之非頻繁資料鏈結關係集合為資料鏈結關係集合TS_8,並且根據共用指標CIX_N-1獲得具有最久未被讀取之非頻繁資料鏈結關係集合的區段為區段S_N-1。接著,控制器160自快閃記憶體180中之資料鏈結關係表TB1讀取資料鏈結關係集合TS_88,以將資料鏈結關係集合TS_88載入所獲得之區段S_N-1,以取代原本很久未被讀取之非頻繁資料鏈結關係集合TS_8。接著,控制器160更新預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、頻繁指標組以及非頻繁指標組,以記錄目前預取區域CA的狀態。詳細步驟可參考第16圖以及第17圖之實施例,在此不再贅述。更新後之預取區域對應表SMR_TB、順序表SE_TB、反序表RSE_TB、非頻繁指標組以及頻繁指標組如第20圖所示。最後,控制器160讀取儲存於預取區域CA之資料鏈結關係集合TS_88以執行所接收到之寫入命令以及讀取命令。 Next, in the embodiment of FIG. 18, when the controller 160 receives a read command or a write command, the controller 160 similarly finds out a read command or a write command including the read command. A data link relationship set corresponding to one of the pages specified by the command or write command. For example, in this embodiment, a data link relationship set corresponding to one of the pages specified by the read command or the write command is TS_88. Next, the controller 160 determines whether the data link relationship set TS_88 has been loaded into the prefetch area CA according to whether a set index 0x444 corresponding to the data link relationship set TS_88 exists in the prefetch area correspondence table SMR_TB. In this embodiment, the prefetch area CA does not have data of the data link relationship set TS_88, so the set index 0x444 does not exist in any of the area corresponding columns SMR_0 ~ SMR_N in the prefetch area corresponding table SMR_TB. The controller 160 determines that there is no data link relationship set TS_88 in the prefetch area CA according to the set index 0x444 of the data link relationship set TS_88 that does not exist in the prefetch area correspondence table SMR_TB. Next, the controller 160 determines whether the prefetch area CA has a blank sector. As shown in FIG. 18, the sections S_0 ~ S_N of the prefetch area CA are not blank. Next, the controller 160 determines whether the infrequent tail indicator LRU_TIX is any one of the common indicators CIX_0 to CIX_N. As shown in Figure 18, the infrequent tail indicator LRU_TIX is blank or a preset value. Therefore, the controller 160 writes the common index CIX_N-1 in the frequent tail index FR_TIX into the non-frequent tail index LRU_TIX, writes the common index CIX_N-2 in the frequent head index FR_HIX into the frequent tail index LRU_HIX, and deletes the frequent tail The common indicators in the indicator FR_TIX and the frequent head indicator FR_HIX are shown in Figure 19. Next, the controller 160 judges the infrequent data link relationship set that has not been read for the longest time in the prefetch area CA according to the infrequent tail index LRU_TIX, so as to write the data of the data link relationship set TS_88 into the longest time in the prefetch area CA. The section to which the infrequent data link relationship set being read belongs. As shown in FIG. 19, the controller 160 determines the infrequent data link relationship set in the prefetch area CA that has not been read for the longest time according to the common index CIX_N-1 in the infrequent tail index LRU_TIX as the data link relationship set TS_8 , And according to the common index CIX_N-1, the section having the infrequent data link relationship set that has not been read the longest is the section S_N-1. Then, the controller 160 reads the data link relationship set TS_88 from the data link relationship table TB1 in the flash memory 180 to load the data link relationship set TS_88 into the obtained section S_N-1 to replace the original section S_N-1. The infrequent data link relationship set TS_8 that has not been read for a long time. Next, the controller 160 updates the prefetch area correspondence table SMR_TB, the order table SE_TB, the reverse order table RSE_TB, the frequent indicator group, and the infrequent indicator group to record the current state of the prefetch area CA. For detailed steps, reference may be made to the embodiments in FIG. 16 and FIG. 17, and details are not described herein again. The updated prefetch area correspondence table SMR_TB, sequence table SE_TB, reverse sequence table RSE_TB, infrequent indicator group and frequent indicator group are shown in FIG. 20. Finally, the controller 160 reads the data link relationship set TS_88 stored in the prefetch area CA to execute the received write command and read command.

第21圖為本發明所提供之一資料維護方法之一種實施例的流程圖。第21圖所示之資料維護方法適用於第1圖所示之資料儲存裝置140。流程開始於步驟S2100。 FIG. 21 is a flowchart of an embodiment of a data maintenance method provided by the present invention. The data maintenance method shown in FIG. 21 is applicable to the data storage device 140 shown in FIG. 1. The process starts at step S2100.

在步驟S2100中,在快閃記憶體160被上電後,控制器160根據所接收之至少一讀取命令或者至少一寫入命令,在隨機記憶體166中之一預取區域CA中,載入一資料鏈結關係表TB1中之複數資料鏈結關係集合TS_0~TS_N的一部份。 In step S2100, after the flash memory 160 is powered on, the controller 160 loads one of the prefetch areas CA in the random memory 166 according to the received at least one read command or at least one write command. Part of a plurality of data link relationship sets TS_0 ~ TS_N in a data link relationship table TB1.

接著,在步驟S2102中,控制器160根據所載入之資料鏈結關係集合的被讀取的順序以及次數,在隨機記憶體166中建立一頻率指標組以及一非頻率指標組,以維護預取區域CA中之資料。詳細而言,控制器160在隨機存取記憶體166中建立一非頻繁指標組以及一頻繁指標組,其中非頻繁指標組用以維護非頻繁資料鏈結關係集合,並且頻繁指標組用以維護被頻繁資料鏈結關係集合。在一實施例中,非頻繁指標組係由一非頻繁頭指標LRU_HIX以及一非頻繁尾指標LRU_TIX所構成,並且頻繁指標組係由一頻繁頭指標FR_HIX以及一頻繁尾指標FR_TIX所構成。非頻繁頭指標LRU_HIX為用以儲存最後一個被讀取之非頻繁資料鏈結關係集合之區段的共用指標,以指向預取區域CA中最後一個被讀取之非頻繁資料鏈結關係集合。非頻繁尾指標LRU_TIX為用以儲存最久未被讀取之非頻繁資料鏈結關係集合之區段的共用指標,以指向預取區域CA中最久未被讀取之非頻繁資料鏈結關係集合。頻繁頭指標FR_HIX為用以儲存最後一個被讀取之頻繁資料鏈結關係集合之區段的共用指標,以指向預取區域CA中最後一個被讀取之頻繁資料鏈結關係集合。頻繁尾指標FR_TIX為用以儲存最久未被讀取之頻繁資料鏈結關係集合之區段的共用指標,以指向預取區域CA中最久未被讀取之頻繁資料鏈結關係集合。 Next, in step S2102, the controller 160 establishes a frequency indicator group and a non-frequency indicator group in the random memory 166 according to the read order and number of times of the loaded data link relationship set to maintain the pre- Take the information in the area CA. In detail, the controller 160 establishes an infrequent index group and a frequent index group in the random access memory 166, wherein the infrequent index group is used to maintain an infrequent data link relationship set, and the frequent index group is used to maintain A collection of frequently linked data links. In one embodiment, the infrequent indicator group is composed of an infrequent header indicator LRU_HIX and an infrequent tail indicator LRU_TIX, and the frequent indicator group is composed of a frequent header indicator FR_HIX and a frequent tail indicator FR_TIX. The infrequent header index LRU_HIX is a shared index for storing the last read infrequent data link relationship set segment to point to the last read infrequent data link relationship set in the prefetch area CA. The infrequent tail indicator LRU_TIX is a shared indicator for storing the segments of the infrequent data link relationship set that has not been read for the longest time, and points to the infrequent data link relationship set that has been read for the longest time in the prefetch area CA. The frequent header index FR_HIX is a shared index used to store the section of the last frequently read data link relationship set read to point to the last frequently read data link relationship set read in the prefetch area CA. The frequent tail index FR_TIX is a shared index used to store the segments of the frequent data link relationship set that have not been read for the longest time, so as to point to the most frequently read data link relationship set in the prefetch area CA.

在另一實施例中,在步驟S2102中,控制器160更根據所載入之資料鏈結關係集合,建立一預取區域對應表SMR_TB、一反序表RSE_TB以及一順序表SE_TB。詳細而言,控制器160在隨機記憶體166中建立預取區域對應表SMR_TB, 以紀錄相應於預取區域CA中之資料鏈結關係集合的集合指標。控制器160在隨機記憶體166中建立反序表RSE_TB用以分別紀錄頻繁資料鏈結關係集合自預取區域CA中被讀取之反向的順序以及非頻繁資料鏈結關係集合自預取區域CA中被讀取之反向的順序。值得注意的是,在本實施例中,反序表RSE_TB中之反序欄RSE_0~RSE_N可記錄兩種順序(頻繁資料鏈結關係集合自預取區域CA中被讀取之反向的順序以及非頻繁資料鏈結關係集合自域取區域中被讀取之反向的順序)。相似地,控制器160在隨機記憶體166中建立順序表SE_TB,以分別紀錄頻繁資料鏈結關係集合自預取區域CA中被讀取之順序以及非頻繁資料鏈結關係集合自域取區域中被讀取之順序。當預取區域CA已被寫滿並且需要載入新的資料鏈結關係集合時,根據非頻繁尾指標LRU_TIX,選擇預取區域CA中之區段S_0~S_N中之一者,以將新的資料鏈結關係集合載入所選擇之區段。在新的上述資料鏈結關係集合載入所選擇之上述區段或者對舊的資料鏈結關係集合讀取後,控制器160可根據非頻繁指標組及/或頻繁指標組、反序表RSE_TB中之資料以及順序表SE_TB中之資料,更新隨機記憶體中之表以及指標,以紀錄預取區域CA中之資料狀態。 In another embodiment, in step S2102, the controller 160 further establishes a prefetched region correspondence table SMR_TB, a reverse sequence table RSE_TB, and a sequence table SE_TB according to the loaded data link relationship set. In detail, the controller 160 establishes a prefetch area correspondence table SMR_TB in the random memory 166 to record a set index corresponding to a data link relationship set in the prefetch area CA. The controller 160 establishes a reverse order table RSE_TB in the random memory 166 to record the reverse order of the frequent data link relationship set read from the pre-fetch area CA and the non-frequent data link relationship set self-fetch area. The order in which the CA is read is reversed. It is worth noting that in this embodiment, the reverse order columns RSE_0 ~ RSE_N in the reverse order table RSE_TB can record two orders (the reverse order of the frequent data link relationship set read from the prefetch area CA and The set of infrequent data link relationships is read in reverse order from the domain fetch area). Similarly, the controller 160 establishes a sequence table SE_TB in the random memory 166 to record the order in which the frequent data link relationship set is read from the prefetch area CA and the infrequent data link relationship set from the domain fetch area. The order in which they are read. When the prefetch area CA is full and a new data link relationship set needs to be loaded, one of the segments S_0 ~ S_N in the prefetch area CA is selected according to the infrequent tail index LRU_TIX, so that the new The data link relationship set loads the selected section. After the new above-mentioned data link relationship set is loaded into the selected above-mentioned section or the old data link relationship set is read, the controller 160 may according to the infrequent indicator group and / or the frequent indicator group and the reverse order table RSE_TB The data in the table and the data in the sequence table SE_TB update the table and indicators in the random memory to record the data status in the prefetch area CA.

第22A~22H圖為本發明所提供之一資料維護方法之一種實施例的流程圖。第22A~22H圖所示之資料維護方法適用於第1圖所示之資料儲存裝置140。流程開始於步驟S2200。步驟S2200~S2212、S2260~S2262、S2266~S2272、S2276~S2282相似於第10圖之步驟S1000~S1012、S1060~S1062、 S1066~S1072、S1076~S1082,請參考第10圖之說明,在此不再贅述。 22A to 22H are flowcharts of an embodiment of a data maintenance method provided by the present invention. The data maintenance method shown in FIGS. 22A to 22H is applicable to the data storage device 140 shown in FIG. 1. The process starts at step S2200. Steps S2200 ~ S2212, S2260 ~ S2262, S2266 ~ S2272, S2276 ~ S2282 are similar to steps S1000 ~ S10112, S1060 ~ S1062, S1066 ~ S1072, S1076 ~ S1082, please refer to the description in Figure 10, More details.

在步驟S2214中,控制器160將一非頻繁頭指標LRU_HIX以及一非頻繁尾指標LRU_TIX同時定義為第一區之一第一共用指標。舉例而言,在第12圖的實施例中,資料鏈結關係集合TS_2係第一個被寫入預取區域CA的資料鏈結關係集合,其中資料鏈結關係集合TS_2係被寫入區段S_N。因此,在步驟S2214中,控制器160將非頻繁頭指標LRU_HIX以及非頻繁尾指標LRU_TIX同時定義為區段S_N之共用指標CIX_N。接著,流程進行至步驟S2299。 In step S2214, the controller 160 simultaneously defines an infrequent head indicator LRU_HIX and an infrequent tail indicator LRU_TIX as one of the first common indicators in the first area. For example, in the embodiment of FIG. 12, the data link relationship set TS_2 is the first data link relationship set written in the prefetch area CA, where the data link relationship set TS_2 is written into the section S_N. Therefore, in step S2214, the controller 160 defines both the infrequent head indicator LRU_HIX and the infrequent tail indicator LRU_TIX as the common indicator CIX_N of the section S_N. Then, the flow proceeds to step S2299.

在步驟S2218中,控制器160根據非頻繁頭指標LRU_HIX,獲得在預取區域CA中最後一個被讀取之非頻繁資料鏈結關係集合所屬之一第二區段。值得注意的是,在本實施例中,預取區域CA最後一個被讀取之資料鏈結關係集合指的是,目前之預取區域CA中最後一個被控制器160自預取區域CA中讀取以進行所接收之讀取命令或者寫入命令之非頻繁資料鏈結關係集合。 In step S2218, the controller 160 obtains a second section to which the last infrequent data link relationship set read in the prefetch area CA belongs according to the infrequent header index LRU_HIX. It is worth noting that, in this embodiment, the last set of data link relationships read in the prefetch area CA refers to the last prefetch area CA that was read by the controller 160 from the prefetch area CA. It is used to perform the infrequent data link relationship set of the received read command or write command.

接著,在步驟S2220中,控制器160將順序表SE_TB中相應於第二區段所相應之一第二順序欄的共用指標,寫入相應於第一區段的第一順序欄。舉例而言,在第五圖的實施例中,資料鏈結關係集合TS_8不係第一個被寫入預取區域CA的資料鏈結關係集合,其中資料鏈結關係集合TS_8係被寫入區段S_N-1(第一區段)。在更新隨機存取記憶體166中之表前,控制器160在步驟S1018中,根據目前之非頻繁頭指標LRU_HIX(如 第12圖所示),獲得在預取區域CA中最後一個被讀取之非頻繁資料鏈結關係集合TS_2所屬之一區段S_N(第二區段)。接著,在步驟S2220中,控制器160將區段S_N(第二區段)所相應之順序欄SE_N(第二順序欄)的共用指標CIX_N,寫入相應於目前之區段S_N-1(第一區段)的順序欄SE_N-1(第一順序爛)。 Next, in step S2220, the controller 160 writes the common index of the second sequence column corresponding to the second section in the sequence table SE_TB into the first sequence column corresponding to the first section. For example, in the embodiment of the fifth figure, the data link relationship set TS_8 is not the first data link relationship set written in the prefetch area CA, where the data link relationship set TS_8 is written into the area Segment S_N-1 (first segment). Before updating the table in the random access memory 166, the controller 160 obtains the last one read in the prefetch area CA according to the current infrequent header index LRU_HIX (as shown in FIG. 12) in step S1018. One of the segments S_N (second segment) to which the infrequent data link relationship set TS_2 belongs. Next, in step S2220, the controller 160 writes the common index CIX_N of the sequence column SE_N (second sequence column) corresponding to the section S_N (second section) into the current section S_N-1 (the second section) A section) of the sequence column SE_N-1 (the first sequence is bad).

接著,在步驟S2222中,控制器160將反序表RSE_TB中相應於第一區段之第一反序欄的共用指標,寫入第二區段所相應之一第二反序欄。舉例而言,在第13圖的實施例中,控制器160在步驟S2222中將相應於目前之區段S_N-1(第一區段)的反序欄RSE_N-1(第一反序欄)之共用指標CIX_N-1,寫入區段S_N(第二區段)所相應之反序欄RSE_N中。 Next, in step S2222, the controller 160 writes the common index corresponding to the first reverse order column of the first section in the reverse order table RSE_TB into a second reverse order column corresponding to the second section. For example, in the embodiment of FIG. 13, in step S2222, the controller 160 sets the reverse order column RSE_N-1 (first reverse order column) corresponding to the current section S_N-1 (first section). The common index CIX_N-1 is written in the reverse sequence column RSE_N corresponding to the sector S_N (second sector).

接著,在步驟S2224中,控制器160將非頻繁頭指標LRU_HIX定義為第一區段之一第一共用指標。舉例而言,在第13圖的實施例中,控制器160在步驟S2224中,將非頻繁頭指標LRU_HIX定義為目前區段S_N-1(第一區段)之共用指標CIX_N-1(第一共用指標),並且將非頻繁尾指標LRU_TIX維持在共用指標CIX_N(第二共用指標),其中頻繁指標組亦維持在原本的數值。接著,流程進行至步驟S1090。 Next, in step S2224, the controller 160 defines the infrequent header indicator LRU_HIX as a first common indicator of one of the first sections. For example, in the embodiment of FIG. 13, in step S2224, the controller 160 defines the infrequent header indicator LRU_HIX as the common indicator CIX_N-1 (the first section) of the current section S_N-1 (the first section). Common indicator), and the non-frequent tail indicator LRU_TIX is maintained at the common indicator CIX_N (second common indicator), wherein the frequent indicator group is also maintained at the original value. Then, the flow proceeds to step S1090.

在步驟S2229中,控制器160判斷非頻繁尾指標LRU_TIX或者非頻繁頭指標LRU_HIX是否為共用指標CIX_0~CIX_N中之任一者。當非頻繁尾指標LRU_TIX或者非頻繁頭指標LRU_HIX為共用指標CIX_0~CIX_N中之一者時,流程進行至步驟S2230;否則,流程進行至步驟S2291。 In step S2229, the controller 160 determines whether the infrequent tail indicator LRU_TIX or the infrequent head indicator LRU_HIX is any one of the common indicators CIX_0 to CIX_N. When the infrequent tail indicator LRU_TIX or the infrequent head indicator LRU_HIX is one of the common indicators CIX_0 ~ CIX_N, the flow proceeds to step S2230; otherwise, the flow proceeds to step S2291.

在步驟S2230中,控制器160根據非頻繁尾指標 LRU_TIX判斷預取區域CA中最久未被讀取之非頻繁資料鏈結關係集合所屬的一第三區段。值得注意的是,在本實施例中,預取區域CA中最久未被讀取之非頻繁資料鏈結關係集合指的是,目前之預取區域CA中最久未被控制器160自預取區域CA中讀取以進行所接收之讀取命令或者寫入命令之非頻繁資料鏈結關係集合。 In step S2230, the controller 160 determines, according to the infrequent tail index LRU_TIX, a third section to which the infrequent data link relationship set that has not been read for the longest time belongs. It is worth noting that in this embodiment, the set of infrequent data link relationships that have not been read for the longest time in the prefetch area CA refers to the current prefetch area CA that has not been self-fetched by the controller 160 for the longest time. A collection of infrequent data link relationships that are read by the CA for the received read command or write command.

接著,在步驟S2232中,控制器160將第一資料鏈結關係集合的資料寫入第三區段。舉例而言,在第17圖之實施例中,讀取命令或者寫入命令所指定之頁面之一對應關係包括於資料鏈結關係集合TS_77(第一資料鏈結關係集合)。控制器160在步驟S2204中已判斷預取區域對應表SMR_TB中不存在相應於資料鏈結關係集合TS_77的集合指標0x333,並且控制器160在步驟S2206中已判斷預取區域CA中已不具有空白之區段。因此,在步驟S2230中,控制器160根據更動前之第16圖所示之非頻繁尾指標LRU_TIX判斷預取區域CA中最久未被讀取之非頻繁資料鏈結關係集合為資料鏈結關係集合TS_2,並且資料鏈結關係集合TS_2所相應之區段為區段S_N(第三區段)。因此,在步驟S2232中,控制器160自快閃記憶體180中之資料鏈結關係表TB1讀取資料鏈結關係集合TS_77(第一資料鏈結關係集合),以將資料鏈結關係集合TS_77載入所獲得之區段S_N(第三區段),以取代原本很久未被讀取之資料鏈結關係集合TS_2。 Next, in step S2232, the controller 160 writes the data of the first data link relationship set into the third section. For example, in the embodiment of FIG. 17, a correspondence relationship of one of the pages specified by the read command or the write command is included in the data link relationship set TS_77 (the first data link relationship set). The controller 160 has determined in step S2204 that the set index 0x333 corresponding to the data link relationship set TS_77 does not exist in the prefetch area correspondence table SMR_TB, and the controller 160 has determined in step S2206 that there is no blank in the prefetch area CA Section. Therefore, in step S2230, the controller 160 judges the infrequent data link relationship set that has not been read for the longest time in the prefetch area CA as the data link relationship set according to the infrequent tail index LRU_TIX shown in FIG. 16 before the change. TS_2, and the section corresponding to the data link relationship set TS_2 is section S_N (third section). Therefore, in step S2232, the controller 160 reads the data link relationship set TS_77 (the first data link relationship set) from the data link relationship table TB1 in the flash memory 180 to set the data link relationship set TS_77. Load the obtained segment S_N (third segment) to replace the data link relationship set TS_2 that has not been read for a long time.

接著,在步驟S2234中,控制器160將相應於第一資料鏈結關係集合之第一集合指標,寫入預取區域對應表SMR_TB中相應於第三區段的區段對應欄。在第17圖之實施例 中,控制器160接著在步驟S2234中將相應於資料鏈結關係集合TS_77(第一資料鏈結關係集合)之集合指標0x333(第一集合指標),寫入預取區域對應表SMR_TB中相應於區段S_N(第三區段)的區段對應欄SMR_N。 Next, in step S2234, the controller 160 writes the first set index corresponding to the first data link relationship set into the section corresponding column corresponding to the third section in the prefetch area corresponding table SMR_TB. In the embodiment of FIG. 17, the controller 160 then writes a set index 0x333 (first set index) corresponding to the data link relationship set TS_77 (the first data link relationship set) to the prefetch in step S2234. In the area correspondence table SMR_TB, a section correspondence column SMR_N corresponding to the section S_N (third section).

接著,在步驟S2236中,控制器160根據非頻繁頭指標LRU_HIX,獲得在預取區域CA中最後一個被讀取之非頻繁資料鏈結關係集合所屬之一第四區段。 Next, in step S2236, the controller 160 obtains a fourth section to which the last infrequent data link relationship set read in the prefetch area CA belongs according to the infrequent header index LRU_HIX.

接著,在步驟S2238中,控制器160將順序表SE_TB中之相應於第四區段之一第四順序欄的共用指標,寫入順序表SE_TB中相應於第三區段之一第三順序欄。舉例而言,在第17圖之實施例中,控制器160在步驟S2236中根據更動前第16圖所示之非頻繁頭指標LRU_HIX,獲得在預取區域CA中最後一個被讀取之資料鏈結關係集合TS_0係屬於之區段S_2(第四區段)。接著,在步驟S1038中,控制器160將區段S_2(第四區段)所相應之順序欄SE_2(第四順序欄)的共用指標CIX_2,寫入相應於目前之區段S_N(第三區段)的順序欄SE_N(第三順序欄)。 Next, in step S2238, the controller 160 writes the common index in the sequence table SE_TB corresponding to one of the fourth sections in the fourth order column into the third table in the order table SE_TB corresponding to one of the third sections. . For example, in the embodiment of FIG. 17, in step S2236, the controller 160 obtains the last data chain read in the prefetch area CA according to the infrequent header index LRU_HIX shown in FIG. 16 before the change. The tie relationship set TS_0 belongs to the section S_2 (fourth section). Next, in step S1038, the controller 160 writes the common index CIX_2 of the sequence column SE_2 (the fourth sequence column) corresponding to the section S_2 (the fourth section) into the current section S_N (the third zone) Paragraph) sequence column SE_N (third sequence column).

接著,在步驟S2240中,控制器160將反序表RSE_TB中相應於第三區段之一第三反序欄的共用指標,寫入反序表RSE_TB中相應於第四區段之一第四反序欄。舉例而言,在第17圖之實施例中,控制器160將相應於目前之區段S_N(第三區段)的反序欄RSE_N(第三反敘欄)之共用指標CIX_N,寫入區段S_2(第四區段)所相應之反序欄RSE_2(第四反序欄)。 Next, in step S2240, the controller 160 writes the common index corresponding to the third reverse order column in the reverse order table RSE_TB corresponding to one of the third sectors into the reverse order table RSE_TB corresponding to one of the fourth sectors Reverse order bar. For example, in the embodiment of FIG. 17, the controller 160 writes the common index CIX_N corresponding to the reverse sequence column RSE_N (third reverse column) of the current section S_N (third section) into the area The reverse order column RSE_2 (fourth reverse order column) corresponding to the segment S_2 (fourth section).

接著,在步驟S2242中,控制器160讀取第三反序 欄,以獲得反序欄RSE_0~RSE_N中一第五反序欄RSE_0~RSE_N之共用指標。換言之,控制器160讀取目前被寫入之第三區段所相應之第三反序欄,以獲得原本在目前之第三區段之後下一個被讀取之一第五區段。 Next, in step S2242, the controller 160 reads the third reverse-order column to obtain a common indicator of a fifth reverse-order column RSE_0 ~ RSE_N in the reverse-order column RSE_0 ~ RSE_N. In other words, the controller 160 reads the third reverse sequence column corresponding to the currently written third sector to obtain a fifth sector that was originally read next to the current third sector.

接著,在步驟S2244中,控制器160將非頻繁尾指標LRU_TIX定義為相應於第五反序欄之一第五共用指標以及將非頻繁頭指標LRU_HIX定義為第三順序欄之一第三共用指標。舉例而言,在第17圖之實施例中,控制器160在步驟S2244中讀取目前之區段S_N(第三區段)的反序欄RSE_N(第三反序欄),以獲得原本在目前之區段S_N(第三區段)之後下一個被讀取之區段S_N-1的共用指標CIX_N-1(第五反序欄的共用指標)。接著,控制器160將非頻繁頭指標LRU_HIX定義為目前區段S_N(第三區段)之共用指標CIX_N,並且將非頻繁尾指標LRU_TIX定義為原本在目前之區段S_N之後下一個被讀取之區段S_N-1(第五區段)的共用指標CIX_N-1(第五共用指標)。 Next, in step S2244, the controller 160 defines the infrequent tail indicator LRU_TIX as a fifth common indicator corresponding to one of the fifth reverse order columns and defines the infrequent head indicator LRU_HIX as a third common indicator in a third order column. . For example, in the embodiment of FIG. 17, the controller 160 reads the reverse order column RSE_N (third reverse order column) of the current section S_N (third section) in step S2244 to obtain the original The common index CIX_N-1 (the common index in the fifth reverse column) of the current sector S_N (the third sector) is read next to the sector S_N-1. Next, the controller 160 defines the infrequent head indicator LRU_HIX as the common indicator CIX_N of the current section S_N (third section), and defines the infrequent tail indicator LRU_TIX as being originally read next after the current section S_N The common index CIX_N-1 (the fifth common index) of the sector S_N-1 (the fifth sector).

接著,在步驟S2246中,控制器160將一特定值寫入第三反序欄以及相應於第五共用指標之一第五順序欄。換言之,控制器160將特定值寫入目前頭指標所指向之共用指標所相應的反序欄中,並且將特定值寫入目前尾指標所指向之共用指標所相應的順序欄中。如第17圖所示,控制器160將特定值寫入相應於目前區段S_N(第三區段)之反序欄RSE_N以及共用指標CIX_N-1(第五反序欄的共用指標)所相應之順序欄SE_N-1(第五順序欄)。接著,流程進行至步驟S2299。 Next, in step S2246, the controller 160 writes a specific value into the third reverse sequence column and the fifth sequence column corresponding to one of the fifth common indicators. In other words, the controller 160 writes the specific value into the reverse order column corresponding to the common indicator pointed to by the current head indicator, and writes the specific value into the sequence column corresponding to the common indicator pointed to by the current tail indicator. As shown in FIG. 17, the controller 160 writes a specific value into the reverse sequence column RSE_N and the common index CIX_N-1 (the fifth reverse sequence common index) corresponding to the current sector S_N (third sector). Sequence column SE_N-1 (the fifth sequence column). Then, the flow proceeds to step S2299.

在步驟S2259中,控制器160判斷頻繁頭指標 FR_HIX或者頻繁尾指標FR_TIX是否為共用指標CIX_0~CIX_N中之任一者。當頻繁頭指標FR_HIX為共用指標CIX_0~CIX_N中之一者時,流程進行至步驟S2260;否則,流程進行至步驟S2293。 In step S2259, the controller 160 determines whether the frequent head indicator FR_HIX or the frequent tail indicator FR_TIX is any one of the common indicators CIX_0 to CIX_N. When the frequent head indicator FR_HIX is one of the common indicators CIX_0 ~ CIX_N, the flow proceeds to step S2260; otherwise, the flow proceeds to step S2293.

接著,在步驟S2264中,控制器160根據頻繁頭指標FR_HIX,獲得在預取區域CA中最後一個被讀取之頻繁資料鏈結關係集合所屬之一第八區段。 Next, in step S2264, the controller 160 obtains one of the eighth sections to which the last frequent data link relationship set read in the prefetch area CA according to the frequent header index FR_HIX.

接著,在步驟S2265中,控制器160根據頻繁尾指標FR_TIX,判斷預取區域CA中最久未被讀取之資料鏈結關係集合所屬的區段是否為第六區段。當最久未被讀取之資料鏈結關係集合所屬的區段為第六區段時,流程進行至步驟S2280;否則,流程進行至步驟S2266。換言之,控制器160在本步驟中判斷目前所要讀取之資料鏈結關係集合是否為預取區域CA中最久未被讀取的資料鏈結關係集合。 Next, in step S2265, the controller 160 determines whether the sector to which the data link relationship set that has not been read for the longest time in the prefetch area CA belongs to the sixth sector according to the frequent tail index FR_TIX. When the section to which the data link relationship set that has not been read for the longest time belongs to the sixth section, the flow proceeds to step S2280; otherwise, the flow proceeds to step S2266. In other words, the controller 160 determines in this step whether the currently set data link relationship set to be read is the data link relationship set that has not been read for the longest time in the prefetch area CA.

接著,在步驟S2274中,控制器160將頻繁頭指標FR_HIX定義為第六順序欄之一第六共用指標。 Next, in step S2274, the controller 160 defines the frequent head indicator FR_HIX as a sixth common indicator in one of the sixth sequence columns.

接著,在步驟S2284中,控制器160將頻繁頭指標FR_HIX定義為第六順序欄之一第六共用指標,並且將頻繁尾指標FR_TIX定義為第七區段之一第七共用指標。 Next, in step S2284, the controller 160 defines the frequent head indicator FR_HIX as a sixth common indicator in a sixth sequence column, and defines the frequent tail indicator FR_TIX as a seventh common indicator in a seventh section.

接著,步驟S2286中,控制器160將一特定值寫入第六反序欄。換言之,控制器160將特定值寫入目前頭指標所指之共用指標CIX_N所相應的反序欄RSE_N中。接著,流程進行至步驟S2299。 Next, in step S2286, the controller 160 writes a specific value into the sixth reverse order column. In other words, the controller 160 writes the specific value into the reverse order column RSE_N corresponding to the common indicator CIX_N indicated by the current head indicator. Then, the flow proceeds to step S2299.

在步驟S2291中,控制器160將頻繁尾指標FR_TIX 中所儲存之共用指標寫入非頻繁尾指標LRU_TIX,將頻繁頭指標FR_HIX中所儲存之共用指標寫入非頻繁頭指標LRU_HIX。 In step S2291, the controller 160 writes the common indicator stored in the frequent-tail indicator FR_TIX into the non-frequent-tail indicator LRU_TIX, and writes the shared indicator stored in the frequent-head indicator FR_HIX into the non-frequent-head indicator LRU_HIX.

接著,在步驟S2292中,控制器160刪除頻繁尾指標FR_TIX以及非頻繁尾指標LRU_TIX中的共用指標。在另一實施例中,控制器160亦可在將頻繁頭指標FR_HIX中所儲存之共用指標寫入非頻繁頭指標LRU_HIX後,將預設值寫入頻繁尾指標FR_TIX以及非頻繁尾指標LRU_TIX。舉例而言,在步驟S2229中,控制器160判斷非頻繁尾指標LRU_TIX或者非頻繁頭指標LRU_HIX皆非共用指標CIX_0~CIX_N中之任一者,如第18圖所示。接著,控制器160則在步驟S2291~S2292中,將頻繁尾指標FR_TIX中所儲存之共用指標CIX_N-1寫入非頻繁尾指標LRU_TIX,將頻繁頭指標FR_HIX中所儲存之共用指標CIX_N-2寫入非頻繁頭指標LRU_HIX,並且刪除頻繁尾指標FR_TIX以及非頻繁尾指標LRU_TIX中的共用指標。接著,流程進行至步驟S2230。 Next, in step S2292, the controller 160 deletes the common indicator in the frequent tail indicator FR_TIX and the non-frequent tail indicator LRU_TIX. In another embodiment, the controller 160 may also write the common indicator stored in the frequent head indicator FR_HIX into the infrequent head indicator LRU_HIX, and then write the preset value into the frequent tail indicator FR_TIX and the infrequent tail indicator LRU_TIX. For example, in step S2229, the controller 160 determines that either the infrequent tail indicator LRU_TIX or the infrequent head indicator LRU_HIX is not any of the common indicators CIX_0 to CIX_N, as shown in FIG. 18. Next, the controller 160 writes the common indicator CIX_N-1 stored in the frequent tail indicator FR_TIX to the non-frequent tail indicator LRU_TIX and writes the common indicator CIX_N-2 stored in the frequent header indicator FR_HIX in steps S2291 ~ S2292. Enter the infrequent header indicator LRU_HIX, and delete the common indicator in the frequent tail indicator FR_TIX and the infrequent tail indicator LRU_TIX. Then, the flow proceeds to step S2230.

在步驟S2293中,控制器160讀取相應於儲存第一資料鏈結關係集合之一第六區段所相應的一第六反序欄,以獲得在第一資料鏈結關係集合之後下一個被讀取之第七區段。換言之,控制器160讀取在一反序表RSE_TB中一第六區段所相應之一第六反序欄,以獲得在第六區段之後下一個被讀取之一第七區段。舉例而言,在第15圖的實施例中,讀取命令或者寫入命令所指定之頁面之一對應關係包括於資料鏈結關係集合為TS_12。如更動前的第14圖所示,資料鏈結關係集合TS_12之集合指標0xABC已存在於預取區域對應表SMR_TB中之區域對應 欄SMR_3之中。因此,控制器160在步驟S2204中已根據預取區域對應表SMR_TB存在相應於資料鏈結關係集合TS_3的集合指標0xABC,判斷資料鏈結關係集合TS_12已被載入預取區域CA。接著,控制器160在步驟S2293中根據目前區段S_3(第六區段)之共用指標CIX_3,讀取反序表RSE_TB中相應於目前區段S_3(第六區段)之反序欄RSE_3(第六反序欄)中的值,並且根據反序欄RSE_3(第六反序欄)中之共用指標CIX_2找到在目前區段S_3(第六區段)之後下一個被讀取之區段為區段S_2。 In step S2293, the controller 160 reads a sixth reverse order column corresponding to the sixth section storing one of the first data link relationship sets, so as to obtain the next data link after the first data link relationship set. Read the seventh sector. In other words, the controller 160 reads a sixth reverse sequence column corresponding to a sixth sector in a reverse sequence table RSE_TB to obtain a seventh sector that is next read after the sixth sector. For example, in the embodiment of FIG. 15, a correspondence relationship of one of the pages specified by the read command or the write command is included in the data link relationship set as TS_12. As shown in FIG. 14 before the change, the set index 0xABC of the data link relationship set TS_12 already exists in the region correspondence column SMR_3 in the prefetch region correspondence table SMR_TB. Therefore, in step S2204, the controller 160 has determined that the data link relationship set TS_12 has been loaded into the prefetch area CA according to the existence of the set index 0xABC corresponding to the data link relationship set TS_3 in the prefetch area correspondence table SMR_TB. Next, in step S2293, the controller 160 reads the reverse order column RSE_3 in the reverse order table RSE_TB corresponding to the current section S_3 (sixth section) according to the common index CIX_3 of the current section S_3 (sixth section) ( Value in the sixth reverse order column), and according to the common indicator CIX_2 in the reverse order column RSE_3 (sixth reverse order column), the next section read after the current section S_3 (sixth section) is Section S_2.

接著,在步驟S2294中,控制器160在順序表SE_TB中相應於第七區段之一第七順序欄中,寫入第六區段所相應之一第六順序欄中所儲存之共用指標。舉例而言,在第14圖的實施例中,控制器160在步驟S1093中已獲得在目前區段S_3(第六區段)之後下一個被讀取之區段為區段S_2(第七區段)。因此,在步驟S1094中,控制器160在相應於區段S_2(第七區段)之順序欄SE_2(第七順序欄)中寫入目前區段S_3(第六區段)所相應之順序欄SE_3(第六順序欄)中所儲存之共用指標CIX_4。換言之,控制器160將原本指向順序欄SE_3(第六順序欄)之順序欄SE_2(第七順序欄),改指向在第一資料鏈結關係集合之前上一個被讀取之區段S_4所相應之順序欄SE_4。 Next, in step S2294, the controller 160 writes the common indicator stored in the sixth sequence column corresponding to the sixth sector in the seventh sequence column corresponding to one of the seventh sectors in the sequence table SE_TB. For example, in the embodiment of FIG. 14, the controller 160 has obtained in step S1093 that the next sector read after the current sector S_3 (sixth sector) is sector S_2 (seventh sector) segment). Therefore, in step S1094, the controller 160 writes the sequence column corresponding to the current sector S_3 (sixth sector) in the sequence column SE_2 (seventh sequence column) corresponding to the sector S_2 (seventh sector). The shared indicator CIX_4 stored in SE_3 (sixth order column). In other words, the controller 160 points originally to the sequence column SE_2 (seventh sequence column) of the sequence column SE_3 (sixth sequence column), and points to the corresponding section S_4 that was read before the first data link relationship set. Sequence column SE_4.

接著,在步驟S2295中,控制器160讀取相應於第六區段之第六順序欄,以獲得相應於在第六區段之前一個被寫入之一第九區段之一第九共用指標。在第15圖之實施例中,控制器160在步驟S2295中讀取相應於目前區段S_3(第六區段)之順序欄SE_3(第六順序欄),以獲得相應於在目前區段S_4(第六 區段)之前一個被寫入之區段為區段S_4(第九區段)。 Next, in step S2295, the controller 160 reads the sixth sequence column corresponding to the sixth sector to obtain a ninth common index corresponding to one of the ninth sectors written before the sixth sector. . In the embodiment of FIG. 15, the controller 160 reads the sequence column SE_3 (sixth sequence column) corresponding to the current section S_3 (sixth section) in step S2295 to obtain the sequence column S_4 corresponding to the current section S_3 (sixth section). (Sixth sector) The previously written sector is sector S_4 (ninth sector).

接著,在步驟S2296中,控制器160將第六反序欄中所儲存之共用指標,寫入相應於第九共用指標之一第九反序欄。舉例而言,在第15圖的實施例中,控制器160在步驟S2295中將相應於目前區段S_3(第六區段)之反序欄RSE_3(第六反序欄)中所儲存之共用指標CIX_2,寫入相應於區段S_4(第九區段)之反序欄RSE_4(第九反序欄)。 Next, in step S2296, the controller 160 writes the shared index stored in the sixth reverse order column into the ninth reverse order column corresponding to one of the ninth shared index. For example, in the embodiment of FIG. 15, the controller 160 in step S2295 corresponds to the share stored in the reverse order column RSE_3 (the sixth reverse order column) corresponding to the current section S_3 (the sixth section). The indicator CIX_2 is written in the reverse order column RSE_4 (the ninth reverse order column) corresponding to the section S_4 (the ninth section).

接著,在步驟S2297中,控制器160將特定值寫入第六順序欄以及第六反序欄。舉例而言,在第15圖的實施例中,控制器160在步驟S2297中將特定值0xFFFF寫入相應於目前區段S_3(第六區段)之反序欄RSE_3(第六反序欄)以及順序欄SE_3(第順反序欄)。 Next, in step S2297, the controller 160 writes a specific value into the sixth sequence column and the sixth reverse sequence column. For example, in the embodiment of FIG. 15, the controller 160 writes a specific value of 0xFFFF to the reverse order column RSE_3 (sixth reverse order column) corresponding to the current section S_3 (sixth section) in step S2297. And the sequence column SE_3 (the first and the third sequence columns).

接著,在步驟S2298中,控制器160將頻繁頭指標FR_HIX以及頻繁尾指標FR_TIX定義為第六順序欄之一第六共用指標。舉例而言,在第15圖的實施例中,控制器160在步驟S2297中將頻繁頭指標FR_HIX以及頻繁尾指標FR_TIX定義為目前區段S_3之共用指標CIX_3。接著,流程進行至步驟S2299。 Next, in step S2298, the controller 160 defines the frequent head indicator FR_HIX and the frequent tail indicator FR_TIX as one of the sixth common indicators in the sixth sequence column. For example, in the embodiment of FIG. 15, the controller 160 defines the frequent head indicator FR_HIX and the frequent tail indicator FR_TIX as the common indicator CIX_3 of the current section S_3 in step S2297. Then, the flow proceeds to step S2299.

在步驟S2299中,控制器160自預取區域CA讀取第一資料鏈結關係集合中之資料,以執行在步驟S2200中所接收之寫入命令或者讀取命令。流程結束於步驟S2299。 In step S2299, the controller 160 reads the data in the first data link relationship set from the prefetch area CA to execute the write command or the read command received in step S2200. The process ends in step S2299.

本發明所提供之資料儲存裝置140以及資料維護方法可藉由指標、反序表、順序表以及一預取區域對應表紀錄預取區域中資料被讀取的狀態以更新預取區域中之資料,其中指標、反序表以及順序表可使得預取區域對應表在每次更新的 過程中所需修正資料數不超五欄。 The data storage device 140 and data maintenance method provided by the present invention can update the data in the prefetched area by using the index, reverse order table, sequence table, and a prefetched area correspondence table to record the status of the data in the prefetched area. Among them, the index, reverse order table, and order table can make the prefetched area correspondence table need to modify the number of data not more than five columns in each update process.

本發明之方法,或特定型態或其部份,可以以程式碼的型態存在。程式碼可儲存於實體媒體,如軟碟、光碟片、硬碟、或是任何其他機器可讀取(如電腦可讀取)儲存媒體,亦或不限於外在形式之電腦程式產品,其中,當程式碼被機器,如電腦載入且執行時,此機器變成用以參與本發明之裝置。程式碼也可透過一些傳送媒體,如電線或電纜、光纖、或是任何傳輸型態進行傳送,其中,當程式碼被機器,如電腦接收、載入且執行時,此機器變成用以參與本發明之裝置。當在一般用途處理單元實作時,程式碼結合處理單元提供一操作類似於應用特定邏輯電路之獨特裝置。 The method of the present invention, or a specific form or part thereof, may exist in the form of a code. The code can be stored in physical media, such as floppy disks, CD-ROMs, hard disks, or any other machine-readable (such as computer-readable) storage media, or is not limited to external forms of computer program products. Among them, When the code is loaded and executed by a machine, such as a computer, the machine becomes a device for participating in the invention. The code can also be transmitted through some transmission media, such as wire or cable, optical fiber, or any transmission type. Where the code is received, loaded, and executed by a machine, such as a computer, the machine becomes used to participate in the Invented device. When implemented in a general-purpose processing unit, the code in combination with the processing unit provides a unique device that operates similar to an application-specific logic circuit.

惟以上所述者,僅為本發明之較佳實施例而已,當不能以此限定本發明實施之範圍,即大凡依本發明申請專利範圍及發明說明內容所作之簡單的等效變化與修飾,皆仍屬本發明專利涵蓋之範圍內。另外本發明的任一實施例或申請專利範圍不須達成本發明所揭露之全部目的或優點或特點。此外,摘要部分和標題僅是用來輔助專利文件搜尋之用,並非用來限制本發明之權利範圍。 However, the above are only the preferred embodiments of the present invention. When the scope of implementation of the present invention cannot be limited by this, that is, the simple equivalent changes and modifications made according to the scope of the patent application and the description of the invention, All are still within the scope of the invention patent. In addition, any embodiment of the present invention or the scope of patent application does not need to achieve all the purposes or advantages or features disclosed by the invention. In addition, the abstract and the title are only used to assist the search of patent documents, and are not intended to limit the scope of rights of the present invention.

Claims (16)

一種資料儲存裝置,包括:一隨機存取記憶體,具有一預取區域;一快閃記憶體,包括複數頁面,其中每一該等頁面具有一邏輯位址以及一實體位址,該快閃記憶體具有該資料鏈結關係表用以紀錄所有該等頁面之該等邏輯位址以及該等實體位址的複數對應關係,該資料鏈結關係表被分割為該等資料鏈結關係集合,每一該等資料鏈結關係集合具有該等對應關係中之至少一者,並且每一該資料鏈結關係集合相應於一集合指標;以及一控制器,用以將一資料鏈結關係表中部分之複數資料鏈結關係集合載入該預取區域中之複數區段,其中該等資料鏈結關係集合中,被讀取次數小於一既定值之資料鏈結關係集合屬於複數非頻繁資料鏈結關係集合,且被讀取次數到達該既定值之資料鏈結關係集合,屬於複數頻繁資料鏈結關係集合,其中該控制器更建立一非頻繁指標組以維護該等非頻繁資料鏈結關係集合,並且建立一頻繁指標組以維護該等頻繁資料鏈結關係集合,其中該非頻繁指標組係由一非頻繁頭指標以及一非頻繁尾指標所構成,並且該頻繁指標組係由一頻繁頭指標以及一頻繁尾指標所構成,其中該等區段依序具有複數共用指標,該非頻繁頭指標為用以儲存最後一個被讀取之該非頻繁資料鏈結關係集合之該區段的該共用指標,該非頻繁尾指標為用以儲存最久未被讀取之該非頻繁資料鏈結關係集合之該區段的該共用指標,該頻繁頭指標為用以儲存最後一個被讀取之該頻繁資料鏈結關係集合之該區段的該共用指標,該頻繁尾指標為用以儲存最久未被讀取之該頻繁資料鏈結關係集合之該區段的該共用指標,其中該隨機存取記憶體更包括一順序表、一反序表以及一預取區域對應表,其中該預取區域對應表具有複數區段對應欄用以紀錄相應於該預取區域中之該等資料鏈結關係集合的該等集合指標,該順序表用以分別紀錄該等頻繁資料鏈結關係集合自該預取區域中被讀取之順序以及該等非頻繁資料鏈結關係集合自該域取區域中被讀取之順序,並且該反序表分別用以紀錄該等頻繁資料鏈結關係集合自該預取區域中被讀取之反向的順序以及該等非頻繁資料鏈結關係集合自該預取區域中被讀取之反向的順序。A data storage device includes: a random access memory with a prefetch area; a flash memory including a plurality of pages, each of which has a logical address and a physical address, the flash memory The memory has the data link relationship table for recording the logical correspondences of the plurality of pages and the plural correspondences of the entity addresses. The data link relationship table is divided into the data link relationship sets. Each of the data link relationship sets has at least one of the corresponding relationships, and each of the data link relationship sets corresponds to a set index; and a controller is configured to link a data link relationship table into a data link relationship table. A part of the plurality of data link relationship sets is loaded into the plurality of sections in the prefetch area. Among the data link relationship sets, the data link relationship sets that have been read less than a predetermined value belong to the plural infrequent data links. A set of data link relationships that has been read for a predetermined number of times and belongs to a complex set of frequent data link relationships, where the controller establishes a non-frequent The target group maintains the infrequent data link relationship set, and establishes a frequent indicator group to maintain the frequent data link relationship set, wherein the infrequent indicator group is composed of an infrequent head indicator and an infrequent tail indicator. And the frequent indicator group is composed of a frequent head indicator and a frequent tail indicator, wherein the sections have a plurality of shared indicators in order, and the infrequent header indicator is used to store the last infrequent data read. The common indicator of the section of the link relationship set, the non-frequent tail indicator is used to store the common indicator of the section of the infrequent data link relationship set that has not been read for the longest, and the frequent header indicator is used to Store the shared indicator of the sector of the last frequent data link relationship set that was read last. The frequent tail indicator is used to store the sector of the frequent data link relationship set that has not been read for the longest time. Shared index, wherein the random access memory further includes a sequence table, a reverse sequence table, and a prefetched region correspondence table, wherein the prefetched region correspondence table has The corresponding column of the data section is used to record the set indicators corresponding to the data link relationship sets in the prefetch area, and the sequence table is used to record the frequent data link relationship sets from the prefetch area respectively. The order of reading and the order of reading the infrequent data link relationship set from the domain fetch area, and the reverse order table is used to record the frequent data link relationship set from the prefetch area, respectively The reversed order of reads and the reversed order of the collection of the infrequent data link relationships from the prefetched region. 根據申請專利範圍第1項之資料儲存裝置,其中該預取區域對應表中之該等區段對應欄依序相應於該預取區域中之該等區段,該順序表具有複數順序欄依序相應於該預取區域中之該等區段,該反序表具有複數反序欄依序相應於該預取區域中之該等區段,並且該區段對應欄、該順序欄、該反序欄與其相應之該等區段具有相同之該等共用指標。The data storage device according to item 1 of the scope of the patent application, wherein the corresponding columns of the sections in the prefetch area correspondence table correspond to the sections in the prefetch area in sequence, and the sequence table has a plurality of order columns according to The order corresponds to the sections in the prefetch area, the reverse order table has a plurality of reverse order columns corresponding to the sections in the prefetch area, and the section corresponding column, the order column, the The reverse order column has the same shared indicators as those corresponding sections. 根據申請專利範圍第2項之資料儲存裝置,其中與該等頻繁資料鏈結關係集合所屬之該等區段具有相同之該等共用指標之該等順序欄屬於複數頻繁順序欄,與該等非頻繁資料鏈結關係集合所屬之該等區段具有相同之該等共用指標之該等順序欄屬於複數非頻繁順序欄,其中每一該等頻繁順序欄係用以儲存另一該頻繁順序欄的該共用指標,以分別指向在相應於該頻繁順序欄之該區段之前上一個被讀取之該頻繁資料鏈結關係集合之該區段所相應之該頻繁順序欄,其中每一該等非頻繁順序欄係用以儲存另一該非頻繁順序欄的該共用指標,以分別指向在相應於該非頻繁順序欄之該區段之前上一個被讀取之該非頻繁資料鏈結關係集合之該區段所相應之該非頻繁順序欄。The data storage device according to item 2 of the scope of patent application, wherein the sequence columns having the same shared indicators with the sections to which these frequent data link relationship sets belong belong to the multiple frequent sequence columns, and the non- Frequent data link relationship sets The sections in which the sections belong to the same shared indicators belong to a plurality of non-frequent sequence columns, each of which is used to store another frequent sequence column The common indicator points to the frequent order column corresponding to the section of the frequent data link relationship set that was previously read before the section corresponding to the frequent order column, respectively. The frequent order column is used to store the common index of another infrequent order column to point to the section of the infrequent data link relationship set that was read before the section corresponding to the infrequent order column, respectively. The corresponding infrequent order column. 根據申請專利範圍第2項之資料儲存裝置,其中與該等頻繁資料鏈結關係集合所屬之該等區段具有相同之該等共用指標之該等反序欄屬於複數頻繁反序欄,與該等非頻繁資料鏈結關係集合所屬之該等區段具有相同之該等共用指標之該等反序欄屬於複數非頻繁反序欄,其中每一該等頻繁反序欄係用以儲存另一該頻繁反序欄的該共用指標,以分別指向在相應於該頻繁反序欄之該區段之後下一個被讀取之該頻繁資料鏈結關係集合之該區段所相應之該頻繁反序欄,每一該等非頻繁反序欄係用以儲存另一該非頻繁反序欄的該共用指標,以分別指向在相應於該非頻繁反序欄之該區段之後下一個被讀取之該非頻繁資料鏈結關係集合之該區段所相應之該非頻繁反序欄。The data storage device according to item 2 of the scope of patent application, wherein the reverse order columns that have the same shared indicators as the sections to which these frequent data link relationship sets belong are plural frequent reverse order columns, and the The non-frequent data link relationship set belongs to a plurality of non-frequent reverse order columns in which the segments belonging to the same set of shared indicators belong to a plurality of non-frequent reverse order columns, each of which is used to store another The common index of the frequent reverse order column respectively points to the frequent reverse order corresponding to the section of the frequent data link relationship set that is read next after the section corresponding to the frequent reverse order column. Column, each such non-frequent reverse order column is used to store the shared index of another infrequent reverse order column, respectively, to point to the next non-frequently read non-reverse order column after the section corresponding to the infrequent reverse order column The non-frequent reverse order column corresponding to the section of the frequent data link relationship set. 根據申請專利範圍第2項之資料儲存裝置,其中該控制器用以根據一讀取命令或者一寫入命令,找出包括該讀取命令或者該寫入命令所指定之上述頁面之一第一對應關係的一第一資料鏈結關係集合,並且根據該預取區域對應表中是否存在相應於該第一資料鏈結關係集合的一第一集合指標,判斷該第一資料鏈結關係集合是否已被載入該預取區域中,其中該第一資料鏈結關係集合為該等資料鏈結關係集合中之一者,該第一集合指標為該等集合指標中之一者,並且該第一對應關係為該等對應關係中之一者。The data storage device according to item 2 of the scope of patent application, wherein the controller is configured to find a first correspondence of one of the pages specified by the read command or the write command according to a read command or a write command. A first data link relationship set of the relationship, and according to whether there is a first set index corresponding to the first data link relationship set in the prefetch area correspondence table, determine whether the first data link relationship set has been Is loaded into the prefetch area, wherein the first data link relationship set is one of the data link relationship sets, the first set indicator is one of the set indicators, and the first The corresponding relationship is one of these corresponding relationships. 根據申請專利範圍第5項之資料儲存裝置,其中當該預取區域對應表中存在相應於該第一集合指標時,該控制器根據用以儲存該第一集合指標的該區段對應欄之該共用指標,讀取該預取區域中所相應之該區段,以獲得該第一資料鏈結關係集合,並且讀取儲存於該隨機存取記憶體中之該第一資料鏈結關係集合中之資料以進行該寫入命令或者該讀取命令。The data storage device according to item 5 of the scope of patent application, wherein when there is an index corresponding to the first set in the prefetched area correspondence table, the controller is configured to store the corresponding column of the segment corresponding to the first set index. The shared indicator reads the corresponding section in the prefetch area to obtain the first data link relationship set, and reads the first data link relationship set stored in the random access memory. Data in order to perform the write command or the read command. 根據申請專利範圍第6項之資料儲存裝置,其中當該預取區域對應表中不存在該第一集合指標時,該控制器判斷該預取區域是否具有空白之該區段,其中當該控制器判斷該預取區域之該區段具有空白之一第一區段時,該控制器自該快閃記憶體中之該資料鏈結關係表讀取該第一資料鏈結關係集合,將該第一資料鏈結關係集合載入空白之該第一區段。The data storage device according to item 6 of the scope of patent application, wherein when the first set index does not exist in the prefetch area correspondence table, the controller determines whether the prefetch area has a blank section, and when the control When the processor determines that the segment of the prefetch area has a blank first segment, the controller reads the first data link relationship set from the data link relationship table in the flash memory, and The first data link relationship set loads the blank first section. 根據申請專利範圍第7項之資料儲存裝置,其中當該控制器判斷該預取區域不具有空白之該區段時,該控制器判斷該非頻繁尾指標是否為該等共用指標中之任一者,其中當該非頻繁尾指標為該等共用指標中之任一者時,該控制器根據該非頻繁尾指標判斷該等非頻繁資料鏈結關係集合中最久未被讀取之該非頻繁資料鏈結關係集合,以將該第一資料鏈結關係集合的資料寫入該等非頻繁資料鏈結關係集合中最久未被讀取之該非頻繁資料鏈結關係集合所屬的該區段。The data storage device according to item 7 of the scope of patent application, wherein when the controller judges that the prefetch area does not have a blank section, the controller judges whether the infrequent tail indicator is any of the common indicators Wherein, when the infrequent tail indicator is any of the common indicators, the controller judges the infrequent data link relationship in the infrequent data link relationship set that has not been read for the longest time according to the infrequent tail indicator. A set to write the data of the first data link relationship set into the non-frequent data link relationship set that has not been read for the longest time and belongs to the section to which the infrequent data link relationship set belongs. 根據申請專利範圍第8項之資料儲存裝置,其中當該非頻繁尾指標不是該等共用指標中之任一者時,該控制器將該頻繁尾指標中所儲存之該共用指標寫入該非頻繁尾指標,將該頻繁頭指標中所儲存之該共用指標寫入該非頻繁頭指標,並且刪除該頻繁尾指標以及該非頻繁尾指標中所儲存之該等共用指標。The data storage device according to item 8 of the scope of patent application, wherein when the infrequent tail indicator is not any of the common indicators, the controller writes the common indicator stored in the frequent tail indicator into the infrequent tail. Indicator, write the common indicator stored in the frequent-head indicator into the infrequent-head indicator, and delete the frequent-tail indicator and the common indicators stored in the infrequent-tail indicator. 根據申請專利範圍第2項之資料儲存裝置,其中該控制器更用以根據該非頻繁指標組以及該頻繁指標組更新該順序表以及該反序表。According to the data storage device of the second patent application scope, the controller is further configured to update the sequence table and the reverse sequence table according to the infrequent indicator group and the frequent indicator group. 一種資料維護方法,適用於具有一快閃記憶體之一資料儲存裝置,其中該快閃記憶體包括複數頁面,其中每一該等頁面具有一邏輯位址以及一實體位址,並且該資料維護方法包括:在該快閃記憶體被上電時,根據至少一讀取命令或者至少一寫入命令,在一隨機記憶體中之一預取區域之複數區段中,載入一資料鏈結關係表中部份之複數資料鏈結關係集合,其中每一該等資料鏈結關係集合具有該等頁面中之至少一者之該邏輯位址以及該實體位址的對應關係,每一該等資料鏈結關係集合相應於一集合指標其中該等資料鏈結關係集合中被讀取之次數小於一既定值之該等資料鏈結關係集合屬於複數非頻繁資料鏈結關係集合,並且該等資料鏈結關係集合中被讀取到達該既定值之該等資料鏈結關係集合屬於複數頻繁資料鏈結關係集合;建立一非頻繁指標組,以維護該等非頻繁資料鏈結關係集合;建立一頻繁指標組,以維護該等頻繁資料鏈結關係集合,其中該非頻繁指標組係由一非頻繁頭指標以及一非頻繁尾指標所構成,並且該頻繁指標組係由一頻繁頭指標以及一頻繁尾指標所構成,其中該等區段依序具有複數共用指標,該非頻繁頭指標為用以儲存最後一個被讀取之該非頻繁資料鏈結關係集合之該區段的該共用指標,該非頻繁尾指標為用以儲存最久未被讀取之該非頻繁資料鏈結關係集合之該區段的該共用指標,該頻繁頭指標為用以儲存最後一個被讀取之該頻繁資料鏈結關係集合之該區段的該共用指標,該頻繁尾指標為用以儲存最久未被讀取之該頻繁資料鏈結關係集合之該區段的該共用指標;建立一預取區域對應表,以在該預取區域對應表中之複數區段對應欄紀錄相應於該預取區域中之該等資料鏈結關係集合的該等集合指標;建立一順序表,以分別紀錄該等頻繁資料鏈結關係集合自該預取區域中被讀取之順序以及該等非頻繁資料鏈結關係集合自該域取區域中被讀取之順序;以及建立一反序表,以分別紀錄該等頻繁資料鏈結關係集合自該預取區域中被讀取之反向的順序以及該等非頻繁資料鏈結關係集合自該預取區域中被讀取之反向的順序。A data maintenance method is applicable to a data storage device having a flash memory, wherein the flash memory includes a plurality of pages, each of which has a logical address and a physical address, and the data maintenance The method includes: when the flash memory is powered on, according to at least one read command or at least one write command, loading a data link into a plurality of sections of a prefetch area in a random memory. A plurality of data link relationship sets in the relationship table, each of which has a corresponding relationship between the logical address and the physical address of at least one of the pages, each of these The data link relationship set corresponds to a set of indicators. The data link relationship set in which the data link relationship set is read less than a predetermined value belongs to a plurality of infrequent data link relationship sets, and the data The data link relationship set in the link relationship set that is read to reach the predetermined value belongs to the plural frequent data link relationship set; establish a non-frequent index group to dimension The infrequent data link relationship set; establishing a frequent indicator group to maintain the frequent data link relationship set, wherein the infrequent indicator group is composed of an infrequent head indicator and an infrequent tail indicator, and the The frequent indicator group is composed of a frequent header indicator and a frequent tail indicator, in which the sections have a plurality of shared indicators in sequence, and the infrequent header indicator is a set of infrequent data link relationships used to store the last read The common indicator of the sector, the non-frequent tail indicator is used to store the common index of the sector of the infrequent data link relationship set that has not been read for the longest, and the frequent header indicator is used to store the last Read the common indicator of the section of the frequent data link relationship set, and the frequent tail indicator is used to store the common indicator of the section of the frequent data link relationship set that has not been read for the longest time; A prefetching area correspondence table, in which the corresponding fields in the plural section corresponding columns in the prefetching area correspondence table correspond to the data link relationship sets in the prefetching area Set the index of these; establish a sequence table to record the order in which the frequent data link relationship sets are read from the prefetch area and the infrequent data link relationship sets are read from the domain fetch area The order of reading; and establishing a reverse order table to record the reverse order of the frequent data link relationship sets being read from the prefetch area and the non-frequent data link relationship sets from the prefetch The order in which the regions are read is reversed. 根據申請專利範圍第11項之資料維護方法,其中該預取區域對應表中之該等區段對應欄依序相應於該預取區域中之該等區段,該順序表具有複數順序欄依序相應於該預取區域中之該等區段,該反序表具有複數反序欄依序相應於該預取區域中之該等區段,並且該區段對應欄、該順序欄、該反序欄與其相應之該等區段具有相同之該等共用指標。The data maintenance method according to item 11 of the scope of patent application, wherein the corresponding columns of the sections in the prefetched area correspondence table correspond to the sections in the prefetched area in sequence, and the order table has a plurality of order columns The order corresponds to the sections in the prefetch area, the reverse order table has a plurality of reverse order columns corresponding to the sections in the prefetch area, and the section corresponding column, the order column, the The reverse order column has the same shared indicators as those corresponding sections. 根據申請專利範圍第12項之資料維護方法,其中與該等頻繁資料鏈結關係集合所屬之該等區段具有相同之該等共用指標之該等順序欄屬於複數頻繁順序欄,與該等非頻繁資料鏈結關係集合所屬之該等區段具有相同之該等共用指標之該等順序欄屬於複數非頻繁順序欄,其中每一該等頻繁順序欄係用以儲存另一該頻繁順序欄的該共用指標,以分別指向在相應於該頻繁順序欄之該區段之前上一個被讀取之該頻繁資料鏈結關係集合之該區段所相應之該頻繁順序欄,其中每一該等非頻繁順序欄係用以儲存另一該非頻繁順序欄的該共用指標,以分別指向在相應於該非頻繁順序欄之該區段之前上一個被讀取之該非頻繁資料鏈結關係集合之該區段所相應之該非頻繁順序欄。The data maintenance method according to item 12 of the scope of patent application, wherein the sequence columns having the same shared indicators with the sections to which these frequent data link relationship sets belong are plural frequent sequence columns, and the non- Frequent data link relationship sets The sections in which the sections belong to the same shared indicators belong to a plurality of non-frequent sequence columns, each of which is used to store another frequent sequence column The common indicator points to the frequent order column corresponding to the section of the frequent data link relationship set that was previously read before the section corresponding to the frequent order column, respectively. The frequent order column is used to store the common index of another infrequent order column to point to the section of the infrequent data link relationship set that was read before the section corresponding to the infrequent order column, respectively. The corresponding infrequent order column. 根據申請專利範圍第12項之資料維護方法,其中與該等頻繁資料鏈結關係集合所屬之該等區段具有相同之該等共用指標之該等反序欄屬於複數頻繁反序欄,與該等非頻繁資料鏈結關係集合所屬之該等區段具有相同之該等共用指標之該等反序欄屬於複數非頻繁反序欄,其中每一該等頻繁反序欄係用以儲存另一該頻繁反序欄的該共用指標,以分別指向在相應於該頻繁反序欄之該區段之後下一個被讀取之該頻繁資料鏈結關係集合之該區段所相應之該頻繁反序欄,每一該等非頻繁反序欄係用以儲存另一該非頻繁反序欄的該共用指標,以分別指向在相應於該非頻繁反序欄之該區段之後下一個被讀取之該非頻繁資料鏈結關係集合之該區段所相應之該非頻繁反序欄。The data maintenance method according to item 12 of the scope of the patent application, wherein the reverse order columns having the same shared indicators with the sections to which the frequent data link relationship sets belong belong to the plural frequent reverse order columns, and the The non-frequent data link relationship set belongs to a plurality of non-frequent reverse order columns in which the segments belonging to the same set of shared indicators belong to a plurality of non-frequent reverse order columns, each of which is used to store another The common index of the frequent reverse order column respectively points to the frequent reverse order corresponding to the section of the frequent data link relationship set that is read next after the section corresponding to the frequent reverse order column. Column, each such non-frequent reverse order column is used to store the shared index of another infrequent reverse order column, respectively, to point to the next non-frequently read non-reverse order column after the section corresponding to the infrequent reverse order column The non-frequent reverse order column corresponding to the section of the frequent data link relationship set. 根據申請專利範圍第11項之資料維護方法,更包括:當該預取區域已被寫滿並且需要載入新的該等資料鏈結關係集合時,判斷該非頻繁尾指標是否為該等共用指標中之任一者;當該非頻繁尾指標為該等共用指標中之任一者時,根據該非頻繁尾指標判斷該等非頻繁資料鏈結關係集合中最久未被讀取之該非頻繁資料鏈結關係集合;以及將該第一資料鏈結關係集合的資料寫入該等非頻繁資料鏈結關係集合中最久未被讀取之該非頻繁資料鏈結關係集合所屬的該區段。The data maintenance method according to item 11 of the patent application scope further includes: when the prefetch area is full and a new collection of these data link relationships needs to be loaded, determining whether the infrequent tail indicator is the shared indicator Any one of them; when the infrequent tail indicator is any of the common indicators, the infrequent data link in the infrequent data link relationship set that has not been read for the longest time is judged according to the infrequent tail indicator A relationship set; and writing the data of the first data link relationship set into the infrequent data link relationship set that has not been read for the longest time in the section to which the infrequent data link relationship set belongs. 根據申請專利範圍第15項之資料維護方法,更包括:當該非頻繁尾指標不是該等共用指標中之任一者時,將該頻繁尾指標中所儲存之該共用指標寫入該非頻繁尾指標,將該頻繁頭指標中所儲存之該共用指標寫入該非頻繁頭指標,並且刪除該頻繁尾指標以及該非頻繁尾指標中所儲存之該等共用指標。 The data maintenance method according to item 15 of the scope of patent application, further comprising: when the infrequent tail indicator is not any of the common indicators, writing the common indicator stored in the frequent tail indicator into the infrequent tail indicator , Write the common indicator stored in the frequent-head indicator into the infrequent-head indicator, and delete the frequent-tail indicator and the common indicators stored in the infrequent-tail indicator.
TW105132831A 2015-10-15 2016-10-12 Data storage device and data maintenance method thereof TWI646461B (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
TW105132831A TWI646461B (en) 2016-10-12 2016-10-12 Data storage device and data maintenance method thereof
CN201611044061.3A CN107943711B (en) 2016-10-12 2016-11-24 Data storage device and data maintenance method thereof
US15/613,342 US10073769B2 (en) 2015-10-15 2017-06-05 Data storage device and data maintenance method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW105132831A TWI646461B (en) 2016-10-12 2016-10-12 Data storage device and data maintenance method thereof

Publications (2)

Publication Number Publication Date
TW201814490A TW201814490A (en) 2018-04-16
TWI646461B true TWI646461B (en) 2019-01-01

Family

ID=61929006

Family Applications (1)

Application Number Title Priority Date Filing Date
TW105132831A TWI646461B (en) 2015-10-15 2016-10-12 Data storage device and data maintenance method thereof

Country Status (2)

Country Link
CN (1) CN107943711B (en)
TW (1) TWI646461B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112199304B (en) * 2019-07-08 2024-04-09 华为技术有限公司 Data prefetching method and device
CN111399784B (en) * 2020-06-03 2020-10-16 广东睿江云计算股份有限公司 Pre-reading and pre-writing method and device for distributed storage

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6993627B2 (en) * 2000-12-12 2006-01-31 International Business Machines Corporation Data storage system and a method of storing data including a multi-level cache
US7017024B2 (en) * 2002-12-12 2006-03-21 International Business Machines Corporation Data processing system having no system memory
US7058784B2 (en) * 2003-07-04 2006-06-06 Solid State System Co., Ltd. Method for managing access operation on nonvolatile memory and block structure thereof
TW200844840A (en) * 2007-05-09 2008-11-16 Phison Electronics Corp Secure storage apparatus and method for controlling the same
TW201027420A (en) * 2009-01-15 2010-07-16 Phison Electronics Corp Data accessing method for flash memory, and storage system and controller system thereof
TW201403451A (en) * 2012-07-05 2014-01-16 Compal Electronics Inc Control method of storage apparatus
TW201523247A (en) * 2013-12-04 2015-06-16 Silicon Motion Inc Data storage device and FLASH memory control method
TW201527971A (en) * 2013-12-26 2015-07-16 Silicon Motion Inc Data storage device and flash memory control method
TW201617876A (en) * 2014-11-03 2016-05-16 慧榮科技股份有限公司 Data storage device and flash memory control method
TWI537729B (en) * 2015-10-15 2016-06-11 慧榮科技股份有限公司 Data storage device and data maintenance method thereof
TW201631478A (en) * 2014-12-14 2016-09-01 上海兆芯集成電路有限公司 Prefetching with level of aggressiveness based on effectiveness by memory access type

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6067608A (en) * 1997-04-15 2000-05-23 Bull Hn Information Systems Inc. High performance mechanism for managing allocation of virtual memory buffers to virtual processes on a least recently used basis
WO2007072317A2 (en) * 2005-12-21 2007-06-28 Nxp B.V. Non-volatile memory with block erasable locations
CN103026346B (en) * 2010-07-27 2016-01-20 国际商业机器公司 For reading and write method and the storage system of data from solid-state memory device
TWI544334B (en) * 2012-05-30 2016-08-01 慧榮科技股份有限公司 Data storage device and operating method thereof
US20140304453A1 (en) * 2013-04-08 2014-10-09 The Hong Kong Polytechnic University Effective Caching for Demand-based Flash Translation Layers in Large-Scale Flash Memory Storage Systems
US20160070507A1 (en) * 2014-09-08 2016-03-10 Kabushiki Kaisha Toshiba Memory system and method of controlling memory device

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6993627B2 (en) * 2000-12-12 2006-01-31 International Business Machines Corporation Data storage system and a method of storing data including a multi-level cache
US7017024B2 (en) * 2002-12-12 2006-03-21 International Business Machines Corporation Data processing system having no system memory
US7058784B2 (en) * 2003-07-04 2006-06-06 Solid State System Co., Ltd. Method for managing access operation on nonvolatile memory and block structure thereof
TW200844840A (en) * 2007-05-09 2008-11-16 Phison Electronics Corp Secure storage apparatus and method for controlling the same
TW201027420A (en) * 2009-01-15 2010-07-16 Phison Electronics Corp Data accessing method for flash memory, and storage system and controller system thereof
TW201403451A (en) * 2012-07-05 2014-01-16 Compal Electronics Inc Control method of storage apparatus
TW201523247A (en) * 2013-12-04 2015-06-16 Silicon Motion Inc Data storage device and FLASH memory control method
TW201527971A (en) * 2013-12-26 2015-07-16 Silicon Motion Inc Data storage device and flash memory control method
TW201617876A (en) * 2014-11-03 2016-05-16 慧榮科技股份有限公司 Data storage device and flash memory control method
TW201631478A (en) * 2014-12-14 2016-09-01 上海兆芯集成電路有限公司 Prefetching with level of aggressiveness based on effectiveness by memory access type
TWI537729B (en) * 2015-10-15 2016-06-11 慧榮科技股份有限公司 Data storage device and data maintenance method thereof

Also Published As

Publication number Publication date
CN107943711B (en) 2020-10-16
CN107943711A (en) 2018-04-20
TW201814490A (en) 2018-04-16

Similar Documents

Publication Publication Date Title
TWI537729B (en) Data storage device and data maintenance method thereof
TWI653533B (en) Data storage device and method of operation thereof
KR101533744B1 (en) Flash memory system and method of flash translation layer design thereof
TWI587136B (en) Flash memory system and managing and collection methods for flash memory with invalid page information thereof
CN107102819B (en) Method and equipment for writing data into solid state disk
US10061693B2 (en) Method of generating secondary index and apparatus for storing secondary index
TWI431627B (en) Flash memory apparatus and method for operating a flash memory apparatus
Luojie et al. An improved analytic expression for write amplification in NAND flash
TW201245959A (en) Dynamic and static data for a system having non-volatile memory
JP2005267600A5 (en)
KR20130030238A (en) Faster tree flattening for a system having non-volatile memory
TW201917581A (en) Method for managing flash memory module and associated flash memory controller
CN107179880B (en) Storage device, control unit thereof and data moving method for storage device
KR20140006234A (en) Data storage device and operating method thereof
CN110647288A (en) Data storage device and cache shunting method thereof
CN111143285A (en) Small file storage file system and small file processing method
KR20130081526A (en) Storage device, electronic device having the same, and data management methods thereof
TWI646461B (en) Data storage device and data maintenance method thereof
JP4547028B2 (en) Nonvolatile memory with block management
TWI553481B (en) Data management method, writing management system and method thereof for solid-state drive
US9880930B2 (en) Method for operating controller and method for operating device including the same
US10073769B2 (en) Data storage device and data maintenance method thereof
CN112395260B (en) Data storage method and medium
US11055622B2 (en) Data storage apparatus with selective adaptive predictive behavior
US11249921B2 (en) Page modification encoding and caching