JP4888333B2 - Flash disk device - Google Patents

Flash disk device Download PDF

Info

Publication number
JP4888333B2
JP4888333B2 JP2007275976A JP2007275976A JP4888333B2 JP 4888333 B2 JP4888333 B2 JP 4888333B2 JP 2007275976 A JP2007275976 A JP 2007275976A JP 2007275976 A JP2007275976 A JP 2007275976A JP 4888333 B2 JP4888333 B2 JP 4888333B2
Authority
JP
Japan
Prior art keywords
unused
block
pages
blocks
garbage collection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2007275976A
Other languages
Japanese (ja)
Other versions
JP2009104430A (en
Inventor
実 一ノ関
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Oki Electric Industry Co Ltd
Original Assignee
Oki Electric Industry Co Ltd
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 Oki Electric Industry Co Ltd filed Critical Oki Electric Industry Co Ltd
Priority to JP2007275976A priority Critical patent/JP4888333B2/en
Publication of JP2009104430A publication Critical patent/JP2009104430A/en
Application granted granted Critical
Publication of JP4888333B2 publication Critical patent/JP4888333B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Memory System (AREA)

Description

本発明は、半導体ディスク装置、特にフラッシュメモリを使用したフラッシュディスク装置に関する。   The present invention relates to a semiconductor disk device, and more particularly to a flash disk device using a flash memory.

近年、近年の不揮発性メモリの大容量化、低コスト化に伴い、不揮発性メモリを使用したディスクであるフラッシュディスク装置が開発され、多くの製品が市場に流通し始めている。   In recent years, with the increase in capacity and cost of non-volatile memories in recent years, flash disk devices, which are disks using non-volatile memories, have been developed, and many products are beginning to circulate in the market.

このフラッシュディスク装置に一般的に使用されている大容量不揮発性メモリ素子はAND型/NAND型などのフラッシュメモリであるが、フラッシュメモリに保存されたデータは、一定の確率でビットエラーが発生すること及び一般に16KBのブロックと呼ばれる単位で消去を行うが、同一ブロックでは消去できる回数が10万回〜100万回という制約がある。   A large-capacity nonvolatile memory element generally used in this flash disk device is an AND type / NAND type flash memory. However, a bit error occurs in data stored in the flash memory with a certain probability. In addition, erasing is generally performed in units called 16 KB blocks, but the number of times that erasure can be performed in the same block is limited to 100,000 to 1 million times.

一般に、フラッシュメモリは複数のブロックにより構成され、更にこれらの各ブロックが、複数のページにより構成されている。ページは、リード(読出し)/ライト(書込み)の単位であり、通常、磁気ディスク装置等のハードディスク装置におけるリード/ライトの最小単位であるセクタと同じ大きさである512バイト(Byte)としている。従って、1ブロックは32個のページから構成される。   In general, a flash memory is composed of a plurality of blocks, and each of these blocks is composed of a plurality of pages. A page is a unit of reading (reading) / writing (writing), and is usually set to 512 bytes (bytes) having the same size as a sector which is a minimum unit of reading / writing in a hard disk device such as a magnetic disk device. Therefore, one block is composed of 32 pages.

各ページ内のデータを書換える場合は、通常、前データを消去した後、新たなデータを書込む。前述のようにブロックは、消去する単位であり、書換えがこのブロック内の一部のページであっても、この1つのブロック全部を消去する必要がある。   When rewriting data in each page, normally, new data is written after erasing previous data. As described above, a block is a unit to be erased, and even if rewriting is a partial page in this block, it is necessary to erase this entire block.

ところで、書込みを行っていると、フラッシュメモリ内の空いているページが無くなるので、一定量の空ブロックを確保するために、定期的にガベージコレクションを行い、未使用ページの多いブロック内のライトページを他のブロックに移動させ未使用ブロックとする処理を実行する。   By the way, since there are no free pages in the flash memory when writing is performed, in order to secure a certain amount of empty blocks, periodic garbage collection is performed and write pages in blocks with many unused pages. Is moved to another block to execute an unused block.

一般に、ガベージコレクションは、ホストマシンからのアクセスが一定時間無いときや、フラッシュメモリ内の空ブロックの数が所定の数以下となったとき、MPUの制御により実行される(例えば、特許文献1参照)。   Generally, garbage collection is executed under the control of the MPU when there is no access from the host machine for a certain period of time, or when the number of empty blocks in the flash memory becomes a predetermined number or less (see, for example, Patent Document 1). ).

図9は、前記従来のフラッシュディスク装置における未使用ページの管理を行う未使用ページリストを示している。同図に示したように未使用ページリストは、各チップの全ブロックについて未使用のページの数を順に検索し、未使用ページのあったチップ番号とブロック番号とその数をリスト状に格納しておくものであった。   FIG. 9 shows an unused page list for managing unused pages in the conventional flash disk device. As shown in the figure, the unused page list searches the number of unused pages in order for all blocks of each chip, and stores the chip number, block number, and number of unused pages in a list. It was something to keep.

例えば、最初のチップのチップ番号Aではブロック番号5とブロック番号8だけが未使用ページを有し、それぞれ14ページ、5ページが未使用であったことを示している。   For example, in the chip number A of the first chip, only block number 5 and block number 8 have unused pages, and 14 pages and 5 pages are unused, respectively.

従来のフラッシュディスク装置では、前記未使用ページリストを用いて、前述の未使用ページの多いブロック内のライトページを他のブロックに移動し未使用ブロックとする処理、すなわちガベージコレクション動作を実行していた。
特開2005−242897号公報
In the conventional flash disk device, the above-described unused page list is used to move the write page in the block having many unused pages to another block to make it an unused block, that is, a garbage collection operation. It was.
JP 2005-242897 A

しかしながら、従来のフラッシュディスク装置では、図9の未使用ページリストにより未使用ページを管理してガベージコレクション動作を行っているので、フラッシュメモリへのライト動作が行われ空ブロックの数が少なくなると、ガベージコレクションの頻度が増加し、未使用ページの多いブロックの検索を頻繁に行うことになり、ガベージコレクション動作に時間がかかり、最悪の場合、次のライト動作までにガベージコレクション動作が間に合わなくなり、ライト動作に影響が生ずるという不具合が発生していた。   However, in the conventional flash disk device, since unused pages are managed by the unused page list of FIG. 9 and the garbage collection operation is performed, when the write operation to the flash memory is performed and the number of empty blocks decreases, The frequency of garbage collection increases, frequently searching for blocks with many unused pages, and the garbage collection operation takes time. In the worst case, the garbage collection operation will not be in time before the next write operation, and the write There was a problem that the operation was affected.

本発明は、前述の課題を解決するために次の手段を採用する。すなわち、複数のページから構成された書込み単位であるブロックを複数有するフラッシュディスク装置において、使用ページの数ごとに該当するブロック番号を格納した未使用ページ管理テーブルを設け、当該未使用ページ管理テーブルを用いて未使用ページの数が多いブロックからガベージコレクション処理を行うようにした。 The present invention employs the following means in order to solve the aforementioned problems. That is, in a flash disk device having a plurality of blocks that are write units composed of a plurality of pages, an unused page management table storing a corresponding block number for each number of unused pages is provided, and the unused page management table Was used to start garbage collection from blocks with a large number of unused pages.

本発明のフラッシュディスク装置によれば、フラッシュメモリの未使用ページの数ごとに該当するブロックを管理できる未使用ページ管理テーブルを設け、当該未使用ページ管理テーブルにより未使用ページの数が多いブロックからガベージコレクション処理を行うようにしたので、未使用ページの数が多いブロックの検索が容易となり、ガベージコレクションの処理時間を短くすることができる。   According to the flash disk device of the present invention, an unused page management table that can manage a corresponding block for each number of unused pages in the flash memory is provided, and blocks that have a large number of unused pages are provided by the unused page management table. Since the garbage collection process is performed, it is easy to search for a block having a large number of unused pages, and the garbage collection process time can be shortened.

以下、本発明に係る実施の形態例を、図面を用いて説明する。なお、図面に共通する要素には同一の符号を付す。   Embodiments of the present invention will be described below with reference to the drawings. In addition, the same code | symbol is attached | subjected to the element common to drawing.

(構成)
図1は実施例1のフラッシュディスク装置の構成を説明する図であり、図2はフラッシュメモリのブロックとページの構成を示した図である。
(Constitution)
FIG. 1 is a diagram illustrating the configuration of the flash disk device according to the first embodiment, and FIG. 2 is a diagram illustrating the configuration of blocks and pages of the flash memory.

図1に示したように、実施例1のフラッシュディスク装置は、ホストCPU等のホストマシン1とのインターフェース(以下「I/F」という)であるホストI/Fバス2により、ホストマシン1と接続されている。   As shown in FIG. 1, the flash disk device according to the first embodiment is connected to a host machine 1 by a host I / F bus 2 that is an interface (hereinafter referred to as “I / F”) with a host machine 1 such as a host CPU. It is connected.

そして、装置全体を制御するマイクロプロセッサユニット(以下「MPU」という)11を有しており、MPU11はRAM11a、読み出し専用メモリ(以下「ROM」という)11bおよび入/出力(以下「I/O」という)ポート11c等が接続され、さらに不揮発性メモリ12が接続されている。   It has a microprocessor unit (hereinafter referred to as “MPU”) 11 that controls the entire apparatus. The MPU 11 includes a RAM 11a, a read-only memory (hereinafter referred to as “ROM”) 11b, and an input / output (hereinafter referred to as “I / O”). Port 11c and the like, and a non-volatile memory 12 is further connected.

不揮発性メモリ12は、MPU11によりアクセス制御され、後述のブロック管理テーブルや未使用ページ管理テーブル等の情報を格納するために、ワード単位での書換えの可能な不揮発性のメモリからなる。   The nonvolatile memory 12 is controlled by the MPU 11 and is composed of a nonvolatile memory that can be rewritten in units of words in order to store information such as a block management table and an unused page management table, which will be described later.

また、フラッシュディスク装置10には、ホストI/Fバス2を制御するホストI/Fコントローラ13が設けられている。ホストI/Fコントローラ13は、ホストI/Fのプロトコルを処理してホストマシン1との間でデータの授受を行うものであり、これには内部データバス14を介してバッファメモリ15が接続されている。   The flash disk device 10 is provided with a host I / F controller 13 for controlling the host I / F bus 2. The host I / F controller 13 processes the host I / F protocol and exchanges data with the host machine 1. A buffer memory 15 is connected to the host I / F controller 13 via the internal data bus 14. ing.

バッファメモリ15は、ホストマシン1からのリード/ライトデータを一時的に保存し処理するメモリである。内部データバス14には、フラッシュメモリコントローラ16が接続され、このフラッシュメモリコントローラ16に、フラッシュメモリバス17を介して一つ又は複数のフラッシュメモリ20が接続されている。   The buffer memory 15 is a memory that temporarily stores and processes read / write data from the host machine 1. A flash memory controller 16 is connected to the internal data bus 14, and one or more flash memories 20 are connected to the flash memory controller 16 via a flash memory bus 17.

フラッシュメモリコントローラ16は、MPU11からの命令に従ってフラッシュメモリ20をアクセス制御するものであり、データ読出し部16a、データ書込み部16b、及びブロック消去部16c等により構成されている。一つ又は複数のフラッシュメモリ20は、ホストマシン1からのライトデータを不揮発に保存するメモリである。   The flash memory controller 16 controls access to the flash memory 20 in accordance with an instruction from the MPU 11, and includes a data reading unit 16a, a data writing unit 16b, a block erasing unit 16c, and the like. One or more flash memories 20 are memories that store write data from the host machine 1 in a nonvolatile manner.

フラッシュメモリ20は、消去の単位である複数のブロックから構成され、図2では、N個目のブロックをブロック21−N、N+1個目のブロックをブロック21−(N+1)として示している。そして、各ブロック21は、リード/ライトの単位である複数のページ22−0、22−1、・・・、22−31を有している。例えば、1ページが512Byteの記憶容量で、1ブロックが16KBの場合であれば、1ブロックは32個のページから構成される。   The flash memory 20 is composed of a plurality of blocks as erase units. In FIG. 2, the Nth block is shown as a block 21-N, and the N + 1th block is shown as a block 21- (N + 1). Each block 21 has a plurality of pages 22-0, 22-1,..., 22-31 which are read / write units. For example, if one page has a storage capacity of 512 bytes and one block is 16 KB, one block is composed of 32 pages.

フラッシュメモリ20では、書換えがブロック21内の一部のページ22であっても、1つのブロック21全体を消去した後に書換えを行う。   In the flash memory 20, even if a part of the pages 22 in the block 21 is rewritten, the rewriting is performed after the entire block 21 is erased.

図4は、本発明の実施例1のフラッシュメモリの構成を示し、図1のフラッシュディスク装置10の論理構成図である。   FIG. 4 shows the configuration of the flash memory according to the first embodiment of the present invention, and is a logical configuration diagram of the flash disk device 10 of FIG.

ホストマシン1から指定される論理セクタアドレス25として論理セクタ番号0、1、2、・・・、Jを、フラッシュメモリ20上の物理アドレスであるページアドレスに変換するために、不揮発性メモリ12内には、アドレステーブル30が格納されている。そして、アドレステーブル30内には、論理セクタを物理ページに変換するための複数のアドレス変換データ31−0、31−1、31−2、・・・、31−Kが格納されている。   In order to convert logical sector numbers 0, 1, 2,..., J as logical sector addresses 25 designated by the host machine 1 into page addresses that are physical addresses on the flash memory 20, Stores an address table 30. The address table 30 stores a plurality of address conversion data 31-0, 31-1, 31-2, ..., 31-K for converting a logical sector into a physical page.

更に、不揮発性メモリ12内には、フラッシュメモリ20内の未使用ページを管理する未使用ページ管理テーブル32と、フラッシュメモリ20内のブロック21−0、21−1、・・・、21−Lの書き換え回数等を管理するブロック管理テーブル33とが格納されている。フラッシュメモリ20に格納される複数のブロック21−0〜21−Lは、それぞれ複数のページ22−0、22−1、・・・、22−Mを有している。   Further, in the nonvolatile memory 12, an unused page management table 32 for managing unused pages in the flash memory 20, and blocks 21-0, 21-1,..., 21-L in the flash memory 20 are stored. And a block management table 33 for managing the number of rewrites and the like. The plurality of blocks 21-0 to 21-L stored in the flash memory 20 have a plurality of pages 22-0, 22-1,.

実施例1のフラッシュディスク装置では、不揮発性メモリ12内にアドレステーブル30を用意し、ホストマシン1から見えるセクタアドレスである論理セクタ番号から、フラッシュメモリ20上の物理的なページ番号への写像を保持する。フラッシュメモリ20には、余分なページ22−iを複数用意し、後述の未使用ページ管理テーブル32に未使用ページ情報を登録して管理する。   In the flash disk device of the first embodiment, an address table 30 is prepared in the non-volatile memory 12, and a mapping from a logical sector number, which is a sector address visible to the host machine 1, to a physical page number on the flash memory 20 is performed. Hold. A plurality of extra pages 22-i are prepared in the flash memory 20, and unused page information is registered and managed in an unused page management table 32 described later.

この未使用ページ管理テーブル32は、未使用ページの数とインデックスからなる二次元配列となっており、初期データとして0xFFFFFFFFが記録され、未使用ページの数ごとに該当するチップ番号とブロック番号がインデックス0から順に記録される。従って、該当するチップ番号とブロック番号がない配列は初期データである0xFFFFFFFFが記録されたままとなる。   This unused page management table 32 is a two-dimensional array composed of the number of unused pages and an index. 0xFFFFFFFF is recorded as initial data, and the corresponding chip number and block number are indexed for each number of unused pages. Recorded in order from 0. Therefore, the array without the corresponding chip number and block number remains recorded with the initial data 0xFFFFFFFF.

また、一時記憶ページリスト34は、図5を用いて後述するが、フラッシュメモリ内ではなく、MPU11のRAMに記憶するもので、アドレステーブル30を参照しながら未使用ページがあるチップ番号、ブロック番号を未使用ページの数ことに集計した結果を一時的に格納するものである。   As will be described later with reference to FIG. 5, the temporary storage page list 34 is stored in the RAM of the MPU 11 instead of in the flash memory, and the chip number and block number having an unused page while referring to the address table 30. The result of totaling the number of unused pages is temporarily stored.

(動作)
以上の構成により実施例1のフラッシュディスク装置は、以下のように動作する。なお、リード動作およびライト動作は、従来技術と同様であるので、簡略化のためにその説明を省略する。
(Operation)
With the above configuration, the flash disk device of the first embodiment operates as follows. Note that the read operation and the write operation are the same as those in the prior art, and thus the description thereof is omitted for the sake of brevity.

ホストマシン1からのアクセスが一定時間無いときや、フラッシュメモリ内の空ブロックの数が一定量以下となったとき実行するガベージコレクションの動作を開始する。この動作を、図3の未使用ページ管理テーブルの構成図、図5の一時記憶ページリストの構成図および図6の動作フローチャート図を用いて以下詳細に説明する。   The garbage collection operation is started when there is no access from the host machine 1 for a certain period of time or when the number of empty blocks in the flash memory falls below a certain amount. This operation will be described in detail below with reference to the configuration diagram of the unused page management table in FIG. 3, the configuration diagram of the temporary storage page list in FIG. 5, and the operation flowchart in FIG.

ガベージコレクション動作を開始すると、まず、各ページの状態を示す一時記憶ページリスト34を作成し(ステップS1)、図5に示したように、アドレステーブル30で使用されていないページ22に該当する一時記憶ページリスト34に未使用フラグを立てる(ステップS2)。   When the garbage collection operation is started, first, a temporary storage page list 34 indicating the state of each page is created (step S1), and as shown in FIG. 5, temporary pages corresponding to pages 22 that are not used in the address table 30 are created. An unused flag is set in the storage page list 34 (step S2).

次に、一時記憶ページリスト34を参照し全てのページが未使用のブロックを消去し(ステップS3)、該当ページのフラグをすべて消去済みとして、図3の未使用ページ管理テーブル32の未使用ページの数32個の行、すなわちブロック内全部が未使用のブロックであるとして、消去したチップ番号とブロック番号をインデックスがより小さい0xFFFFFFFFのインデックスに書き込む(ステップS4)。図3の状態の場合では、インデックス"3"に書き込むことになる。   Next, referring to the temporary storage page list 34, all unused pages are erased (step S3), all the flags of the corresponding page are erased, and unused pages in the unused page management table 32 of FIG. The erased chip number and block number are written in the index of 0xFFFFFFFF having a smaller index, assuming that all 32 rows in the block, that is, all the blocks are unused blocks (step S4). In the case of the state shown in FIG. 3, data is written to the index “3”.

このステップS4では、上記の全ページ未使用の場合のほか、一部のみ未使用ページのあるすべてのチップおよびブロックについて、一時記憶ページリスト34を参照し、未使用ページの数ごとに図3の未使用ページ管理テーブル32を作成する。この場合も、インデックスがより小さい0xFFFFFFFFのインデックスに書き込む。   In step S4, in addition to the case where all the pages are not used, the temporary storage page list 34 is referred to for all chips and blocks having some unused pages. An unused page management table 32 is created. Also in this case, the index is written to the index of 0xFFFFFFFF having a smaller index.

例えば、図3の未使用ページが6個でインデックス2に記憶されたチップ番号C・ブロック番号kの例では、図5の一時記憶ページリストからチップ番号C・ブロック番号kの未使用のページの数をカウントし、未使用ページが6個であったことを示している。   For example, in the example of the chip number C and block number k stored in the index 2 with 6 unused pages in FIG. 3, the unused page with the chip number C and block number k from the temporary storage page list in FIG. The number is counted, indicating that there are 6 unused pages.

そして、未使用ページ管理テーブル32の未使用ページの個数が32個、すなわち未使用ブロックである数が一定量以上であるかどうかの判定を行い(ステップS5)、未使用ブロックの総数が一定量以上ある場合は、ガベージコレクション動作は不要であるので、そのまま本処理を終了する。   Then, it is determined whether the number of unused pages in the unused page management table 32 is 32, that is, whether the number of unused blocks is equal to or larger than a certain amount (step S5), and the total number of unused blocks is a certain amount. If there is more than one, the garbage collection operation is unnecessary, so this processing is ended as it is.

一方、未使用ブロックが一定量以上ない場合は、ガベージコレクション動作が必要であるので、ブロック内すべて未使用の場合の未使用ページの数32個以外で、未使用ページ管理テーブル32より未使用ページの多いブロックを参照し(ステップS6)、未使用ページの多い、すなわち使用ページの少ないブロックの有効なデータをすべて読み出した後(ステップS7)、一時ページリスト34の該当するチップ番号、ブロック番号の位置に未使用のフラグを立てる(ステップS8)。   On the other hand, if there are not more than a certain number of unused blocks, a garbage collection operation is required. Therefore, the number of unused pages other than the number of unused pages when all the blocks in the block are not used is 32. The block having a large number of unused pages is referred to (step S6), and all the valid data of the block having many unused pages, that is, the few used pages are read (step S7). An unused flag is set at the position (step S8).

例えば、図3の未使用ページ管理テーブル32の例では、ブロック内すべて未使用の場合(すなわち、未使用ページの数が32個)以外で、未使用ページの多いブロックを参照すると、未使用ページの数31個の行には、未使用ページがあるブロックがなにも登録されていないので、30個の行を参照し、順に参照する。   For example, in the example of the unused page management table 32 in FIG. 3, when all blocks in the block are unused (that is, the number of unused pages is 32) and a block with many unused pages is referenced, unused pages Since no block with unused pages is registered in the 31 rows, the 30 rows are referred to in order.

すると、未使用ページの数8個(すなわち、使用済みページの数は、32個−8個=24個)のインデックス"0"にチップ番号A、ブロック番号aが登録されているので、図5の一時記憶ページリスト34の当該ブロックを参照すると、ページ1等の24ページが使用済みページであることが分かるので、これらのページのデータをすべて読み出し、一時ページリスト34のチップ番号A、ブロック番号aのすべてのページに未使用のフラグを立てる。   Then, the chip number A and the block number a are registered in the index “0” of 8 unused pages (that is, the number of used pages is 32−8 = 24). Referring to the corresponding block of the temporary storage page list 34, it can be seen that 24 pages such as page 1 are used pages, so all the data of these pages are read out, and the chip number A and block number of the temporary page list 34 are read out. Set an unused flag on all pages of a.

次に、読み出した前記データを、未使用ページ管理テーブル32を参照し未使用ページが多いブロックでインデックスの大きいブロックを優先的に選択し、読み出した前記データを当該ブロックに書き込む(ステップS9)。このときデータ容量が大きく1つのブロックに書き込めない場合は分割してそれぞれのブロックに書き込む。そして、ページのブロック間移動に伴いアドレステーブル30の論理セクタ番号と物理ページの対応を更新する。   Next, the read data is referred to the unused page management table 32 to preferentially select a block with many unused pages and a large index, and the read data is written to the block (step S9). At this time, if the data capacity is large and cannot be written in one block, the data is divided and written in each block. Then, the correspondence between the logical sector number in the address table 30 and the physical page is updated as the page moves between blocks.

例えば、図3の例では、未使用ページの数8個、インデックス"0"に登録されたチップ番号A、ブロック番号aに記録されたデータを移動する場合、前述のように移動すべきデータは24ページあるので、これを格納できるブロックを抽出する。本例の場合は、最大でも8ページ空いたブロックしか存在せず、24ページ全部を書き込めるブロックがないため、インデックス3のチップ番号A、ブロック番号dに8個、インデックス2のチップ番号A、ブロック番号cに8個、インデックス1のチップ番号A、ブロック番号bにそれぞれ8個を移し替え、ブロックの移動に伴いアドレステーブル30の論理セクタ番号と物理ページの対応を更新する(ステップS10)。   For example, in the example of FIG. 3, when moving the number of unused pages, the data recorded in the chip number A and the block number a registered in the index “0”, the data to be moved is as described above. Since there are 24 pages, a block that can store them is extracted. In the case of this example, there is only a block that is free of 8 pages at the maximum, and there is no block in which all 24 pages can be written. Therefore, the chip number A of index 3 and 8 in block number d, chip number A of index 2 and block Eight in the number c, eight in the chip number A in the index 1, and eight in the block number b are transferred, and the correspondence between the logical sector number and the physical page in the address table 30 is updated as the block moves (step S10).

そして、前述ステップS3に戻り、ステップS6からステップS9によるデータ移動により生成した未使用ブロックにつき消去を行い、消去したチップ番号とブロック番号を図3の未使用ページ管理テーブル32の未使用ページの数が32個、すなわちブロック内全部が未使用のブロックとしてそのチップ番号とブロック番号をインデックスがより小さい0xFFFFFFFFのインデックスに書き込む。そして、一部未使用ページのあるブロックについても、一時記憶ページリスト34を参照し未使用ページの数ごとに図3の未使用ページ管理テーブル32を作成する。   Then, returning to the above-described step S3, the unused block generated by the data movement from step S6 to step S9 is erased, and the erased chip number and block number are used as the number of unused pages in the unused page management table 32 of FIG. Is written as an unused block in the entire block, and its chip number and block number are written in the index of 0xFFFFFFFF having a smaller index. Then, the unused page management table 32 of FIG. 3 is created for each unused page by referring to the temporary storage page list 34 even for a block having some unused pages.

例えば、図3の例の場合、前述のデータ移動によりインデックス0のチップ番号A、ブロック番号aのブロックが未使用となるので、未使用ページの数が32個のインデックス3にチップ番号A、ブロック番号aが記録され、未使用ページの数が8個であったインデックス0の内容は0xFFFFFFFFとなる。   For example, in the case of the example of FIG. 3, since the block of chip number A and block number a of index 0 is not used due to the above-described data movement, the number of unused pages is 32 in index 3, and chip number A and block The content of the index 0 in which the number a is recorded and the number of unused pages is 8 is 0xFFFFFFFF.

そして、未使用ページの数が8個であったインデックス1は、チップ番号A、ブロック番号bの未使用であった8ページにも書き込まれるので、未使用ページがなくなり、インデックス1の内容は0xFFFFFFFFとなる。同様に、インデックス2およびインデックス3の内容も0xFFFFFFFFとなる。   Since the index 1 having 8 unused pages is also written to the 8 unused pages with the chip number A and the block number b, there is no unused page, and the content of the index 1 is 0xFFFFFFFF It becomes. Similarly, the contents of index 2 and index 3 are also 0xFFFFFFFF.

そして、新たに生成した未使用ブロックの数を再度確認し、未使用ブロックが所定の数確保できた場合は、本処理を終了し、所定の数確保できないときは、ステップS6からS10、S3からS5の動作を繰り返す。   Then, the number of newly generated unused blocks is checked again. If a predetermined number of unused blocks can be secured, this process is terminated. If the predetermined number cannot be secured, steps S6 to S10 and S3 are performed. The operation of S5 is repeated.

(実施例1の効果)
以上のように、実施例1のフラッシュディスク装置によれば、未使用ページの数ごとに該当するブロックを管理できる未使用ページ管理テーブルを設け、当該未使用ページ管理テーブルにより未使用ページの数が多いブロックからガベージコレクション処理を行うようにしたので、未使用ページの数が多いブロックの抽出が容易となり、処理時間を短縮することができる。
(Effect of Example 1)
As described above, according to the flash disk device of the first embodiment, an unused page management table capable of managing a corresponding block for each number of unused pages is provided, and the number of unused pages is determined by the unused page management table. Since the garbage collection process is performed from a large number of blocks, it is easy to extract a block having a large number of unused pages, and the processing time can be shortened.

(構成)
実施例2のフラッシュディスク装置は、所定のブロック数、例えば200ブロック(3.2MB)ごとにガベージコレクションを実施するようにし、図7に示したように、不揮発性メモリ12に、ガベージコレクションを開始するチップ番号およびブロック番号を保存するガベージコレクション開始位置記憶部40を設けている。
(Constitution)
The flash disk device according to the second embodiment performs garbage collection every predetermined number of blocks, for example, 200 blocks (3.2 MB), and starts garbage collection in the nonvolatile memory 12 as shown in FIG. A garbage collection start position storage unit 40 for storing the chip number and block number to be stored is provided.

そして、所定のブロック数のガベージコレクションを終了したときに、開始するチップ番号およびブロック番号の位置を更新してガベージコレクション開始位置記憶部40に保存し、次のガベージコレクションのときに、ガベージコレクション開始位置記憶部40に保存したチップ番号X、ブロック番号Yからガベージコレクションを実施できる構成となっている。   Then, when the garbage collection for the predetermined number of blocks is completed, the start chip number and the block number position are updated and stored in the garbage collection start position storage unit 40, and the garbage collection starts at the next garbage collection. The garbage collection can be performed from the chip number X and the block number Y stored in the position storage unit 40.

その他の構成は、実施例1の構成と同様であるので、簡略化のためにその詳細な説明は省略する。   Other configurations are the same as the configurations of the first embodiment, and detailed description thereof is omitted for the sake of brevity.

(動作)
以上の構成により、実施例のフラッシュディスク装置は、以下のように動作する。この動作を図8の動作フローチャート図を用いて説明する。なお、ステップS21からS30は実施例1のステップS1から10と同様であるので、その説明を簡略化する。また、リード動作およびライト動作は、従来技術と同様であるので、簡略化のためにその説明を省略する。
(Operation)
With the above configuration, the flash disk device of the embodiment operates as follows. This operation will be described with reference to the operation flowchart of FIG. Since steps S21 to S30 are the same as steps S1 to S10 of the first embodiment, the description thereof will be simplified. Further, since the read operation and the write operation are the same as those of the prior art, description thereof is omitted for the sake of brevity.

ホストマシン1からのアクセスが一定時間無いときや、フラッシュメモリ内の空ブロックの数が一定量以下となったとき、ガベージコレクションの動作を開始する。   When there is no access from the host machine 1 for a certain period of time, or when the number of empty blocks in the flash memory falls below a certain amount, the garbage collection operation is started.

ガベージコレクション動作を開始すると、まず、ガベージコレクション開始位置記憶部40のガベージコレクションを開始するチップ番号X、ブロック番号Yを参照し、最初からのガベージコレクションであるか、すなわち、X=1、Y=1かどうかを判定し(ステップS20)、最初からのガベージコレクションでないときは、ガベージコレクションを開始するチップ番号をX、ブロック番号Yと設定し(ステップS33)、後述のステップS25に進み、未使用ブロックの数に応じて、ガベージコレクション動作を実行する。   When the garbage collection operation is started, the garbage collection is started from the beginning by referring to the chip number X and the block number Y at which garbage collection is started in the garbage collection start position storage unit 40, that is, X = 1, Y = 1 (step S20), if it is not garbage collection from the beginning, set the chip number to start garbage collection as X and block number Y (step S33), proceed to step S25 described later, unused A garbage collection operation is executed according to the number of blocks.

一方、ステップS20にて、ガベージコレクション開始位置記憶部40のガベージコレクションを開始するチップ番号X、ブロック番号Yが、それぞれX=1、Y=1で、最初からのガベージコレクションであったときは、実施例1と同様、以下説明するステップS21からS24を実施する。   On the other hand, in step S20, when the chip number X and the block number Y for starting garbage collection in the garbage collection start position storage unit 40 are X = 1 and Y = 1, respectively, As in the first embodiment, steps S21 to S24 described below are performed.

すなわち、所定のブロック数において、各ページの状態を示す図5の一時記憶ページリスト34を作成し、アドレステーブル30で使用されていないページ22に該当する一時記憶ページリスト34に未使用フラグを立て、全てのページが未使用のブロックを消去し、該当ページのフラグをすべて消去済みとして、消去したチップ番号とブロック番号を図3の未使用ページ管理テーブル32の未使用ページの数32個の行のインデックスがより小さい0xFFFFFFFFのインデックスに書き込む。そして、使用ページのあるブロックについても、一時記憶ページリスト34を参照し未使用ページの数ごとに図3の未使用ページ管理テーブル32を作成する。(ステップS21〜S24)   That is, the temporary storage page list 34 of FIG. 5 showing the state of each page is created for a predetermined number of blocks, and an unused flag is set in the temporary storage page list 34 corresponding to the page 22 that is not used in the address table 30. The unused block is erased for all pages, all the flags of the corresponding page are erased, and the erased chip number and block number are the number of unused pages in the unused page management table 32 of FIG. Is written into the index of 0xFFFFFFFF having a smaller index. Then, the unused page management table 32 of FIG. 3 is created for each block of used pages with reference to the temporary storage page list 34 for each number of unused pages. (Steps S21 to S24)

そして、未使用ページ管理テーブル32の未使用ページの個数が32個、すなわち未使用ブロックである数が一定量以上であるかどうかの判定を行い、未使用ブロックの総数が一定量以上ある場合は、ガベージコレクション動作は不要であるので、そのまま本処理を終了する(ステップS25)。   Then, it is determined whether the number of unused pages in the unused page management table 32 is 32, that is, whether the number of unused blocks is equal to or larger than a certain amount. If the total number of unused blocks is equal to or larger than a certain amount, Since the garbage collection operation is unnecessary, the present process is terminated as it is (step S25).

一方、未使用ブロックが一定量以上ない場合は、ガベージコレクション動作が必要であるので、ブロック内すべて未使用の場合(すなわち未使用ページの数32個)以外で、未使用ページの多いブロックを未使用ページ管理テーブル32により抽出し、未使用ページの多いブロックの使用済みページのデータを読み出し、一時ページリスト34の該当するチップ番号、ブロック番号に未使用のフラグを立てる(ステップS26〜S28)。   On the other hand, if there are not more than a certain number of unused blocks, a garbage collection operation is necessary. Therefore, a block with many unused pages is not used except when all the blocks are unused (that is, 32 unused pages). Extracted by the used page management table 32, the used page data of the block having many unused pages is read, and an unused flag is set in the corresponding chip number and block number of the temporary page list 34 (steps S26 to S28).

次に、読み出した前記データを、未使用ページ管理テーブル32を参照し、未使用ページが多いブロックでインデックスの大きいブロックを優先的に選択し、読み出した前記データを選択したブロックに書き込み、ページのブロック間移動に伴いアドレステーブル30の論理セクタ番号と物理ページの対応を更新する(ステップS29、S30)。   Next, the read data is referred to the unused page management table 32, a block having a large number of unused pages is preferentially selected, a block having a large index is preferentially written, and the read data is written to the selected block. Along with the movement between blocks, the correspondence between the logical sector number of the address table 30 and the physical page is updated (steps S29 and S30).

そして、所定のブロックについてすべて実施したかどうかを判定し(ステップS31)、すべてのブロックのガベージコレクションが終了していないときは、前述ステップS23に戻り、ステップS23とステップS24にて、データ移動により生成した未使用ブロックにつき消去を行い、消去したチップ番号とブロック番号を未使用ページ管理テーブル32のインデックスがより小さい0xFFFFFFFFのインデックスに書き込む。そして、使用ページのあるブロックについても、一時記憶ページリスト34を参照し未使用ページの数ごとに図3の未使用ページ管理テーブル32を作成する。   Then, it is determined whether or not all the predetermined blocks have been carried out (step S31). When the garbage collection of all the blocks has not been completed, the process returns to the aforementioned step S23, and the data movement is performed in steps S23 and S24. The generated unused block is erased, and the erased chip number and block number are written into the index of 0xFFFFFFFF having a smaller index in the unused page management table 32. Then, the unused page management table 32 of FIG. 3 is created for each block of used pages with reference to the temporary storage page list 34 for each number of unused pages.

そして、ステップS25にて、新たに生成した未使用ブロックの数を再度確認し所定の数以上未使用ブロックが確保できたときは、そのまま本処理を終了する。   In step S25, the number of newly generated unused blocks is confirmed again. When a predetermined number or more of unused blocks are secured, this processing is terminated as it is.

一方、ステップS25にて、所定の数以上未使用ブロックを確保できていないと判定したときは、所定の数以上未使用ブロックを確保できるまで、ステップS26からS31、S23からS25の動作を繰り返す。   On the other hand, when it is determined in step S25 that a predetermined number or more of unused blocks have not been secured, the operations of steps S26 to S31 and S23 to S25 are repeated until a predetermined number or more of unused blocks can be secured.

前述のステップS31にて、所定のブロック数分の処理が終了したときは、次の所定のブロック数間のガベージコレクションを行うように、ガベージコレクションを開始するチップ番号X、ブロック番号Yを更新し、更新したチップ番号をXに、ブロック番号をYに保存する。   When the processing for the predetermined number of blocks is completed in the above-described step S31, the chip number X and the block number Y for starting garbage collection are updated so that garbage collection is performed for the next predetermined number of blocks. The updated chip number is stored in X and the block number is stored in Y.

なお、上記更新によりブロック番号が、各チップの全ブロックの数L以上となった場合は、チップ番号Xを更新し、ブロック番号をY=1に更新しガベージコレクション開始位置記憶部40に保存する。   When the block number becomes equal to or greater than the number L of all blocks of each chip by the above update, the chip number X is updated, the block number is updated to Y = 1, and stored in the garbage collection start position storage unit 40. .

また、全チップ、全ブロックのガベージコレクションを終了したと判定した場合は、ガベージコレクションを開始するチップ番号、ブロック番号Yを初期化し、X=1、Y=1として、ガベージコレクション開始位置記憶部40に保存し本処理を終了する(ステップS32)。   If it is determined that the garbage collection of all the chips and all the blocks has been completed, the chip number and the block number Y for starting the garbage collection are initialized, and X = 1 and Y = 1, and the garbage collection start position storage unit 40 And this processing is terminated (step S32).

なお、以上の実施例の説明では、所定のブロック数ごとにガベージコレクションを実施するように説明したが、所定のブロック数を適宜変化させるようにしてもよい。   In the above description of the embodiment, the garbage collection is performed for each predetermined number of blocks. However, the predetermined number of blocks may be changed as appropriate.

(実施例2の効果)
以上のように実施例2のフラッシュディスク装置によれば、所定のブロック数ごとにガベージコレクションを行うようにし、当該ガベージコレクション処理を終了したときに、チップ番号およびブロック番号を更新して記憶するガベージコレクション開始位置記憶手段を設け、ガベージコレクションを開始するときは、ガベージコレクション開始位置記憶手段に記憶された位置からガベージコレクションを実施するようにしたので、未使用ページ情報の検索や集計の時間をさらに短くすることができ、ガベージコレクションの処理時間をさらに短くすることができる。
(Effect of Example 2)
As described above, according to the flash disk device of the second embodiment, garbage collection is performed for each predetermined number of blocks, and when the garbage collection process is completed, the chip number and the block number are updated and stored. When collection start position storage means is provided and garbage collection is started, garbage collection is carried out from the position stored in the garbage collection start position storage means. Thus, the garbage collection processing time can be further shortened.

《その他の変形例》
以上の実施例の説明では、図3のように未使用ページの数ごとに該当するチップ番号、ブロック番号を格納する管理テーブルとしたが、逆に使用ページの数ごとに該当するチップ番号、ブロック番号を格納する管理テーブルとしてもよい。
<< Other modifications >>
In the above description of the embodiment, the management table storing the chip number and the block number corresponding to the number of unused pages is used as shown in FIG. 3, but the chip number and the block corresponding to the number of used pages are reversed. A management table for storing numbers may be used.

また、以上の実施例の説明では、一時記憶ページリスト34をRAM11aに格納し、ガベージコレクション開始位置記憶部40を不揮発性メモリ12に格納するように説明したが、一時記憶ページリスト34を不揮発性メモリ12に格納したり、ガベージコレクション開始位置記憶部40をフラッシュメモリ20に格納したりしてもよい。   In the above description of the embodiment, the temporary storage page list 34 is stored in the RAM 11a and the garbage collection start position storage unit 40 is stored in the nonvolatile memory 12. However, the temporary storage page list 34 is stored in the nonvolatile memory 12. It may be stored in the memory 12 or the garbage collection start position storage unit 40 may be stored in the flash memory 20.

本発明は、フラッシュメモリを使用したフラッシュディスク装置に広く用いることができる。   The present invention can be widely used in flash disk devices using flash memory.

実施例1のフラッシュディスクの構成を説明する図である。1 is a diagram illustrating a configuration of a flash disk of Example 1. FIG. 実施例1のフラッシュメモリのメモリ構成を説明する図である。1 is a diagram illustrating a memory configuration of a flash memory according to Embodiment 1. FIG. 実施例1のフラッシュメモリの未使用ページ管理テーブルの構成を説明する図である。FIG. 6 is a diagram illustrating a configuration of an unused page management table in the flash memory according to the first embodiment. 実施例1のフラッシュメモリのメモリ構成を説明する図である。1 is a diagram illustrating a memory configuration of a flash memory according to Embodiment 1. FIG. 実施例1の一時記憶ページリストの構成図である。FIG. 3 is a configuration diagram of a temporary storage page list according to the first embodiment. 実施例1のフラッシュディスク装置の動作フローチャート図である。FIG. 3 is an operation flowchart of the flash disk device according to the first embodiment. 実施例2のフラッシュメモリのメモリ構成を説明する図である。6 is a diagram illustrating a memory configuration of a flash memory according to Embodiment 2. FIG. 実施例2のフラッシュディスク装置の動作フローチャート図である。FIG. 10 is an operation flowchart of the flash disk device according to the second embodiment. 従来のフラッシュメモリの未使用ページリストの構成を説明する図である。It is a figure explaining the structure of the unused page list | wrist of the conventional flash memory.

符号の説明Explanation of symbols

10 フラッシュディスク装置
11 MPU
16 フラッシュメモリコントローラ
20 フラッシュメモリ
21 ブロック
22 ページ
30 アドレステーブル
32 未使用ページ管理テーブル
33 ブロック管理テーブル
34 一時記憶ページリスト
40 ガベージコレクション開始位置記憶部
10 Flash disk device 11 MPU
16 Flash memory controller 20 Flash memory 21 Block 22 Page 30 Address table 32 Unused page management table 33 Block management table 34 Temporary storage page list 40 Garbage collection start position storage unit

Claims (2)

複数のページから構成された書込み単位であるブロックを複数有するフラッシュディスク装置であって、
未使用ページの数ごとに該当するブロック番号を格納した未使用ページ管理テーブルを設け、
当該未使用ページ管理テーブルを用いて未使用ページの数が多いブロックからガベージコレクション処理を行うようにしたことを特徴とするフラッシュディスク装置。
A flash disk device having a plurality of blocks, which are write units composed of a plurality of pages,
Provide an unused page management table that stores the corresponding block number for each number of unused pages.
A flash disk device characterized in that garbage collection processing is performed from a block having a large number of unused pages using the unused page management table.
前記ブロックは、所定の数のブロックごとにチップを構成し、
前記未使用ページ管理テーブルは、未使用ページの数ごとに該当するチップ番号およびブロック番号を格納するようにしたことを特徴とする請求項1記載のフラッシュディスク装置。
The block constitutes a chip for each predetermined number of blocks,
2. The flash disk device according to claim 1, wherein the unused page management table stores a chip number and a block number corresponding to the number of unused pages.
JP2007275976A 2007-10-24 2007-10-24 Flash disk device Expired - Fee Related JP4888333B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007275976A JP4888333B2 (en) 2007-10-24 2007-10-24 Flash disk device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007275976A JP4888333B2 (en) 2007-10-24 2007-10-24 Flash disk device

Publications (2)

Publication Number Publication Date
JP2009104430A JP2009104430A (en) 2009-05-14
JP4888333B2 true JP4888333B2 (en) 2012-02-29

Family

ID=40706032

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007275976A Expired - Fee Related JP4888333B2 (en) 2007-10-24 2007-10-24 Flash disk device

Country Status (1)

Country Link
JP (1) JP4888333B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5213466B2 (en) * 2008-01-25 2013-06-19 京セラ株式会社 Mobile communication terminal
JP2019194780A (en) 2018-05-01 2019-11-07 富士通株式会社 Information processing apparatus, data management program, and data management method

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3797649B2 (en) * 1999-05-31 2006-07-19 シャープ株式会社 Nonvolatile semiconductor memory device
JP2002032256A (en) * 2000-07-19 2002-01-31 Matsushita Electric Ind Co Ltd Terminal
US7953773B2 (en) * 2005-07-15 2011-05-31 Oracle International Corporation System and method for deterministic garbage collection in a virtual machine environment
JP2008146253A (en) * 2006-12-07 2008-06-26 Sony Corp Storage device, computer system, and data processing method for storage device

Also Published As

Publication number Publication date
JP2009104430A (en) 2009-05-14

Similar Documents

Publication Publication Date Title
US10657047B2 (en) Data storage device and method of performing partial garbage collection
JP4058322B2 (en) Memory card
TWI775122B (en) Circuit for accessing at least one non-volatile memory
US8250286B2 (en) Block management method, and storage system and controller using the same
CN110908925B (en) High-efficiency garbage collection method, data storage device and controller thereof
US20080016267A1 (en) Memory controller, flash memory system having memory controller, and method for controlling flash memory
US10089225B2 (en) Improving garbage collection efficiency by reducing page table lookups
JPWO2007000862A1 (en) MEMORY CONTROLLER, NONVOLATILE MEMORY DEVICE, NONVOLATILE MEMORY SYSTEM, AND DATA WRITE METHOD
US10606744B2 (en) Method for accessing flash memory module and associated flash memory controller and electronic device
KR100882740B1 (en) Method and storage device of mapping a nonvolatile memory based on map history
US7657697B2 (en) Method of controlling a semiconductor memory device applied to a memory card
KR100914646B1 (en) Management Scheme for Flash Memory with the Multi-Plane Architecture
JP4888333B2 (en) Flash disk device
JP4661191B2 (en) Memory controller, flash memory system, and flash memory control method
TW202038100A (en) Write mangement on flash memory
JP2012068765A (en) Memory controller, flash memory system with memory controller, and control method of flash memory
JP2007323159A (en) Memory controller, flash memory system therewith, and method for controlling flash memory
JP4434171B2 (en) Memory controller and flash memory system
JP4177292B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM, AND FLASH MEMORY CONTROL METHOD
JP4661748B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP2008112455A (en) Memory card
JP4697146B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP2008299455A (en) Data storage device and data management method
JP3934659B1 (en) Memory controller and flash memory system
JP4177301B2 (en) Memory controller, flash memory system, and flash memory control method

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20110606

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110614

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110725

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110913

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20111028

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20111115

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20111128

R150 Certificate of patent or registration of utility model

Ref document number: 4888333

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20141222

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees