200926196 九、發明說明: 【發明所屬之技術領域】 種快閃記 本發明係有關於儲存裝置,尤苴 憶體儲存裝置。尤其更有關於 【先前技術】 ❹ L年來,快閃記憶體(Flash mem〇 速,其於儲存裝置上之運用亦日新月異,==:迅200926196 IX. Description of the invention: [Technical field to which the invention pertains] The invention relates to a storage device, and a storage device. Especially more about [previous technology] ❹ L years, flash memory (Flash mem speed, its use in storage devices is also changing, ==: fast
Mem〇ry Card )、隨身碟(Flash drive )之並及 e : 二,然而隨著快閃記憶體之技術曰趨成熟 低,各編開始投入大量資源研究 == 運用,如H1能締池/ ’ j °匕隐肢更廣泛之Mem〇ry Card), flash drive and e: 2. However, as the technology of flash memory matures, each editor has invested a lot of resources to research == use, such as H1 can pool / ' j °匕hidden limbs are more extensive
伟在也 lid彻eDiSk,SSD )即為一例,SSD 糸為以快閃記憶體做儲存媒體之純電 售保有快閃記憶體存取速度快 更寒機而其依 參 量輕、低震動與耐震動等=,=;:傳:=、重 潛力。 甚八有取代傳統磁性硬碟機之 快閃記憶體本身具有一明顯之缺點 一定限制,係對應於其抹除(Eras〇 中有其 閃記憶體之可抹除次數因製 數而疋,目前快 均約在1。萬次左右’二略有出入,平 資料越不穩定。因此,若 近極限,其所儲存之 命,將會為使用快閃之使用壽 置換成本,—硬碟::置 5 200926196 ’則其㈣之存取量及傳輸量又 卜=有储存os之儲存裝置(例如隨身碟、記憶卡)大 =二抹除次數亦會增加,因此,在快閃記憶體的硬體 衣=未有突破性進步的前提下,唯有不斷改良現已存在 : = =有效將抹除次數降到最低,使快閃記憶 耻之運用更為i廣且不受限制。 快閃記憶體的最小單位是頁面(Pag〇,複數頁面組 Ο -個區塊(Block)。而對快閃記憶體而言,儲存盘讀取 =以頁面為單位,而抹除則是以區塊為單位。快閃記憶 脰有一著名之特色’即^前抹除(E職before 赠)’即,只有被抹除過的空白區塊,其内部的頁面才 可被寫入新的資料。 習知的快閃記憶體儲存裝置儲存方法如圖一所示,當 -儲存裝置接收到一由外部主機所傳送之儲存指令時,: 同時接收到-邏輯區塊位址(LBA) ( su ),此時,該 ❹儲存裝置藉由-邏輯與實體位址對應表單(—ί〇 ' Physica丨TableMPTabie ),尋找出該儲存製置内之一快閃—己 憶體’其内部對應於該LBA之實體區塊位址(阳)。接 著,將對應至該LBA之區塊當做舊區塊,並找到一個空白 的新區塊(S13 ) ’先執行第—次反向複製(c— (。羊如下述)(S14 ) ’接著將該主機傳送過來的資料寫 入該新區塊後(S15 ),再執行第二次aw以也A ' (S16 )。當新區塊寫入完畢後,即修改該L2p表單 (S17 ),使該LBA對應至該新區塊,接著將該舊區塊抹 200926196 除’使其成為一空白之區塊(S18 ),以便後續其它資料 之儲存。隶後,判斷該主機欲傳輸之資料是否全部傳送完 畢’直到全部資料皆傳送完畢為止,始可停止。(S19 ) 例如,一區塊具有64個頁面,而該儲存裝置所接收之 LBA ,係對應至該快閃記憶體中之區塊1〇内的頁面u到頁 面42。該儲存裝置係先於該快閃記憶體中找到一個完全空 白之新區塊,例如區塊100 ,此時,因為該儲存裝置無法 判斷該區塊10中之頁面〇至頁面1〇是否存有資料,故,需 ❹先進行第-次Copy back,即將該區塊1〇内之頁面〇至頁面 10内之資料,複製至該區塊1〇〇之頁面〇至頁面1〇内。複 製完畢後,再將主機傳輸過來的資料,寫入該區塊1〇〇内 之頁面11至頁面42的位置。接著,因該儲存裝置亦無法判 斷該區塊10内之頁面43至頁面63内是否存有資料,故需進 行第二次的Copy back,將該區塊10内之頁面43至頁面肋内 之貧料,寫入該區塊1〇0内之頁面43至頁面63。而於寫入 ❹完畢後,將舊的區塊’即該區塊1〇抹除,成為一個完全空 白之新區塊’供後續其它資料寫入時運用。 上述之習知儲存方法具有一相當重大之缺點,使用該 種方法,只要寫入-筆資料至快閃記憶體,即需抹除一個 區塊一次,故將會使得快閃記憶體之抹除次數嚴重浪費。 例如,若該儲存裝置先後收到三筆資料,分別對應至該快 閃記憶體内之區塊10的頁面„至頁面15、頁面16至頁面、 20 ’及頁面21至頁面26時,雖然該三筆資料係為連續性的 資料,但因該三筆資料係分開傳送,故該儲存裝置並無法 7 200926196 得知該三筆資料係為連續,必須將該三筆資料分三次寫 入’因此’即需重覆執行上述之流程三次,即,需先後抹 除三個區塊共三次。但因該三筆資料係為連續之資料,故 若能使該三筆連續資料循序寫入後再執行Copyback,則只 需抹除一區塊,減少兩次抹除次數之浪費。而若該筆寫入 之連續性育料資料量非常大,則浪費掉的抹除次數即非 的可觀。 ❾—有鑑於上述缺憾’本發明人仍潛心研究,終於規劃出 —種儲存方法,可有效區分連續性資料與隨機資料並加以 儲存,徹底改善浪費快閃記憶體之抹除次數之現象。 【發明内容】 ,發:之主要目的,係在於提供—種快閃記憶體儲存 卿方法,使一儲存裝置於寫入資料時,能夠 _貝枓為連'_性資料或隨機資料, ;:料。後面尚有接續之資料,則不於二 畢後再執行,藉以避免該快閃記憶體之抹除次數之 為達上述目的,本發明係於—儲存 — 中規劃-位址暫存區’用以儲存資料之資舍一::體 機儲存—筆第一資料至該儲存裝置時°田夕部主 區判斷該筆γ置時,係透過該位址暫存 ㈣Μ貝枓疋否為-連續資料的… 表示該筆資料傳輸完畢後還有接續之第二資料、Π資: 8 200926196 二:中:ί不於該筆第一資料存入該儲存裝置内之-快閃記 刻進行重整,而係等待該筆連續資料全 旱刖7G畢,再進行重整。 【實施方式】 兹就本發明之一較佳實施例,配合圖式,詳細說明如 後。 ❹ 首明翏閱第二圖,係本發明之儲存裝置之架構圖,該 儲存^置⑴係主要包括—處理器(11),—隨機存取 記憶體(Random Access Memory,RAM )( 12 )、一悱鬥々 ρ 胜(FlashMemory) (13),及一程式單元(14)。其中, /私式單元(14 )係為一勒體程式,儲存於該儲存裴置 (1 )内之一唯讀記憶體(Read 0nly Mem〇ry,R〇M)或該快 閃δ己憶體(13 )中’但不可加以限定。 當一外部主機(2 )連接該儲存裝置(1 ),欲儲存 貧料至該儲存裝置(丨)時,該處理器〇1 )係接收該主 機(2 )所發出之一儲存指令及—邏輯區塊位址(⑽㈣ Block Address’LBA ),該處理器(u )收到該儲存指令後, 啟動該程式單元(14),該程式單元(14)分析該筆資料 之資訊後,係透過該記憶體(12)内之該位址暫存區、 (121 )中所儲存之各資料之資訊,將該筆資料以最合適Wei is also listed in eDiSk, SSD) as an example. SSD is a purely electric storage medium with flash memory. The flash memory has fast access speed and colder machine, and its parameters are light, low vibration and shockproof. Move, etc. =, =;: pass: =, heavy potential. The flash memory that replaces the traditional magnetic hard disk drive has a certain shortcoming and certain limitation, which corresponds to its erasing (the erasable number of flash memory in Eras〇 is due to the number of systems, which is currently fast Both are about 1 million times. 'There is a slight difference between the two. The more unstable the data is. Therefore, if it is near the limit, its life will be replaced by the life of the use of flash--hard disk:: 5 200926196 'The access volume and transmission volume of the (4) are also included. = The storage device (such as the flash drive, memory card) that stores os is large = the number of erasures will also increase, so the hardware in the flash memory Under the premise of no breakthrough progress, only continuous improvement has existed: = = Effectively minimizes the number of erasures, making the use of flash memory shame more widely and without limitation. Flash memory The smallest unit is the page (Pag〇, plural page group Ο - one block (Block). For flash memory, the storage disk read = page, and the erase is based on the block Flash memory has a famous feature 'that is ^ before erasing (E job befo Re gift) 'that is, only the erased blank block, its internal pages can be written to the new data. The conventional flash memory storage device storage method is shown in Figure 1, when - storage device Upon receiving a store instruction transmitted by an external host: simultaneously receiving a logical block address (LBA) (su), at this time, the storage device is represented by a logical-to-physical address corresponding form (_ί 〇 ' Physica 丨 TableMPTabie ), find a flash-repeated body in the storage system that corresponds to the physical block address (yang) of the LBA. Then, the block corresponding to the LBA is treated as Old block, and find a blank new block (S13) 'First perform the first reverse copy (c - (. sheep as described below) (S14) ' Then write the data transferred from the host to the new block (S15), and then executing the second aw with A' (S16). After the new block is written, the L2p form is modified (S17), so that the LBA corresponds to the new block, and then the old block is replaced. Wipe 200926196 except 'make it a blank block (S18) for subsequent information After the storage, it is judged whether the data to be transmitted by the host is completely transmitted 'until all the data is transmitted, and can be stopped. (S19) For example, one block has 64 pages, and the storage device receives The LBA corresponds to the page u in the block 1 in the flash memory to the page 42. The storage device finds a completely blank new block, such as the block 100, in the flash memory. At this time, because the storage device cannot determine whether the page in the block 10 has a file to the page 1 , it is necessary to perform the first copy back, that is, the page in the block 1 is dumped to the page 10 Copy the information to the page 1〇〇 of the block to page 1〇. After the copying is completed, the data transferred from the host is written to the position of page 11 to page 42 in the block 1〇〇. Then, because the storage device cannot determine whether there is data in the page 43 to the page 63 in the block 10, a second copy back is required, and the page 43 in the block 10 is in the page rib. The poor material is written to page 43 to page 63 in the block 1〇0. After the writing is completed, the old block ‘that is, the block is erased to become a completely empty new block' for use in subsequent writing of other data. The above conventional storage method has a considerable disadvantage. With this method, as long as the data is written to the flash memory, one block needs to be erased once, so that the flash memory is erased. The number of times is seriously wasted. For example, if the storage device receives three pieces of data in succession, respectively corresponding to the page „to page 15, page 16 to page 20', and page 21 to page 26 of the block 10 in the flash memory, although The three data are continuous, but because the three data are transmitted separately, the storage device cannot know that the three data are continuous and must be written in three times. 'The above process must be repeated three times, that is, three blocks must be erased three times in total. However, since the three data are continuous data, if the three consecutive data can be sequentially written, To perform Copyback, you only need to erase one block and reduce the waste of the number of erases twice. If the amount of continuous feed data written by the pen is very large, the number of erased erases is not significant. - In view of the above-mentioned shortcomings', the inventors are still concentrating on research, and finally plan a storage method, which can effectively distinguish and store the continuous data and random data, and completely improve the phenomenon of the number of erasures of wasted flash memory. Contents], the main purpose of the hairline is to provide a method of flash memory storage, so that when a storage device writes data, it can be _ Bellows as '_ sexual data or random data, ;: material. If there is any subsequent information, it will not be executed after the second pass, in order to avoid the erasure of the flash memory for the above purpose, the present invention is used in the - storage - planning - address temporary storage area Assets for storing data:: Body storage - When the first data is sent to the storage device, when the main area of the Tianxi Department judges that the γ is set, it is temporarily stored through the address (4) The data... indicates that there is a second data after the transmission of the data, and the capital: 8 200926196 2: Medium: ί is not stored in the storage device for the first data - flashing to re-tune, The system waits for the continuous data to complete the drought and then performs the reforming. [Embodiment] A preferred embodiment of the present invention, with reference to the drawings, will be described in detail later. Is a structural diagram of the storage device of the present invention, and the storage device (1) is It is to include a processor (11), a random access memory (RAM) (12), a flash memory (Flash Memory) (13), and a program unit (14). The private unit (14) is a program, stored in the storage device (1), a read-only memory (Read 0nly Mem〇ry, R〇M) or the flash-delta recall (13) In the 'but not limited. When an external host (2) is connected to the storage device (1) to store the lean material to the storage device (丨), the processor 〇1) receives the host (2) Sending a storage instruction and a logical block address ((10) (4) Block Address 'LBA), after receiving the storage instruction, the processor (u) starts the program unit (14), and the program unit (14) analyzes the pen After the information of the information, the information is most suitable through the information of the data stored in the address temporary storage area and the (121) in the memory (12).
之方式,寫入該快閃記憶體(13)中,對應至該lba之實 體區塊位址。 K 第三圖為本發明之記憶體内部配置圖,該儲存誓置 9 200926196 (1 )内之該記憶體(RAM ) ( 12 ),其内部主要規气有 一位址暫存區(),而該位址暫存區(121 )係可規 劃為複數由一 LBA攔位(12a )、一區段數襴位(12七) 及一使用攔位(12c )所組成之表單,每一表單分別用以 對應一筆大小為一區段之資料。該LBA攔位(12a )係用 以儲存資料之LBA,該區段數欄位(12b )係儲存資料之 總區段數,而該使用欄位(12c )係用以儲用一判斷參 數’藉以判斷此一表單是否已被參考過。The manner is written into the flash memory (13) corresponding to the physical block address of the lba. K is a diagram showing the internal configuration of the memory of the present invention. The memory is vomited to the memory (RAM) (12) in 200926196 (1), and the main internal air has an address temporary storage area (), and The address temporary storage area (121) can be planned as a form consisting of an LBA block (12a), a segment number (12), and a use block (12c), each form separately Used to correspond to a piece of data of a size. The LBA block (12a) is an LBA for storing data. The number of fields (12b) is the total number of segments in which data is stored, and the field (12c) is used to store a judgment parameter. To determine if this form has been referenced.
快閃記憶體寫入的最小單位為頁面,而頁面之大小係 與半導體之顆粒大小有關,下述將以一頁面大小512办把 為,,剛好等於—個區段之大小,而區段即為電腦傳輸時 之最小單位。例如,當一第一資料被寫入時,該程式單元 04)分析該第一資料之資訊,發現該第一資料之為 勘,總區段數為128,即於該記憶體(12)内之該位址 暫f區(121 )内,新增一表單,將該筆資料之LBA與總 區段數’寫人該表單中之LBA攔位(12a )及區段數棚^ (fb ),並將使用攔位(12c )設為〇。接著,當再有 一第二資料寫入,且該程式單元Π4)分析出該第資料 ^ LBA為228日夺,因為上述第一資料之LBA4 1〇〇,而區 2為128 ’即,該第一資料係由lbai〇〇的位置開始,連 =门28頁’而該第二資料之服為228,因此,該程 1:70、Π4)即判斷該第二資料係為該第-資料之-後續 = 亚在儲存與CGpybaek動作執行完成後,把對應至該 貧料之表單’即該第—㈣之表單内之使用欄位 200926196 (】2c )設為】,表八 μ — 收到該第一資料之接—貧料已被參考過,即,已接 搜尋該表單,藉以、二…、。下次搜尋動作開始,即不再 稭以加快搜尋之動作。 丹 本發明之儲存方、本 , 數’判斷寫入之資料1丕泛要係藉由寫入資料之總區段 寫入之資料為—連續性資料之最二:枓,敢後-筆’若 ❹ 待宜它條株即直接進行牆,而不再等 待其匕條件或指令,詳細說明如下。 再專 經本發明人努力實驗過後 傳輸資料時,為了要維拉胁±謂4主機而吕,在 區段數皆會相同,下;^^輸之逮度’每筆傳輸資料之總 认τ…1 稱為一臨界值(加姻)。惟, 於不间的作m或作n統下之 同之臨界值,因此,嗜陟尺伯、飞曰具有不 °亥&°界值必須經由統計並校正來取 仔。而、料之方法係於1體内設置n 送一筆資料時,該儲存f 田只主機傳 廿衣罝你侍到忒葦資料之LBA及總區 &數’此係比較該變數與該筆資料之總區段數,若該 變數小於該總區段數,即表示該變數所記載之數值並非是 該系統下之-臨界值,即將該變數之數值更改為該總區段 數。而經過多次之校正之後,即會得到—穩定的臨界值。 但此僅為-較佳的實施方式,不加以限定。例如在微軟公 司的WindowsXP作業系統下使用32位元資料配置表(扔化The minimum unit of flash memory write is the page, and the size of the page is related to the particle size of the semiconductor. The following will be done with a page size of 512, which is exactly equal to the size of the segment, and the segment is The smallest unit for computer transmission. For example, when a first data is written, the program unit 04) analyzes the information of the first data, and finds that the first data is an image, and the total number of segments is 128, that is, in the memory (12). In the temporary f area (121) of the address, a new form is added, and the LBA and the total number of sections of the data are written as the LBA block (12a) and the number of sections in the form (fb). And set the use block (12c) to 〇. Then, when there is another second data to be written, and the program unit Π4) analyzes that the first data ^ LBA is 228 days, because the first data of the LBA4 1〇〇, and the area 2 is 128 ', that is, the first A data is started by the location of lbai〇〇, even = page 28' and the second data is 228. Therefore, the process 1:70, Π4) determines that the second data is the first data. - Subsequent = After the execution of the CGpybaek action is completed, the usage field corresponding to the form of the poor material, that is, the usage field 200926196 (] 2c) in the form of the first (4) is set to 】, Table 8 μ - received The first data is connected - the poor material has been referenced, that is, it has been searched for the form, borrowed, two...,. The next time the search action begins, it will no longer be used to speed up the search. The storage method, the number of the invention, and the number of the data written by the judges are generally written by the total section of the written data—the second of the continuous data: 枓, 敢后-笔' If it is appropriate to carry out the wall directly, and no longer wait for its conditions or instructions, the details are as follows. In the case of the inventor's efforts to transfer the data after the experiment, in order to ask for the threat of the standard, the number of segments will be the same, the next; the probability of the ^^ loses the total recognition of each transmission data τ... 1 is called a critical value (plus marriage). However, in the case of m or the same threshold value under the system, therefore, the ambiguity and the 曰 曰 have to be counted by statistics and correction. However, the method of the material is set in a body setting n to send a piece of information, the storage f field only host the 廿 罝 侍 侍 侍 侍 侍 侍 侍 侍 L L L L L L L L L L L L L L L L L L L L L L L The total number of segments of the data. If the variable is less than the total number of segments, it means that the value recorded in the variable is not the -threshold value under the system, that is, the value of the variable is changed to the total number of segments. After a number of corrections, a stable threshold is obtained. However, this is only a preferred embodiment and is not limited. For example, using Microsoft's Windows XP operating system to use a 32-bit data configuration table (throwing
AllocationTable-32bit,FAT32)格式之主機下,每筆傳輸資料 之總區段數皆維持在128個區段;而在使用新的技術檔案 系統(New Technology File System,NTFS )格式之主機下,每 200926196 筆傳輪資料之總區段數皆維持在64個區段。只有當主機所 傳輸之資料是一筆未滿該臨界值大小之隨機資料,或一連 、戈!生貝料之最後—筆時’才可能會小於該臨界值。但此僅 為本發明之一較佳具體實施例,不可加以限定。 一故,若該儲存裝置(1 )接收一筆資料,且該程式單 兀(14 )彳于知該筆資料之總區段數等於該臨界值,則該資 料極有可能為一連續性資料之其_一筆,且可能具有接續 之下「筆資料尚未寫入,因此,不在該筆資料寫入後,立 即進订Copyback ;反之,若接收之資料區段數小於該臨界 值’則該資料可能為—隨機資料,或,—連續性資料之最 ^筆此時,即在该筆資料寫入後,立即進行Copy Μ :將資料重整,使該快閃記憶體(13)中之區塊,不 致被尚未執行Copyback之資料佔滿’產生沒有區塊可用以 儲存資料’或提供資料用以重整之情形。詳細說明如下述 第四圖之儲存流程圖。 ❹ 、、“如第四圖所示,為本發明之一較佳具體實施例之儲存 ’L釭圖田外部主機欲儲存一筆資料至該儲存裝置 (1 )時,該冑存裝置係收到該筆資料之一儲存指令及一 (切)’接著取得該筆資料之總區段數,判斷該資 枓之總區段數大小是否等於一臨界值(奶),若該筆資 段數等於該臨界值,該程式單元(Μ)係檢查該 子區?"内是否具有對應該筆資料之_之表 : S沒有’則表示該筆資料為-連續性資料之 弟一葦’即於該位址暫存區内新增„表單,將該筆資料之 12 200926196 LBA寫人該表單内之LBA攔位(12a ),總區段數寫入區 段數攔位(12b ),而將使用攔位(12c )設為〇 ❹ ❹ (S24 ),並至該快閃記憶體(13)内搜尋一個完全空白 之區塊,將資料寫入(s25);若該位址暫存區(12Γ) 内具有對應於該筆資料之LBA之表單,則表示該筆資料為 =續性資料之其中一筆’即新增一第二表單,於該位址 暫存區(⑵)内新增一第二表單,將該筆資料之資驾 入該第二表單㈣對之攔位,接著’料應於該筆資料之 腿之表單内之使用欄位(α )修改為!( S26 )。表 不此-表單已被參考過,且其之後續資料已被傳輸並寫义 二:3ΓΓ跳過該ί單。表單更新完後,即將該 s ;、;、:、所多考之該表早所對應之資料所在之區塊中 上:)。最後,判斷該主機(2)欲傳輪之資料是否已 專二完畢(S28 ) ’直至資料全部傳輸完畢 ^二當㈣存袭置之硬體條件符合,或是該外部主機發 (c 時’該快閃記憶體(13)即執行反向複製 (Copyback )之動作(S29 ),而 是衣 任-條件符合時,執行Copyback之動作:二::等:直至 儲存裝置之硬體條件,係於資料存放之時門 畔佶砵、姑+次、,,、, 子欲之日守間或數量超過預 该快閃⑽應之表單將被刪除或覆蓋、斷電或 符合資料被更新時符合,而當條件 仃口 t即執仃Copy back之動作,但此僅 施例’任何熟悉本項技術之人必 _ = 流程規劃之重點,而於任何適 之動作可視 丁 u執仃,不可加以 200926196 限定。 ❹ ❹ 若該筆資料之總區段數不等於該臨界值(A),該程 式單元(14 )亦檢查該位址暫存區(121 )内是否呈有對 應該筆資料之LBA之表單(S2〇,若沒有,則表示該筆 資?為-隨機資料,即搜尋一個完全空白之新區塊,將該 筆貝料寫入(创),並隨即執行Copy back ( S2c );而 :該位址暫存區(121 )内具有對應該筆資料之肌之表 單i表示ίί筆資料係為一連續性資料之最後一筆,即新增 一第二表單,將該筆資料之資訊寫入該第二表單内相對之 搁位,並將對應於該筆資料之LBA之表單内之使用搁位 (二2c二)t改為丨(S2d ),接著,將該筆資料寫入其所 二之》亥表單所對應之資料所在之區塊中(幻e ),並執 行Copy back ( S2c )。最後,判斷該主機欲傳輸之資料是 = 專輸凡畢(S2f) ’直至資料全部傳輸完始 可停止。 上述貫把例’係主要用以處理連續性資料,但仍無法 處理隨機資料,因隨機資料皆 _ 白马早一筆的小貧料,且存取 率非$大,故其所造成之抹除率 乂 休1示半也相當尚,為解決此一問 碭’本發明人係更提出另一每 r 1 . 貝、轭例,如第五圖所示,係於 °則6#存表置(1 )内設罟_ 附加之揮發性記憶體 I Volatility memory ) Ms、 ^ , -A h ^ , ),藉由揮發性記憶體沒有抹除 -人數上限之特色,處理該4b f —機貝枓,並於外部主機 )务出扣々、斷電或該附加 %、、其Η车,、隹—舌針 °己L肢(15 )内部空間被 舄/雨柃,進仃重整,將暫存 仔於5亥附加記憶體(15 )内之資 14 200926196 料寫入該快閃記憶體(13)内。並另外增設—充電裝置 (16),例如電池、電容等等,用以提供該附加記憶體 〇5) —電源,使資料得以持續的存在於該附加記憶體 (15 )内,不致因意外斷電而導致該附加記憶體 之資料消失。 ν 7 η 一第’、圖係為本發明之附加記憶體之内部配置圖,如圖 所不’該附加記憶體(15 )内部規劃為一管理【" Ο ❹ 及-資料配置區(152),其中,該資料配置區(152) 係用以儲存外部主機(2)所傳送之資料,而該管理區 (⑸)係可規劃為複數由—似欄位(⑸)、 體位置欄位(15b )、一佟故捫你广,、 ^ 6改欄位(15c )及一讀取攔位 、、域之表單。該LBA欄位(15a ) 以儲存該 ^ ( 2 )所傳送來之資料之咖;該記憶體位置搁位 帛以儲存5亥些資料於該資料配置區(152 )中所 ^ ·之位置’係與該LBA攔位(❿)内之表單互相對 :::二改欄位(15〇及該讀取欄位(15〇係用以 =该些存在資料配置區(152 )内 了些醒新增或修改時,係將該修改搁位(15〇加田 該f資料被讀取時,將該讀取欄位…)加 存ft 1 了:::率較高之隨機資料往前移,提高該儲 存破置(1 )修改與讀取該些資料時之速度。 續見第七圖’為本發明之足 流程圖,當該儲存装置(=一較佳具體實施例之儲存 儲存指令及_咖=3内:該處理器(11)收到— 、) ’先取得欲寫入之資料之總 200926196 區段數,判斷該資料之總區段數是否等於臨界值 (S32 ),若等於,表示該筆資料可能為 了最後一筆外夕紅隹 》 文只『生貝料除 位址暫存區(⑵)與該管理區(⑸)内)/欢查该 筆資料之LBA相對岸之表單f a , 疋否具有與該 暫存區(⑵)㈣㈣應㈣筆#敎咖之^位^ 該管理區(⑸)中亦具有對應之 二理= ❹ 。5"内之表單,及該資料暫存區(心:::㈣ 相對應之位置之資料(S35 ) 人》亥表單 …内新增= - = )二者於該位址暫存區In the AllocationTable-32bit, FAT32 format host, the total number of segments per data is maintained in 128 segments; and under the host of the new Technology File System (NTFS) format, each host 200926196 The total number of segments of the pen pass data is maintained in 64 segments. Only when the data transmitted by the host is a random data that is less than the critical value, or a series, Ge! The final - raw time of the raw material is less than the critical value. However, this is only a preferred embodiment of the present invention and cannot be limited. For a reason, if the storage device (1) receives a piece of data, and the program number (14) is such that the total number of segments of the data is equal to the threshold, the data is most likely a continuous data. It is _ a sum, and may have the following "pen data has not been written, therefore, the copyback is not immediately after the data is written; conversely, if the number of received data segments is less than the critical value, then the data may be For the random data, or, - the most consistent data, at this time, that is, after the data is written, copy Μ immediately: the data is reformed to make the block in the flash memory (13) It shall not be occupied by the data that has not been executed by Copyback 'generate no block available to store data' or provide information for reorganization. Detailed description of the storage flow chart as shown in the fourth figure below. ❹ ,, "As shown in the fourth figure As shown in the preferred embodiment of the present invention, when the external host wants to store a piece of data to the storage device (1), the storage device receives a storage instruction for the data and One (cut)' then get the pen The total number of sectors of material, whether or not the total number of segments of the data contains size equal to a threshold value (milk), if the sum of the number of funding period is equal to the threshold value, the program unit ([mu]) of the sub-region based check? "Do you have a table corresponding to the pen data: If there is no ', then the data is the same as the younger brother of the continuous data', and the new form is added to the temporary storage area of the address. 12 200926196 LBA writers the LBA block (12a) in the form, the total number of segments is written to the segment number block (12b), and the use block (12c) is set to 〇❹ ❹ (S24), and Searching for a completely blank block in the flash memory (13), writing data (s25); if the address temporary storage area (12Γ) has a form corresponding to the LBA of the data, The information is one of the = renewed materials', that is, a second form is added, and a second form is added in the temporary storage area ((2)) of the address, and the information is driven into the second form. (4) To block the position, then the material field (α) in the form of the leg of the data should be modified to! (S26). The table is not this - the form has been referenced, and the subsequent information has been Transfer and write 2: 3 ΓΓ Skip the ί. After the form is updated, the s ; , ; , :, the multi-test of the table corresponding to the earlier information In the block:: Finally, judge whether the host (2) wants to pass the data has been completed (S28) 'un until the data is completely transferred ^ two (4) insured the hardware condition is met, or It is the external host sends (when the flash memory (13) performs the reverse copy (Copyback) action (S29), but the clothing-condition is met, the Copyback action is performed: 2::etc: Until the hardware condition of the storage device is at the time of storage of the data, the form of the door, the number of times, the time of the child's desire, or the number of copies exceeding the pre-flash (10) will be deleted or overwritten. Power failure or compliance data is updated when the data is updated, and when the condition is t 即 即 仃 仃 Copy back action, but this example only 'anyone familiar with this technology must _ = the focus of process planning, and any suitable The action can be seen as limited by 200926196. ❹ ❹ If the total number of segments of the data is not equal to the threshold (A), the program unit (14) also checks the address temporary storage area (121). Is there a form for the LBA that corresponds to the pen data (S2〇, if not, the form Show the capital? is - random data, that is, search for a completely blank new block, write the pen and material (create), and then execute Copy back (S2c); and: the address temporary storage area (121) The form i with the muscle corresponding to the pen data indicates that the 资料 笔 pen data is the last one of the continuous data, that is, a second form is added, and the information of the data is written into the relative position in the second form. And change the use position (2 2c 2) t in the form corresponding to the LBA of the document to 丨 (S2d), and then write the data into the data corresponding to the "Hai" form of the second In the block (phantom e), and execute Copy back (S2c). Finally, it is judged that the data to be transmitted by the host is = S2f) until the data is completely transmitted. The above-mentioned example is mainly used to process continuous data, but it is still unable to process random data. Because random data is _ white horse's early small poor material, and the access rate is not large, so the erasure rate caused by it乂休1 shows half and is quite good. In order to solve this problem, the inventor has proposed another example of every r 1 . Bay, yoke, as shown in the fifth figure, and is attached to the 6# table. 1) Set 罟_Additional volatile memory I Volatility memory ) Ms, ^ , -A h ^ , ), by the volatile memory is not erased - the upper limit of the number of features, the treatment of the 4b f - machine shell And in the external host) to pay the buckle, power off or the additional%,, its brakes, 隹-tongue needle ° own limbs (15) internal space was smashed / rain, re-construction, will temporarily The deposit 14 200926196 is stored in the flash memory (13). And additionally, a charging device (16), such as a battery, a capacitor, etc., is provided for providing the additional memory 〇5)-a power source so that the data is continuously present in the additional memory (15) without being accidentally broken. The data that caused the additional memory disappeared. ν 7 η 一 ', the diagram is the internal configuration diagram of the additional memory of the present invention, as shown in the figure, the additional memory (15) is internally planned as a management [" ❹ ❹ and - data configuration area (152 The data configuration area (152) is used to store the data transmitted by the external host (2), and the management area ((5)) can be planned as a plural number-like field ((5)), the body position field (15b), one is why you are wide, ^ 6 change field (15c) and a read block, domain form. The LBA field (15a) is used to store the data transmitted by the ^ ( 2 ); the memory location is placed to store 5 pieces of information in the data configuration area ( 152 ) The form is opposite to the form in the LBA block (❿)::: two changes to the field (15〇 and the read field (15〇 for = some of the existing data configuration area (152)) When adding or modifying, the modification is put on the shelf (15 〇 加田, when the f data is read, the read field...) is stored ft 1 ::: The random data with a higher rate is moved forward. Increasing the storage break (1) the speed at which the data is modified and read. Continuing to see the seventh figure 'is a flow chart of the present invention, when the storage device (= a storage storage instruction of a preferred embodiment and _ 咖 = 3: The processor (11) receives -,) 'First obtain the total number of 200926196 segments of the data to be written, determine whether the total number of segments of the data is equal to the critical value (S32), if equal , indicating that the information may be for the last eve of the red 隹 文 》 》 》 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 『 Check the LBA relative bank form fa of the data, and whether it has the corresponding storage area ((2)) (4) (4) should (4) pen #敎咖之位^ The management area ((5)) also has the corresponding two rationale = ❹. 5" inside the form, and the data temporary storage area (heart::: (4) corresponding position information (S35) people" Hai form... new = - = ) both in the address temporary storage area
^ 表早,並將對應於該筆資料之LBA^ Table early, and will correspond to the LBA of the data
之表早内之使用欄位(12c )修改 BA 表單已祐夹去、ft ( S36 ) ’表示該 早被> 考過,接者,將該筆 資料所在之區塊中(S37 ).而—气°亥表早所對應之 具有對應之表單時,則不更新其 内不 暫存區(⑸),即,不使^官王區(151 )與該資料 _ 、隹 不使用该附加記憶體(15 ),直接 進仃步驟S36及步驟S37之動 直接 (12〗)内不具有對應於該筆資料lb 子匕 斷該管理區(121 )内3本士… 、早,則亦需判 表單(跳),若對應於該筆資料之LBA之 係更新該管襲㈠515“ )内具有對應之表單, (⑸)中財二2之表單’及該資料暫存區 亥表早相對應之位 於該位址暫存區(⑵)内新增—表卜接著 快閃記憶體(13)内找一個—八 (a),亚於該 A ( S3b ) 〇 β-Μ , 凡王二白之新區塊,將資料寫 )判斷資料是否全部傳輸完畢 200926196 S3c ) ’直到全部都傳輸完畢為正,始可結束。並等到 上述實施例中之該些條件符合時,對該快閃記憶體進行In the early use of the table (12c), the BA form has been modified, and ft (S36) ' indicates that it has been tested earlier, and the receiver is in the block where the data is located (S37). - When the corresponding form is corresponding to the gas table, the non-temporary area ((5)) is not updated, that is, the ^wangwang area (151) and the data _, 隹 are not used. The body (15) directly enters the step S36 and the step S37. The direct (12) does not have the corresponding information in the lb sub-segment, and the 3 persons in the management area (121) are cut off. Form (jump), if the LBA corresponding to the data is updated, the tube attack (a) 515" has a corresponding form, ((5)) the form of the middle 2nd 'and the data temporary storage area table early corresponds to Located in the temporary storage area of the address ((2)), add a new table - then find one in the flash memory (13) - eight (a), the same as the A (S3b) 〇β-Μ, where Wang Erbai In the new block, write the data) to determine whether the data has been completely transmitted. 200926196 S3c ) 'Until all the transmissions are completed, the process can be completed. Examples of the plurality of conditions are met when the flash memory for
Copy back 的動作(S3d )。 若該資料之總區段數不等於該臨界值,則表示該筆資 料可能為一隨機資料,或一連續性資料之最後一筆。若該 資料為Hi·生資料之最後一筆,即,若於步驟级後, 該程式單元(14)發現該位址暫存區(121 )内具有對應 於省筆貝料之LBA之表單時,係接著判斷該管理區 ❹(^)内是否具有對應之表單(S3f),若有,即更新 該官理區(151 )内之表單,及該資料暫存區(152 )中 與該表單相對應之位置之資料(吨);若沒有,則不使 用=附加2憶體。接著,於該位址暫存區(121 ) /第二表單,並將對應於該筆資料之LBA之表單内之使用 搁位(12c )修改為!( S3h ),表示該表單已被參考 過’接著’將邊筆資料寫入該表單所對應之資料所在之區 瘳塊中(SM ),並於寫入後,執行匚叩丫 的動作 (S3j );而若該筆資料為一隨機資料,即若於步驟s知 後該転式單元(14 )發現該位址暫存區内並不具有對應 於該筆資料LBA之表單時’則亦需判斷該管理區(151 ) 内是否具有對應之表單(S3k ),若有,則將該筆資料寫 入该附加s己憶體(15)中之該資料暫存區(152 )内 (S3m ),並於該管理區(151 )内之新增一表單 (S3n),使該表單得以對應至儲存於該資料暫存區 (152 )内之該筆資料;而若該管理區(151 )内沒有對 200926196 應之表單,則需於該快閃記憶體(13)内找—個完全办白 之新區塊將資料寫入,並複製至該附加記憶體(15);之 該資料暫存區(152 )内(咖),接著於該管理區 (151 )内新〜表單(S3p ),使該表單得以對應至 存於該資料暫存區(152)内之該筆資料,接著,㈣快 閃兄憶體(13)執行Copyback的動作(S3j ) 斷資料是否已全部傳輸完畢(S3q),直至完畢後, 停止。 ° Ο 而儲存於該附加記憶體(15)内之該 於該主機(2)發出指令,斷 ^科係 預設值等等情況時,執行重整動作1科之存放時間超過 該快閃記憶體(Β)内動作’將該些隨機資料存回 以上所述僅為本發明之較佳且雕容 本發明之#利鉻Pi m /、肢只例,非因此即拘限 ❹ =^專t圍,故舉凡運用本發明内容所為之等效變 化,均同理皆包含於本發明之範圍内,合予陳明。 【圖式簡單說明】 第-圖係習知之快閃記憶體儲 第二圖係本發明之儲在#罢^ 夏之彳4存_&圖。 * 一 3之储存裝置之架構圖。 弟三圖係本發明之記憶體㈣配 第四圖A、β係本發明之一二一 圖。 佺具體貫施例之儲存流程 =::明之_置之另-架構圖 “圖係本發明之附加記憶體之内部配置圖。 200926196 第七圖A、B係本發明之另一較佳具體實施例之儲存流程 圖。 【主要元件符號說明】 1…儲存裝置 11…處理器 12…記憶體 121…位址暫存區 12a…LBA攔位 12b…區段數欄位 12c使用攔位 13…快閃記憶體 14…程式單元 ❹ 15…附加記憶體 151…管理區 152…資料配置區 15a…LBA欄位 15b…記憶體位置搁位 15c…修改攔位 16…充電裝置 2…外部主機 15d…讀取欄位 811〜819,321〜829,82&〜82【,831〜839,83&〜83卩...步驟 〇 19Copy back action (S3d). If the total number of segments of the data is not equal to the threshold, it indicates that the data may be a random data or the last of a continuous data. If the data is the last one of the Hi-sheng data, that is, after the step level, the program unit (14) finds that the address temporary storage area (121) has a form corresponding to the LBA of the pen-saving material. Then, it is determined whether the management area (^) has a corresponding form (S3f), and if so, the form in the official area (151) is updated, and the data temporary storage area (152) is associated with the form. Corresponding location information (tons); if not, then do not use = add 2 recall. Next, in the address temporary storage area (121) / second form, and modify the use of the position (12c) in the form corresponding to the LBA of the data to! (S3h), indicating that the form has been referenced to 'Next' to write the pen-pen data into the block (SM) where the data corresponding to the form is located, and after writing, perform the action (S3j) And if the data is a random data, that is, if the 单元 unit (14) finds that the address in the temporary storage area does not have a form corresponding to the LBA of the data after the step s, then Determining whether there is a corresponding form (S3k) in the management area (151), and if so, writing the data into the data temporary storage area (152) in the additional suffix (15) (S3m) And adding a form (S3n) in the management area (151) to enable the form to correspond to the data stored in the data temporary storage area (152); and if the management area (151) If there is no form for 200926196, it is necessary to find a new block in the flash memory (13) to write the data and copy it to the additional memory (15); the data temporary storage area (152) inside (coffee), then in the management area (151) new ~ form (S3p), so that the form can be corresponding to the information stored in The series within the memory area (152), then, (iv) fast brother flash memory (13) whether to perform an action Copyback (s3j) off all transmission data has been completed (S3q), until after completion stopped. ° Ο stored in the additional memory (15) when the host (2) issues an instruction, breaks the default value of the department, etc., the execution of the reorganization action 1 section of the storage time exceeds the flash memory Intra-body (Β) action to store the random data back to the above is only preferred of the present invention and engrave the #利铬Pi m /, limb example of the present invention, and therefore is not limited to ❹ = ^ The equivalent changes of the present invention are all included in the scope of the present invention and are combined with Chen Ming. [Simple description of the figure] The first picture is the flash memory storage of the conventional figure. The second picture is the storage of the invention in the # strike ^ 夏之彳4存_& diagram. * Architecture diagram of a storage device. The third figure is the memory (4) of the present invention. The fourth figure A and the β are one of the two figures of the present invention.储存 储存 佺 = = = = = = = = = = = = = = 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 Storage flow chart of the example. [Main component symbol description] 1...Storage device 11...Processor 12...Memory 121...Address temporary storage area 12a...LBA stop 12b...Section number field 12c uses the block 13...fast Flash memory 14...program unit ❹15...addition memory 151...management area 152...data configuration area 15a...LBA field 15b...memory location shelf 15c...modification block 16...charge device 2...external host 15d...read Take the fields 811~819, 321~829, 82&~82[, 831~839, 83&~83卩...step 〇19