TWI455135B - Flash-based storage device and data writing method for the same - Google Patents
Flash-based storage device and data writing method for the same Download PDFInfo
- Publication number
- TWI455135B TWI455135B TW099118899A TW99118899A TWI455135B TW I455135 B TWI455135 B TW I455135B TW 099118899 A TW099118899 A TW 099118899A TW 99118899 A TW99118899 A TW 99118899A TW I455135 B TWI455135 B TW I455135B
- Authority
- TW
- Taiwan
- Prior art keywords
- block
- written
- data
- flash memory
- storage device
- Prior art date
Links
Description
本發明係關於一種資料寫入方法,更特別的是本發明關於一種以快閃記憶體為基礎的儲存裝置的資料寫入方法以及採用該寫入方法的儲存裝置。 The present invention relates to a data writing method, and more particularly to a data writing method for a flash memory-based storage device and a storage device using the same.
在現今,快閃記憶體(flash memory)的使用變的更為普遍且可以儲存的資料量亦逐漸增加。快閃記憶體為一種電子可刪除可程式化唯讀記憶體(electrically erasable programmable read only memory,EEPROM)。與一般的電子可抹除可程式化唯讀記憶體不同的是,快閃記憶體一次可以刪除一個區塊(block)。快閃記憶體的區塊大小會隨著不同種類的快閃記憶體裝置而有所不同。快閃記憶體裝置一般而言為輕薄短小且消耗相當低的電量。因此,快閃記憶體對於消費性電子產品是相當適合的。 Nowadays, the use of flash memory has become more common and the amount of data that can be stored has gradually increased. The flash memory is an electrically erasable programmable read only memory (EEPROM). Unlike general electronic erasable programmable read-only memory, flash memory can delete a block at a time. The block size of the flash memory will vary with different types of flash memory devices. Flash memory devices are generally thin, light, and consume relatively low amounts of power. Therefore, flash memory is quite suitable for consumer electronics.
一般而言,以快閃記憶體為基礎的儲存裝置,例如固態磁碟(solid state disk,SSD)或是USB隨身碟(USB handy drive),皆透過標準FAT(file allocation table)或NTFS(new technology file system)的檔案系統來進行檔案存取控制。然而,當以快閃記憶體為基礎的儲存裝置應用於工業化電腦 (industrial PC)時,在某些應用上需要做到防止資料遭到修改,或需要保留重要資料的操作記錄(log)。因此,便有需要組態設定以快閃記憶體為基礎的儲存裝置的控制器來限制每一個磁區的寫入,讓每一個磁區只能寫入一次或是寫入一預定的寫入次數,以防止某些資料被覆寫或清除。本發明的提出便是用來解決這個需求。 In general, flash memory-based storage devices, such as solid state disks (SSDs) or USB handy drives, use standard FAT (file allocation table) or NTFS (new). The file system of the technology file system is used for file access control. However, when a flash memory-based storage device is applied to an industrial computer (industrial PC), in some applications, it is necessary to prevent the data from being modified, or to keep a record of the important data. Therefore, there is a need to configure a controller that sets the flash memory-based storage device to limit the writing of each magnetic zone so that each magnetic zone can be written only once or written to a predetermined write. The number of times to prevent certain data from being overwritten or erased. The present invention has been made to address this need.
本發明的一目的在於提供一種以快閃記憶體為基礎的儲存裝置,其可在當資料欲寫入已經被寫入一預定寫入次數的快閃記憶體的區塊時,禁止該區塊被資料寫入。 It is an object of the present invention to provide a flash memory-based storage device that can disable a block when it is to be written into a block of flash memory that has been written for a predetermined number of writes. Written by the data.
本發明的另一目的在於提供一種用於以快閃記憶體為基礎的儲存裝置的資料寫入方法,其可在當資料欲寫入已經被寫入一預定寫入次數的快閃記憶體的區塊時,禁止該區塊被資料寫入。 Another object of the present invention is to provide a data writing method for a flash memory-based storage device, which can be used when a data is to be written into a flash memory that has been written for a predetermined number of writes. When the block is blocked, the block is prohibited from being written by the data.
本發明的以快閃記憶體為基礎的儲存裝置主要包含一快閃記憶體,具有複數個區塊,以及一快閃控制器,其具有一主要對照表與複數個次要對照表,其中每個次要對照表記錄一區塊的操作記錄,以及一資料存取控制單元,其係設定為經由該次要對照表允許所有區塊被資料寫入一預定的寫入次數,並且在資料欲寫入的區塊已經被寫入該預定寫入次數時,禁止該區塊被資料寫入。 The flash memory-based storage device of the present invention mainly comprises a flash memory having a plurality of blocks, and a flash controller having a main comparison table and a plurality of secondary comparison tables, wherein each A secondary comparison table records an operation record of a block, and a data access control unit is configured to allow all blocks to be written by a predetermined number of writes via the secondary comparison table, and When the written block has been written to the predetermined number of writes, the block is prohibited from being written by the data.
此外,本發明的資料寫入方法係用於以快閃記憶體為基礎的一儲存裝置,其中該快閃記憶體具有複數個區塊且該儲存裝置具有複數個次要對照表以記錄該等區塊的操作狀態,其中該次要對照表具有指示該區塊是否能夠被寫入的一旗標,該寫入方法包含下 列步驟:(I)判斷欲資料寫入的區塊的次要記錄表中的旗標是否在活動的狀態,以及(II)若欲資料寫入的區塊的次要記錄表中的旗標並非在活動的狀態,禁止該區塊被資料寫入。 In addition, the data writing method of the present invention is for a flash memory-based storage device, wherein the flash memory has a plurality of blocks and the storage device has a plurality of secondary look-up tables to record the An operational state of the block, wherein the secondary look-up table has a flag indicating whether the block can be written, the write method includes Column step: (I) determining whether the flag in the secondary record table of the block to which the data is to be written is in an active state, and (II) the flag in the secondary record table of the block to which the data is to be written. Not in the active state, the block is prohibited from being written by the data.
100‧‧‧以快閃記憶體為基礎的儲存裝置 100‧‧‧Flash memory-based storage devices
102‧‧‧快閃控制器 102‧‧‧Flash controller
104‧‧‧快閃記憶體 104‧‧‧Flash memory
1022‧‧‧隨機存取記憶體 1022‧‧‧ Random access memory
1022a‧‧‧主要對照表 1022a‧‧‧ main comparison table
1022b‧‧‧次要對照表 1022b‧‧‧ secondary comparison table
1024‧‧‧控制邏輯 1024‧‧‧Control logic
1024a‧‧‧資料存取控制單元 1024a‧‧‧ Data Access Control Unit
202‧‧‧邏輯區塊編號 202‧‧‧Logic block number
204‧‧‧實體區塊編號 204‧‧‧Physical block number
206‧‧‧寫入計數器 206‧‧‧Write counter
208‧‧‧寫入致能旗標 208‧‧‧Write enable flag
前述說明以及本案的其他特點與優點將藉由下面說明參考所附圖示而得到最佳的了解,其中:第一圖顯示本發明的以快閃記憶體為基礎的儲存裝置的一較佳實施例的系統方塊圖;第二圖A顯示本發明的主要對照表的一較佳實施例的示意圖;第二圖B顯示本發明的次要對照表的一較佳實施例的示意圖;以及第三圖為本發明的資料寫入方法的流程圖。 The foregoing description, as well as other features and advantages of the present invention, will be best understood by System block diagram of an example; second diagram A shows a schematic diagram of a preferred embodiment of the main comparison table of the present invention; and second diagram B shows a schematic diagram of a preferred embodiment of the secondary comparison table of the present invention; The figure is a flow chart of the data writing method of the present invention.
第一圖顯示本發明的以快閃記憶體為基礎的儲存裝置的一較佳實施例的系統方塊圖。如第一圖所示,以快閃記憶體為基礎的儲存裝置100,例如一固態磁碟,包含一快閃記憶體104以及一快閃控制器102。快閃記憶體104其係由數個區塊(block)所組成,每個區塊的大小一般而言為512個位元組。每個區塊由邏輯區塊位址(logic block addressing,LBA)來代表,並且邏輯區塊位址的索引碼隨著區塊的編號遞增。如第二圖所示,快閃記憶體104包含N個區塊,其由LBA 0、LBA 1…LBA N來代表。快閃控制器102係用來控制快閃記憶體104的資料存取,其包含一隨機存取 記憶體(RAM)1022,具有一個主要對照表(primary mapping table)1022a,記錄快閃記憶體104的邏輯位置與實體位置之間的對照關係,以及數個次要對照表(secondary mapping table)1022b,分別記錄所有區塊(LBA 0,LBA 1,…,LBA N)的操作記錄(log)。快閃控制器102更包含一控制邏輯(control logic)1024,其具有一資料存取控制單元(data access control unit)1024a。資料存取控制單元1024a會詢問操作者是否有資料要寫入或刪除。若有資料要刪除,資料存取控制單元1024a會發出一資料刪除命令來將快閃記憶體104的所有區塊(LBA 0,LBA 1,…,LBA N)的資料刪除。該資料刪除命令可為ATA命令集的Secure Erase命令,或是在ATA命令集中自行定義的資料刪除命令。當有資料要寫入快閃記憶體104的區塊時,資料存取控制單元1024a會讀取次要對照表1022b的操作記錄(log)以判斷欲寫入的區塊是否能夠寫入。若欲寫入區塊的次要對照表中的操作記錄表示該區塊無法被寫入,資料存取控制單元1024a便會禁止該區塊被資料寫入。 The first figure shows a system block diagram of a preferred embodiment of a flash memory based storage device of the present invention. As shown in the first figure, the flash memory-based storage device 100, such as a solid state disk, includes a flash memory 104 and a flash controller 102. The flash memory 104 is composed of a plurality of blocks, each of which is generally 512 bytes in size. Each block is represented by a logical block addressing (LBA), and the index code of the logical block address is incremented with the number of the block. As shown in the second figure, the flash memory 104 includes N blocks, which are represented by LBA 0, LBA 1 ... LBA N . The flash controller 102 is used to control the data access of the flash memory 104, which includes a random access The memory (RAM) 1022 has a primary mapping table 1022a that records the relationship between the logical location of the flash memory 104 and the physical location, and a plurality of secondary mapping tables 1022b. , record the operation records (log) of all blocks (LBA 0, LBA 1, ..., LBA N). The flash controller 102 further includes a control logic 1024 having a data access control unit 1024a. The data access control unit 1024a asks the operator if there is data to be written or deleted. If there is data to be deleted, the data access control unit 1024a issues a data delete command to delete the data of all the blocks (LBA 0, LBA 1, ..., LBA N) of the flash memory 104. The data deletion command can be a Secure Erase command of the ATA command set or a data deletion command defined by the ATA command set. When there is data to be written to the block of the flash memory 104, the material access control unit 1024a reads the operation log (log) of the secondary lookup table 1022b to determine whether the block to be written can be written. If the operation record in the secondary look-up table of the block to be written indicates that the block cannot be written, the data access control unit 1024a prohibits the block from being written.
第二圖A顯示本發明的主要對照表1022a的一較佳實施例的示意圖。如第二圖A所示,主要對照表1022a包含一邏輯區塊編號(logical block number)202以及實體區塊編號(physical block numbering)204,用以分別記錄邏輯區塊的編號以及實體區塊編號,藉此呈現邏輯區塊以及實體區塊之間的對應關係。第二圖B顯示本發明的次要對照表1022b的一較佳實施例的示意圖。如第二圖B所示,次要對照表1022b包含一寫入計數器(writing counter)206以及一寫入致能(writing enable)旗標208,其中寫入計數器206記錄區塊被寫入的次數,而寫入致能旗 標208提供區塊是否能夠被寫入的指示。在本實施例中,若寫入計數器206中的數字達到預定的寫入次數,例如一次,資料存取控制單元1024a便會將該區塊的寫入致能旗標208設為停止(inactive)。舉例而言,若區塊LBA 0已經寫入一次,資料存取控制單元1024a便會將該區塊的寫入致能旗標208設為0代表停止的狀態,表示該區塊變成無法寫入的狀態。如前述所言,若想要將資料寫入寫入致能旗標208為停止的區塊,例如LBA 0,資料存取控制單元1024a便會便會禁止該區塊被資料寫入。 A second diagram A shows a schematic diagram of a preferred embodiment of the primary look-up table 1022a of the present invention. As shown in the second figure A, the main lookup table 1022a includes a logical block number 202 and a physical block numbering 204 for respectively recording the logical block number and the physical block number. Thereby, the logical block and the correspondence between the physical blocks are presented. A second diagram B shows a schematic diagram of a preferred embodiment of a secondary look-up table 1022b of the present invention. As shown in the second diagram B, the secondary lookup table 1022b includes a writing counter 206 and a writing enable flag 208, wherein the write counter 206 records the number of times the block was written. And write the enabling flag The flag 208 provides an indication of whether the block can be written. In this embodiment, if the number in the write counter 206 reaches a predetermined number of writes, for example, once, the data access control unit 1024a sets the write enable flag 208 of the block to be inactive. . For example, if the block LBA 0 has been written once, the data access control unit 1024a sets the write enable flag 208 of the block to 0 to indicate a stopped state, indicating that the block becomes unwritten. status. As described above, if the data is to be written to the block where the write enable flag 208 is stopped, for example, LBA 0, the data access control unit 1024a will prohibit the block from being written.
第三圖為本發明的資料寫入方法的流程圖。本發明的資料寫入方法適用於以快閃記憶體為基礎的儲存裝置,現在說明如下。第三圖的資料寫入方法的程序開始於步驟300,其中一開始時每個區塊的寫入致能旗標208係預設為活動(active)狀態,亦即設定為1。接下來,在步驟302中會判斷是否有資料要寫入快閃記憶體104或快閃記憶體104的資料是否要刪除。若快閃記憶體104的資料要刪除,程序的執行跳至步驟306以刪除快閃記憶體104中所有區塊中的資料並將所有區塊的次要對照表的寫入致能旗標設定為活動,並且接著程序的執行跳至步驟316而結束。若有資料要寫入快閃記憶體104,程序的執行跳至步驟304來判斷欲寫入的區塊的次要對照表中寫入致能旗標是否為活動(active)。若否,則代表欲寫入的區塊的次要對照表中寫入致能旗標為停止(inactive)而不可寫入,程序的執行跳至步驟314以禁止快閃記憶體104中的該區塊被資料寫入,並且接著程序的執行跳至步驟316而結束。若是,則代表欲寫入的區塊的次要對照表中寫入致能為活動(active)而准許寫入,程序的執行跳至步驟308將資料寫入欲寫入的區塊中並將該區塊的寫入計數器的數字加1。接下 來,程序的執行跳至步驟310以判斷該區塊的寫入計數器的數字是否達到一預定的寫入次數。若否,程序的執行跳至步驟316而結束。若是,程序的執行跳至步驟312以將該區塊的寫入致能旗標設為停止(inactive),並且接著程序的執行跳至步驟316而結束。 The third figure is a flow chart of the data writing method of the present invention. The data writing method of the present invention is applicable to a flash memory-based storage device, which will now be described. The program of the data writing method of the third figure begins in step 300, in which the write enable flag 208 of each block is initially set to an active state, that is, set to 1. Next, in step 302, it is determined whether there is data to be written to the flash memory 104 or the flash memory 104 whether the data is to be deleted. If the data of the flash memory 104 is to be deleted, the execution of the program jumps to step 306 to delete the data in all the blocks in the flash memory 104 and set the write enable flag of the secondary table of all the blocks. It is active, and then the execution of the program jumps to step 316 and ends. If there is data to be written to the flash memory 104, execution of the program jumps to step 304 to determine whether the write enable flag in the secondary lookup table of the block to be written is active. If not, the write enable flag in the secondary lookup table of the block to be written is inactive and not writable, and execution of the program jumps to step 314 to disable the flash memory 104. The block is written by the data, and then execution of the program jumps to step 316 to end. If so, the write enable is active for the secondary lookup table of the block to be written, and the execution of the program jumps to step 308 to write the data to the block to be written and The number of the write counter for this block is incremented by one. Next The execution of the program jumps to step 310 to determine if the number of write counters for the block has reached a predetermined number of writes. If not, execution of the program jumps to step 316 and ends. If so, execution of the program jumps to step 312 to set the write enable flag for the block to inactive, and then execution of the program jumps to step 316 to end.
總而言之,本發明揭露一種以快閃記憶體為基礎的儲存裝置的資料寫入方法,該方法的特點在於准許快閃記憶體的每個區塊被寫入一預定的寫入次數。若是欲寫入資料的區塊已經被寫入該預定的寫入次數,則禁止該區塊被資料寫入。為了達成此目的,本發明在儲存記憶體的快閃控制器的隨機存取記憶體中具有數個次要對照表,每個次要對照表記錄一個區塊的操作記錄,其中包含用來判斷區塊是否能夠寫入的旗標。此外快閃控制器的控制邏輯具有一資料存取控制單元,其會讀取次要對照表所記錄的區塊的操作記錄以判斷該區塊是否能夠寫入。若該旗標表示該區塊無法被寫入,資料存取控制單元1024a便會禁止該區塊被資料寫入。 In summary, the present invention discloses a data writing method for a flash memory-based storage device, which is characterized by permitting each block of the flash memory to be written for a predetermined number of writes. If the block to which the data is to be written has been written to the predetermined number of writes, the block is prohibited from being written by the data. In order to achieve the object, the present invention has a plurality of secondary comparison tables in the random access memory of the flash controller storing the memory, and each secondary comparison table records an operation record of a block, which is included for determining Whether the block can be written to the flag. In addition, the control logic of the flash controller has a data access control unit that reads the operation record of the block recorded by the secondary look-up table to determine whether the block can be written. If the flag indicates that the block cannot be written, the data access control unit 1024a prohibits the block from being written.
本案得由熟知此技術之人士任施匠思而為諸般修飾,然皆不脫如附申請專利範圍所欲保護者。 This case has been modified by people who are familiar with the technology, but it is not intended to be protected by the scope of the patent application.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW099118899A TWI455135B (en) | 2010-06-10 | 2010-06-10 | Flash-based storage device and data writing method for the same |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW099118899A TWI455135B (en) | 2010-06-10 | 2010-06-10 | Flash-based storage device and data writing method for the same |
Publications (2)
Publication Number | Publication Date |
---|---|
TW201145283A TW201145283A (en) | 2011-12-16 |
TWI455135B true TWI455135B (en) | 2014-10-01 |
Family
ID=46765913
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW099118899A TWI455135B (en) | 2010-06-10 | 2010-06-10 | Flash-based storage device and data writing method for the same |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI455135B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI709854B (en) * | 2019-01-21 | 2020-11-11 | 慧榮科技股份有限公司 | Data storage device and method for accessing logical-to-physical mapping table |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020188814A1 (en) * | 2001-06-08 | 2002-12-12 | Kenji Saito | Non-volatile storage device and rewrite control method thereof |
US6988175B2 (en) * | 2003-06-30 | 2006-01-17 | M-Systems Flash Disk Pioneers Ltd. | Flash memory management method that is resistant to data corruption by power loss |
WO2006030566A1 (en) * | 2004-09-17 | 2006-03-23 | Mitsubishi Denki Kabushiki Kaisha | Information writing/reading device of flash memory |
JP2006146498A (en) * | 2004-11-18 | 2006-06-08 | Murata Mach Ltd | Electronic apparatus |
US20070150891A1 (en) * | 2005-12-22 | 2007-06-28 | Shapiro Alan J | Method and apparatus for dispensing on a data-storage medium customized content comprising selected assets |
-
2010
- 2010-06-10 TW TW099118899A patent/TWI455135B/en active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020188814A1 (en) * | 2001-06-08 | 2002-12-12 | Kenji Saito | Non-volatile storage device and rewrite control method thereof |
US6988175B2 (en) * | 2003-06-30 | 2006-01-17 | M-Systems Flash Disk Pioneers Ltd. | Flash memory management method that is resistant to data corruption by power loss |
US7603525B2 (en) * | 2003-06-30 | 2009-10-13 | Sandisk Il Ltd. | Flash memory management method that is resistant to data corruption by power loss |
WO2006030566A1 (en) * | 2004-09-17 | 2006-03-23 | Mitsubishi Denki Kabushiki Kaisha | Information writing/reading device of flash memory |
JP2006146498A (en) * | 2004-11-18 | 2006-06-08 | Murata Mach Ltd | Electronic apparatus |
US20070150891A1 (en) * | 2005-12-22 | 2007-06-28 | Shapiro Alan J | Method and apparatus for dispensing on a data-storage medium customized content comprising selected assets |
Also Published As
Publication number | Publication date |
---|---|
TW201145283A (en) | 2011-12-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102033491B1 (en) | Managing trim operations in a flash memory system | |
US7509441B1 (en) | Systems and methods for segmenting and protecting a storage subsystem | |
US7447807B1 (en) | Systems and methods for storing data in segments of a storage subsystem | |
US10381040B1 (en) | Dynamic hybrid shingled magnetic recording device | |
TWI385669B (en) | Wear leveling method and storage system and controller using the same | |
US8312554B2 (en) | Method of hiding file at data protecting mode for non-volatile memory module, memory controller and portable memory storage apparatus | |
US8510504B2 (en) | SMR storage device with user controls and access to status information and parameter settings | |
US9923562B1 (en) | Data storage device state detection on power loss | |
US10061710B2 (en) | Storage device | |
US8055873B2 (en) | Data writing method for flash memory, and controller and system using the same | |
US9158674B2 (en) | Storage device with health status check feature | |
TWI457757B (en) | Method for controlling a memory array of a flash memory, and a flash memory using the same | |
JP2008117516A (en) | Method of providing block state information in semiconductor memory device including flash memory | |
JP2005301980A5 (en) | ||
TW201828066A (en) | Method for data management | |
US20190042405A1 (en) | Storing data based on writing frequency in data storage systems | |
US20200218667A1 (en) | Operating method for data storage device | |
JP5295173B2 (en) | Flash memory storage system, flash memory controller, computer system and method thereof for simulating a rewritable disk device | |
JP2007193449A (en) | Information recorder, and control method therefor | |
JP2007193865A (en) | Information recording device and its control method | |
CN111984441A (en) | Instantaneous power failure recovery processing method and device and computer readable storage medium | |
JP4737223B2 (en) | MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD | |
JP2009122826A (en) | Semiconductor storage device, method for controlling semiconductor storage device and control program | |
TWI455135B (en) | Flash-based storage device and data writing method for the same | |
CN102279815A (en) | Flash-memory-based storage device and data writing method thereof |