JP2004078902A - Storage device, memory management method, and program thereof - Google Patents

Storage device, memory management method, and program thereof Download PDF

Info

Publication number
JP2004078902A
JP2004078902A JP2003173987A JP2003173987A JP2004078902A JP 2004078902 A JP2004078902 A JP 2004078902A JP 2003173987 A JP2003173987 A JP 2003173987A JP 2003173987 A JP2003173987 A JP 2003173987A JP 2004078902 A JP2004078902 A JP 2004078902A
Authority
JP
Japan
Prior art keywords
page
address
block
data
user data
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.)
Pending
Application number
JP2003173987A
Other languages
Japanese (ja)
Inventor
Shuichi Kikuchi
菊地 修一
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.)
Tokyo Electron Device Ltd
Original Assignee
Tokyo Electron Device 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 Tokyo Electron Device Ltd filed Critical Tokyo Electron Device Ltd
Priority to JP2003173987A priority Critical patent/JP2004078902A/en
Publication of JP2004078902A publication Critical patent/JP2004078902A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Memory System (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Read Only Memory (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a storage device in which deterioration hardly occurs and a memory management method hardly causes degradation of the memory device. <P>SOLUTION: In a storage area of a flash memory 11 of this storage device, physical addresses are given to every pages which are smaller units than a block, that is, an unit of erasing. When a CPU 121 is provided with writing-in data and logical addresses to be written-in, the CPU 121 writes the data in the pages indicated by a writing pointer which is incremented in order of physical addresses and gives these pages the logical addresses provided. The corresponding relation between the physical addresses and the logical addresses of these pages is stored in a RAM (Random Access Memory) 123 as a form of a BPT (Block Pointer Table). At the time of read-out, the CPU 121 to which the logical addresses are provided retrieves the BPT, specifies the corresponding physical addresses, and reads out the data from the pages which are given the physical addresses. The flash erasing of the blocks is performed when the empty block counts turn into under the given number. <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
本発明は、記憶装置、メモリ管理方法及びプログラムに関し、特に、ブロック消去型の記憶装置、ブロック消去型の記憶装置の記憶領域を管理するメモリ管理方法及びプログラムに関する。
【0002】
【従来の技術】
コンピュータ等によりアクセス(データの読み書き及び消去)可能な記録媒体として、EEPROM(Electrically Erasable/Programable Read Only Memory)フラッシュメモリが用いられている。
フラッシュメモリは、データの消去が、所定の記憶容量の単位(一般に「ブロック」と呼ばれる)で行われる。
【0003】
フラッシュメモリのうち、特にNAND型のものは、データの記憶が正常に行えない不良ブロックの発生を製造段階で十分に防止することが困難である。このため、従来より、各ブロックに割り当てられる物理アドレスとは別個の連続した論理アドレスを正常なブロックに動的に割り当て、論理アドレスとの対応関係を表すアドレス変換テーブルを作成して、アドレスが不連続となることによる外部からのアクセス手順の複雑化を回避している(例えば、特許文献1参照)。
【0004】
【特許文献1】
国際公開第98/30239号パンフレット
【0005】
物理アドレスの割り当てはブロック単位で行われ、論理アドレスからページを特定する場合は、論理アドレスに対応付けられた物理アドレスに加え、ブロック内でのページの順位を示すページアドレスを併用して、ページを特定している。(なお、同一ブロック内では先頭のセクタから順にデータを格納していくものとすれば、連続して供給されるデータ(例えば、1個のファイルを構成するデータ)は、同一ブロック内の連続したページに格納される。)従って、データを書き換える際には、書き換える対象のデータが格納されるページの、ブロック内での順位がそのまま保たれるように配慮する必要がある。
【0006】
具体的には、書き換える対象のデータを格納する転記元のブロックから、書き換えの対象でないデータを、転記先の空きブロックへと、データの順序が保たれるようにして転記する。つまり、nをページの順位として、転記元のブロックのn番目のページにあったデータは転記先のn番目のページに転記する。また、書き換えの対象であるデータは、書き換え後のデータが書き換え前のデータの順序を保つようにして書き換える。つまり、mをページの順位として、転記元のブロックのm番目のページにあったデータを書き換えたデータを、転記先のm番目のページに転記する。そして、転記元のブロックをフラッシュイレースする(すなわち、記憶内容を消去する)、という操作を行う。
【0007】
【発明が解決しようとする課題】
しかし、このような操作を行うと、データ量が1ブロック分の記憶容量に比べて非常に小さなファイルを書き換える場合には、このファイルと無関係なデータを格納するページや、データを格納していない空きページを大量に含んだブロックがフラッシュイレースされる。
【0008】
NAND型のフラッシュメモリは、大容量の構成を安価に実現できる一方、フラッシュイレースを繰り返すことにより劣化し、データの読み書きが正常にできなくなる、という特徴がある。このため、上述の操作を行うと、少量のデータの書き換えのために効率の悪いフラッシュイレースが頻繁に行われることになり、フラッシュメモリの劣化が早まる。
【0009】
特に、OS(Operating System)が、ハードディスク装置やフレキシブルディスクの記憶内容を管理するのと同様の手法でフラッシュメモリの記憶内容を管理する場合には、OSが管理する各データとこれらデータが記憶されている論理アドレスとの対応関係を示すFAT(File Allocation Table)等がフラッシュメモリに書き込まれ、頻繁に更新される。FATのデータ量は、通常、1ブロック分の記憶容量に比べて非常に小さいので、FATの書き換えに伴って、効率の悪いフラッシュイレースが頻繁に行われる。
【0010】
この発明は上記実状に鑑みてなされたもので、劣化が起きにくい記憶装置や、記憶装置の劣化を起こしにくいメモリ管理方法を提供することを目的とする。
【0011】
【課題を解決するための手段】
上記目的を達成するため、本発明の第1の観点に係る記憶装置は、
物理アドレスを割り当てられた、ユーザデータを記憶するための複数のメモリブロックを含む記憶手段と、
前記メモリブロックを構成するページの物理アドレスと、当該ページの論理アドレスとの対応付けを表すアドレス変換テーブルを記憶するテーブル記憶手段と、
前記ページのうちからユーザデータを記憶可能な状態にある空きページを特定して、特定した空きページの物理アドレスを指示する書込ポインタを記憶する書込ページポイント手段と、
書き込み対象のデータ及び論理アドレスが自己に供給されたとき、当該書き込み対象のデータを、前記書込ポインタにより指示された空きページに書き込み、当該空きページの物理アドレスと当該論理アドレスとの対応付けを表すよう前記アドレス変換テーブルを更新する書込手段と、を備える、
ことを特徴とする。
【0012】
このような記憶装置によれば、ユーザデータの書き込みはページ単位で行われるので、ユーザデータを書き込む毎に新たな空きブロック(ユーザデータを記憶していないブロック)を探索して書き込むという操作が不要になる。従って、ユーザデータの書き込みが古いデータの消去を伴う場合(具体的には、ユーザデータの書き換えを行う場合)でも、メモリブロックの効率の悪いフラッシュイレースが行われずに済み、記憶装置の劣化が起きにくい。
【0013】
前記書込手段は、例えば、
ユーザデータを記憶しているメモリブロックのうちからデータを消去する対象のメモリブロックを指定する消去対象指定手段と、
前記消去対象指定手段により指定されたメモリブロックに記憶されているユーザデータが有効か否かを、当該指定されたメモリブロックを構成するページ毎に判別し、有効と判別したユーザデータを他のメモリブロックに転記してから、当該指定されたメモリブロックが記憶するデータを消去する消去手段と、
を備えることにより、古いデータの消去を伴うユーザデータの書き込みを行えばよい。
【0014】
前記書込手段は、ユーザデータを記憶していないメモリブロックの数が所定条件に満たない数になったか否かを判別する空きブロック数判別手段を備えているものとし、
この場合、前記消去対象指定手段は、ユーザデータを記憶していないメモリブロックの数が所定条件に満たない数になったと判別されたとき、ユーザデータを記憶しているメモリブロックのうちからデータを消去する対象のメモリブロックを指定するものとすれば、空きブロックの数が十分にあるうちはデータの消去を行わないので、無用のフラッシュイレースが避けられる。
【0015】
前記書込手段は、書き込み対象のデータ及び論理アドレスが自己に供給された時点で当該論理アドレスが割り当てられていたページに、当該ページに記憶されているユーザデータが無効なユーザデータであることを示す無効フラグを追記する手段を備え、
前記消去対象指定手段は、ユーザデータを記憶しているメモリブロックであって前記無効フラグを追記されているページを含んでいるもののうちもっとも古いユーザデータを記憶しているメモリブロックを、データを消去する対象のメモリブロックとして指定するものとすれば、各メモリブロックがフラッシュイレースされる頻度が均等になる。従って、特定のメモリブロックが集中的に劣化することにより記憶装置全体の寿命が短くなる、ということが防止される。
前記消去手段は、例えば、前記無効フラグを追記されているページが記憶するユーザデータを、前記他のメモリブロックへと転記する対象から除外するものであってよい。
【0016】
物理アドレスは、当該物理アドレスが示すページが属するブロックを示すブロックアドレスを含んでいて、ブロックアドレスはサイクリックに順位付けされていてもよい。
この場合、前記消去対象指定手段は、ユーザデータを記憶しているメモリブロックのうち、最後にデータを消去されたブロック以降で先頭のブロックアドレスを与えられているものを、データを消去する対象のメモリブロックとして指定するものとすれば、メモリブロックはブロックアドレス順にフラッシュイレースされ、各メモリブロックのフラッシュイレースの頻度が均等になる。
【0017】
前記書込手段は、書き込み対象のデータ及び論理アドレスが自己に供給された時点で当該論理アドレスが割り当てられていたページに、当該ページに記憶されているユーザデータが無効なユーザデータであることを示す無効フラグを追記する手段を備えていてもよい。
この場合、前記消去手段は、前記無効フラグを追記されているページが記憶するユーザデータを、前記他のメモリブロックへと転記する対象から除外するものとすれば、メモリブロックがフラッシュイレースされた時点で、無効なユーザデータは記憶装置の記憶領域から消去される。
【0018】
前記書込手段は、前記書き込み対象のデータを書き込んだページに、自己に供給された論理アドレスを書き込む手段を備えていてもよい。
この場合、前記消去手段は、ページが記憶している論理アドレスと、前記アドレス変換テーブルにより当該ページの物理アドレスに対応付けられている論理アドレスとが一致するか否かを判別し、一致しないと判別したとき、当該ページが記憶するユーザデータを、前記他のメモリブロックへと転記する対象から除外するものとすれば、メモリブロックがフラッシュイレースされた時点で、無効なユーザデータは記憶装置の記憶領域から消去される。
【0019】
物理アドレスはサイクリックに順位付けされていてもよい。
この場合、前記書込ページポイント手段は、ユーザデータを書き込まれたページの物理アドレス以降の物理アドレスを与えられている空きページのうちの先頭の空きページを特定するものとすれば、データの書き込みは物理アドレス順に行われるので、特定のメモリブロックに書き込みが集中することが避けられ、従って、書き込みが集中したメモリブロックにフラッシュイレースの機会が集中することが避けられる。
【0020】
前記記憶装置は、例えば、読み出し対象のページの論理アドレスが自己に供給されたとき、前記アドレス変換テーブルに基づいて、当該論理アドレスに対応付けられた物理アドレスを特定し、特定した物理アドレスが示すページよりユーザデータを読み出して外部に出力する読出手段を備えるものであってもよい。
【0021】
また、前記記憶装置は、例えば、読み出し対象のページの論理アドレスが自己に供給されたとき、前記アドレス変換テーブルに基づいて、当該論理アドレスを与えられたページを特定し、特定したページよりユーザデータを読み出して外部に出力する読出手段を備えるものであってもよい。
【0022】
前記アドレス変換テーブルは、ページの物理アドレスの上位の所定桁分と、当該ページの論理アドレスとの対応付けを表すものとすれば、物理アドレスの情報量が小さくて済むため、アドレス変換テーブルを格納するための記憶領域が節約され、記憶装置全体も小型になる。
そしてこの場合、前記書込手段は、例えば、前記書き込み対象のデータを書き込んだページに、自己に供給された論理アドレスを書き込む手段を備えてもよく、
前記読出手段は、例えば、読み出し対象のページの論理アドレスが自己に供給されたとき、前記アドレス変換テーブルに基づいて、当該論理アドレスに対応付けられた物理アドレスの上位の桁の値を特定し、物理アドレスの上位の桁が特定した値に一致する各ページのうち、当該読み出し対象のページの論理アドレスが書き込まれているページよりユーザデータを読み出して外部に出力するものであればよい。
【0023】
前記書込手段は、書き込み対象のデータ及び論理アドレスが自己に供給された時点で当該論理アドレスが割り当てられていたページに、当該ページに記憶されているユーザデータが無効なユーザデータであることを示す無効フラグを追記する手段を備えていてもよい。
この場合、前記読出手段は、例えば、物理アドレスの上位の桁が特定した値に一致する各ページのうち、当該読み出し対象のページの論理アドレスが書き込まれていて、且つ、前記無効フラグを追記されていないページよりユーザデータを読み出して外部に出力するものであればよい。
【0024】
物理アドレスはサイクリックに順位付けされていてもよい。
この場合、
前記書込ページポイント手段は、ユーザデータを書き込まれたページの物理アドレス以降の物理アドレスを与えられている空きページのうちの先頭の空きページを特定するものであってもよく、
前記読出手段は、物理アドレスの上位の桁が特定した値に一致していて当該読み出し対象のページの論理アドレスが書き込まれているページのうち、もっとも順位の低いページよりユーザデータを読み出して外部に出力するものであってもよい。
【0025】
前記アドレス変換テーブルは、ページの物理アドレスの下位の所定桁分と、当該ページの論理アドレスとの対応付けを表すものであって、論理アドレスに対応付け得る物理アドレスの値の範囲は論理アドレス毎に定められているものとした場合も、物理アドレスの情報量が小さくて済むため、アドレス変換テーブルを格納するための記憶領域が節約され、記憶装置全体も小型になる。
この場合、前記読出手段は、例えば、読み出し対象のページの論理アドレスが自己に供給されたとき、前記アドレス変換テーブルに基づいて、当該論理アドレスに対応付けられた物理アドレスの下位の桁の値を特定し、物理アドレスの下位の桁が特定した値に一致する各ページのうち、当該論理アドレスに対応付け得る範囲内の物理アドレスを与えられているページよりユーザデータを読み出して外部に出力するものであればよい。
【0026】
前記テーブル記憶手段は、前記アドレス変換テーブルを記憶する不揮発性メモリより構成されていてもよい。このような構成を有することにより、前記記憶装置は、起動するたびにアドレス変換テーブルを記憶し直す必要がなくなる。
【0027】
前記テーブル記憶手段は、前記アドレス変換テーブルを記憶する前記ページより構成されていてもよい。このような構成を有する場合も、前記記憶装置は、起動するたびにアドレス変換テーブルを記憶し直す必要がなくなる。
この場合、前記書込手段は、例えば、当該ページから前記アドレス変換テーブルの少なくとも一部を読み出して、読み出した部分を、前記書込ポインタにより指示された空きページの物理アドレスと当該論理アドレスとの対応付けを表すよう更新して、更新した当該部分を他の空きページに書き込む変換テーブル更新手段を備えていればよい。
【0028】
前記変換テーブル更新手段は、前記アドレス変換テーブルを構成するデータを記憶するページの物理アドレスを表すアドレス変換テーブル格納位置リストを記憶する手段を備えていてもよい。
この場合、前記変換テーブル更新手段は、例えば、
記憶した当該アドレス変換テーブル格納位置リストが示す物理アドレスを与えられたページから前記アドレス変換テーブルの少なくとも一部を読み出して、読み出した部分を、前記書込ポインタにより指示された空きページの物理アドレスと当該論理アドレスとの対応付けを表すよう更新して、更新した当該部分を他の空きページに書き込む手段と、
記憶した当該アドレス変換テーブル格納位置リストを、前記他の空きページの物理アドレスを表すよう更新する手段と、を備えることにより、アドレス変換テーブルの参照を行えばよい。
【0029】
前記アドレス変換テーブルを構成するデータを記憶するページの物理アドレスの上位の桁の値の範囲は予め定められているものとすれば、アドレス変換テーブル格納位置リストの情報量が小さくて済むため、アドレス変換テーブル格納位置リストを格納するための記憶領域が節約され、記憶装置全体も小型になる。
この場合、前記変換テーブル更新手段は、例えば、
前記アドレス変換テーブルを構成するデータを記憶するページの物理アドレスの下位の所定桁分を表すアドレス変換テーブル格納位置リストを記憶する手段と、
記憶した当該アドレス変換テーブル格納位置リストにより物理アドレスの下位の桁が特定されるページのうち、上位の桁が当該範囲にあるページから前記アドレス変換テーブルの少なくとも一部を読み出して、読み出した部分を、前記書込ポインタにより指示された空きページの物理アドレスと当該論理アドレスとの対応付けを表すよう更新して、更新した当該部分を他の空きページに書き込む手段と、
記憶した当該アドレス変換テーブル格納位置リストを、前記他の空きページの物理アドレスを表すよう更新する手段と、を備えることにより、アドレス変換テーブルの参照を行えばよい。
【0030】
前記変換テーブル更新手段は、前記アドレス変換テーブルを記憶するページのうちから、自己に供給された論理アドレスと前記物理アドレスとの対応付けを表す部分を記憶するページを特定し、特定したページが記憶する部分のみを読み出して、読み出した部分を、前記書込ポインタにより指示された空きページの物理アドレスと当該論理アドレスとの対応付けを表すよう更新して、更新した当該部分を他の空きページに書き込むものであってもよい。
このような構成を有していれば、アドレス変換テーブルを参照する必要が生じるたびにアドレス変換テーブルの全体を逐一読み出す、という操作が行われないので、アドレス変換テーブルへのアクセスに費やされる時間が短縮される。
【0031】
前記記憶装置は、前記ユーザデータが記憶されていないメモリブロックを識別する情報を含む空きブロックテーブルを記憶する不揮発性メモリを更に備えていてもよい。このような構成を有していれば、前記記憶装置は、起動するたびに空きブロックテーブルを再構築する必要がない。
この場合、前記書込手段は、例えば、
自己に供給された書き込み対象のデータを空きページに書き込む結果、当該空きページを含むメモリブロックから空きページが無くなったか否かを判別し、無くなったと判別したとき、当該空きページを含むメモリブロックが前記ユーザデータを記憶していることを示すように前記空きブロックテーブルを更新する手段と、
記憶するデータを前記消去手段により消去されたメモリブロックが前記ユーザデータを記憶していないことを示すように前記空きブロックテーブルを更新する手段と、を備えることにより、空きブロックテーブルの参照を行えばよい。
【0032】
一部の前記ページは、ユーザデータが記憶されていないメモリブロックを識別する情報を含む空きブロックテーブルを記憶する空きブロックテーブル記憶手段を構成していてもよい。このような構成を有する場合も、前記記憶装置は、起動するたびに空きブロックテーブルを再構築する必要がない。
この場合、前記書込手段は、例えば、
自己に供給された書き込み対象のデータを空きページに書き込む結果、当該空きページを含むメモリブロックから空きページが無くなったか否かを判別し、無くなったと判別したとき、前記空きブロックテーブル記憶手段より前記空きブロックテーブルの少なくとも一部を読み出して、当該空きページを含むメモリブロックが前記ユーザデータを記憶していることを示すように前記空きブロックテーブルを更新して、更新後の空きブロックテーブルを前記空きブロックテーブル記憶手段に記憶させる手段と、
前記空きブロックテーブル記憶手段より前記空きブロックテーブルの少なくとも一部を読み出して、記憶するデータを前記消去手段により消去されたメモリブロックが前記ユーザデータを記憶していないことを示すように前記空きブロックテーブルを更新して、更新後の空きブロックテーブルを前記空きブロックテーブル記憶手段に記憶させる手段と、を備えることにより、空きブロックテーブルの参照を行えばよい。
【0033】
前記書込手段は、前記空きブロックテーブルを構成するデータを記憶するページの物理アドレスを表す空きブロックテーブルポインタを記憶する手段を備えていてもよい。
この場合、前記書込手段は、例えば、記憶した当該空きブロックテーブルポインタが示す物理アドレスを与えられたページから前記空きブロックテーブルの少なくとも一部を読み出すことにより、空きブロックテーブルの参照を行えばよい。
【0034】
前記空きブロックテーブルを構成するデータを記憶するページの物理アドレスの上位の桁の値の範囲は予め定められているものとすれば、空きブロックテーブルポインタの情報量が小さくて済むため、空きブロックテーブルポインタを格納するための記憶領域が節約され、記憶装置全体も小型になる。
この場合、前記書込手段は、例えば、前記空きブロックテーブルを構成するデータを記憶するページの物理アドレスの下位の所定桁分を表す空きブロックテーブルポインタを記憶する手段を備え、記憶した当該空きブロックテーブルポインタにより物理アドレスの下位の桁が特定されるページのうち、上位の桁が当該範囲にあるページから前記空きブロックテーブルの少なくとも一部を読み出すようにすることで、空きブロックテーブルの参照を行えばよい。
【0035】
前記書込手段は、前記空きブロックテーブルを記憶するページのうちから、前記空きブロックテーブルのうち更新すべき部分を記憶するページを特定し、特定したページが記憶する部分のみを読み出すものであってもよい。
このような構成を有していれば、空きブロックテーブルを参照する必要が生じるたびに空きブロックテーブルの全体を逐一読み出す、という操作が行われないので、空きブロックテーブルへのアクセスに費やされる時間が短縮される。
【0036】
また、本発明の第2の観点に係るメモリ管理方法は、
物理アドレスを割り当てられた、ユーザデータを記憶するための複数のメモリブロックを管理するためのメモリ管理方法であって、
前記メモリブロックを構成するページの物理アドレスと、当該ページの論理アドレスとの対応付けを表すアドレス変換テーブルを記憶するテーブル記憶ステップと、
前記ページのうちからユーザデータを記憶可能な状態にある空きページを特定して、特定した空きページの物理アドレスを指示する書込ポインタを記憶する書込ページポイントステップと、
書き込み対象のデータ及び論理アドレスが供給されたとき、当該書き込み対象のデータを、前記書込ポインタにより指示された空きページに書き込み、当該空きページの物理アドレスと当該論理アドレスとの対応付けを表すよう前記アドレス変換テーブルを更新する書込ステップと、を含む、
ことを特徴とする。
【0037】
このようなメモリ管理方法によれば、ユーザデータの書き込みはページ単位で行われるので、ユーザデータを書き込む毎に新たな空きブロック(ユーザデータを記憶していないブロック)を探索して書き込むという操作が不要になる。従って、ユーザデータの書き込みが古いデータの消去を伴う場合(具体的には、ユーザデータの書き換えを行う場合)でも、メモリブロックの効率の悪いフラッシュイレースが行われずに済み、メモリブロックを有する装置の劣化が起きにくい。
【0038】
前記書込ステップは、
ユーザデータを記憶しているメモリブロックのうちからデータを消去する対象のメモリブロックを指定する消去対象指定ステップと、
前記消去対象指定ステップで指定されたメモリブロックに記憶されているユーザデータが有効か否かを、当該指定されたメモリブロックを構成するページ毎に判別し、有効と判別したユーザデータを他のメモリブロックに転記してから、当該指定されたメモリブロックが記憶するデータを消去する消去ステップと、
を含むことにより、古いデータの消去を伴うユーザデータの書き込みを行えばよい。
【0039】
前記書込ステップは、ユーザデータを記憶していないメモリブロックの数が所定条件に満たない数になったか否かを判別する空きブロック数判別ステップを含み、前記消去対象指定ステップでは、ユーザデータを記憶していないメモリブロックの数が所定条件に満たない数になったと判別されたとき、ユーザデータを記憶しているメモリブロックのうちからデータを消去する対象のメモリブロックを指定するものとすれば、空きブロックの数が十分にあるうちはデータの消去が行われないので、無用のフラッシュイレースが避けられる。
【0040】
また、本発明の第3の観点に係るプログラムは、
物理アドレスを割り当てられた、ユーザデータを記憶するための複数のメモリブロックを含む記憶手段に接続されたコンピュータを、
前記メモリブロックを構成するページの物理アドレスと、当該ページの論理アドレスとの対応付けを表すアドレス変換テーブルを記憶するテーブル記憶手段と、
前記ページのうちからユーザデータを記憶可能な状態にある空きページを特定して、特定した空きページの物理アドレスを指示する書込ポインタを記憶する書込ページポイント手段と、
書き込み対象のデータ及び論理アドレスが自己に供給されたとき、当該書き込み対象のデータを、前記書込ポインタにより指示された空きページに書き込み、当該空きページの物理アドレスと当該論理アドレスとの対応付けを表すよう前記アドレス変換テーブルを更新する書込手段と、
して機能させるためのものであることを特徴とする。
【0041】
このようなプログラムを実行するコンピュータによれば、ユーザデータの書き込みはページ単位で行われるので、ユーザデータを書き込む毎に新たな空きブロック(ユーザデータを記憶していないブロック)を探索して書き込むという操作が不要になる。従って、ユーザデータの書き込みが古いデータの消去を伴う場合(具体的には、ユーザデータの書き換えを行う場合)でも、メモリブロックの効率の悪いフラッシュイレースが行われずに済み、記憶装置の劣化が起きにくい。
【0042】
前記書込手段は、例えば、
ユーザデータを記憶しているメモリブロックのうちからデータを消去する対象のメモリブロックを指定する消去対象指定手段と、
前記消去対象指定手段により指定されたメモリブロックに記憶されているユーザデータが有効か否かを、当該指定されたメモリブロックを構成するページ毎に判別し、有効と判別したユーザデータを他のメモリブロックに転記してから、当該指定されたメモリブロックが記憶するデータを消去する消去手段と、
を備えることにより、古いデータの消去を伴うユーザデータの書き込みを行えばよい。
【0043】
前記書込手段は、ユーザデータを記憶していないメモリブロックの数が所定条件に満たない数になったか否かを判別する空きブロック数判別手段を備え、前記消去対象指定手段は、ユーザデータを記憶していないメモリブロックの数が所定条件に満たない数になったと判別されたとき、ユーザデータを記憶しているメモリブロックのうちからデータを消去する対象のメモリブロックを指定するものとすれば、空きブロックの数が十分にあるうちはデータの消去を行わないので、無用のフラッシュイレースが避けられる。
【0044】
【発明の実施の形態】
以下、この発明の実施の形態を、フラッシュメモリを備えた記憶システムを例とし、図面を参照して説明する。
【0045】
図1は、この発明の実施の形態にかかる記憶システムの物理的構成を示すブロック図である。
図示するように、この記憶システムは、メモリユニット1と、コンピュータ2とから構成されている。メモリユニット1は、コンピュータ2が備えるスロットを介して、コンピュータ2に着脱可能に装着されている。
コンピュータ2が備えるスロットは、例えば、PCMCIAバスを中継するためのPCMCIAスロットからなる。
【0046】
メモリユニット1は、フラッシュメモリ11及びコントローラ12からなる。
【0047】
フラッシュメモリ11は、例えば、EEPROM(Electrically Erasable/Programable Read Only Memory)等の記憶装置からなる。フラッシュメモリ11は、コントローラ12が行うアクセスに応答し、コンピュータ2から供給されたデータの記憶と、記憶しているデータのコンピュータ2への供給と、記憶しているデータの消去とを行う。
【0048】
フラッシュメモリ11が有する記憶領域は、例えば図2に示すように524288個のページからなり、各々のページは528バイトの記憶容量を有する。各ページに含まれるメモリセルには、連続的に0から527までの番地が与えられている。
【0049】
各ページは、図示するように、先頭から512バイトの領域を占めるデータ領域と、末尾16バイトを占める冗長部とから構成される。
データ領域には、ユーザデータ(コンピュータ2から供給され書き込まれるデータや、コンピュータ2に供給される対象となるデータ)が格納される。
冗長部には、この冗長部と同じページに属するデータ領域に格納されているユーザデータの内容が破壊されていないことを確認するためのECC(エラー訂正コード)や、不良ブロックフラグが格納される。
【0050】
不良ブロックフラグは、この不良ブロックフラグが格納されているページが属するブロック(後述)が、データを正常に格納可能なブロック(良品ブロック)であるか、良品ブロックでないブロックすなわち不良ブロックであって、フラッシュメモリ11の製造者等によって出荷前に不良と判断されたブロック(初期不良ブロック)であるか、不良ブロックであって、フラッシュメモリ11の使用中にデータの正常な格納ができないと判断されたブロック(後発不良ブロック)であるか、を示すデータである。
【0051】
なお、良品ブロックを表している不良ブロックフラグは、後発不良ブロックを示す値を上書きすることで、後発不良ブロックを表すように更新できるものとする。
NAND型のフラッシュメモリは、値“1”を格納するメモリセルに値“0”を上書きすることが可能である。(値“0”を格納するメモリセルに値“1”を上書きすることはできず、当該メモリセルを含むブロックをいったんフラッシュイレース(後述)する必要がある。)
このため、例えば、フラッシュメモリ11がNAND型のフラッシュメモリより構成されており、不良ブロックフラグが1バイト(8ビット)のデータより構成されているとした場合は、この8ビットのデータのうち値“0”を表すビットが1個以下であるときブロックが良品ブロックであることを示し、2個以上6個以下であるときは後発不良ブロックであることを示し、7個以上であるときは初期不良ブロックであることを示すものとすれば、良品ブロックを表している不良ブロックフラグは、後発不良ブロックを示す値を上書きすることで、後発不良ブロックを表すように更新でき、この不良ブロックフラグを格納するブロックをフラッシュイレースする操作は不要となる。
【0052】
また、データ領域に格納されているユーザデータが無効なデータである場合(たとえば、このデータを更新したものがフラッシュメモリ11の他のデータ領域に格納された場合)、このデータ領域と同じページに属する冗長部には、このデータが無効なデータであることを示す旧データフラグが、後述する処理により格納される。
【0053】
そして、各ページは、先頭から64ページ単位で1つのブロックを構成する。各ブロックは32キロバイトの記憶容量を有し、記憶領域全体は、8192個のブロックから構成され、先頭から連続的に0から8191までの物理ブロックアドレスを与えられている。各々のブロックに属する各ページには、連続的に0から63までのページアドレスが付与されている。
【0054】
また、各々のページの冗長部には、当該ページに与えられている論理アドレスの値が格納される。論理アドレスは、フラッシュメモリ11が後述する動作により読み書きされるときに、コントローラ12により、データ読み書きの単位として認識される単位である。
【0055】
ページの論理アドレスは、例えば、当該ページが属するブロックを示す上位の桁(論理ブロックアドレス)と、当該ブロック内での当該ページの位置を示す下位の桁(ページアドレス)とからなっている。論理アドレスの総数は、フラッシュメモリ11が物理的に備えるページの総数より小さい所定量、例えば512000個である。
【0056】
フラッシュメモリ11は、メモリユニット1のコントローラ12より、特定のブロックのデータを消去するよう指示されると、当該ブロックに含まれるすべてのメモリセルの記憶内容をフラッシュイレースする(具体的には、例えばフラッシュメモリ11がNAND型のフラッシュメモリからなる場合は、各メモリセルの記憶値を“1”とする)。
【0057】
また、フラッシュメモリ11のデータ領域には、ディレクトリと、FAT(File Allocation Table)と、書き込みポインタ初期値とが格納され、後述する処理によって更新される。
【0058】
ディレクトリ、FAT及び書き込みポインタ初期値が格納されるページには、所定の条件に合致する論理アドレスが付される。具体的には、例えば、論理アドレスとして先頭の4096個のアドレス(すなわち、00000h以上00FFFh以下のアドレス)が付される。
【0059】
図3は、ディレクトリ、FAT及び論理ブロックアドレスの相互の対応関係を示す図である。図示するように、ディレクトリ及びFATが記憶されたページの論理アドレスは、例えば、CPU121が記憶する(あるいはCPU121がRAM123に記憶させる)ディレクトリポインタによって示されている。
【0060】
ディレクトリは、フラッシュメモリ11内に記憶されているファイル(すなわち、一括して扱う対象としてコンピュータ2が指定するデータの集合)のファイル名と、そのファイルの先頭部分が記憶されている論理アドレスとを示すテーブルである。
【0061】
FATは、フラッシュメモリ11の記憶領域内でのファイルの配置を示すテーブルであり、ファイルが1つのページ内に収まらないとき、図3に示すように、後続の部分を記憶するページの論理アドレスをそれぞれ示すものである。ファイルの最終部分が記憶されているページの論理アドレスは、図3に示すように、終了コード(EC)を付されることによって、そのページアドレスが最終部分を表すものであることが示される。
【0062】
書き込みポインタ初期値は、CPU121がユーザデータを書き込むべきページを指し示す変数である後述の書き込みポインタの最新の値を表すものであり、この記憶システムが起動後最初にフラッシュメモリ11へのユーザデータの書き込みにおいてユーザデータを書き込むべきページを指定するものとなる。
【0063】
コントローラ12は、図1に示すように、CPU(Central Processing Unit)121と、ROM(Read Only Memory)122と、RAM(Random Access Memory)123とを備えている。RAM123は、例えば、SRAM(Static RAM)より構成されている。
【0064】
CPU121は、ROM122、RAM123及びフラッシュメモリ11に接続されており、また、コンピュータ2が備えるPCMCIAスロットを介してコンピュータ2に着脱可能に接続されている。
【0065】
CPU121は、コントローラ12の製造者等によって予めROM122に格納されているプログラムの処理に従って、後述する処理を行う。
そして、CPU121は、アクセス装置を構成するコンピュータ2から供給される命令を取得すると、その命令を実行する。CPU121が実行する命令には、フラッシュメモリ11にアクセスする命令が含まれる。
【0066】
RAM123が有する記憶領域は、CPU121の作業領域として用いられ、また、この記憶領域は退避用メモリ領域を含んでおり、更に、CPU121が後述する処理により作成するBSI(Block Search Index)及びBPT(Block Pointer Table)と、書き込みポインタとを格納する。
【0067】
退避用メモリ領域は、後述するデータ書き込みの処理において、書き込みを行う対象のページを含むブロックに格納されているデータを一時的に格納するための記憶領域である。
【0068】
BSIは、フラッシュメモリ11の記憶領域に含まれる各ブロックのうちどれが空きブロック(すなわち、フラッシュイレースされユーザデータを記憶していない状態にあるブロック)であるかを特定する情報を格納する。BSIは、コントローラ12の後述する処理に従って作成及び更新される。
【0069】
フラッシュメモリ11のブロックの総数が8192個であるときのBSIの構造の一例を図4に示す。図示するように、BSIは1キロバイトのデータからなり、先頭のビットから順に、先頭のブロックから8192個目のブロックまで順に1対1に対応付けられており、対応付けられたブロックが空きブロックであるとき“1”、空きブロックでないとき“0”を格納する。
【0070】
BPTは、各々のページについて、当該ページの論理アドレスと、物理アドレスとの対応関係を示す情報を格納するものである。BPTは、CPU121による後述の処理に従って作成あるいは更新される。
【0071】
BPTは、具体的には、例えば図5に示すデータ構造を有する。
すなわち、BPTは、例えばRAM123の記憶領域中の所定の論理的位置を占め、各々の論理アドレスに対応付けられた物理アドレスを記憶するための記憶領域を備える。そして、論理アドレスの総数が512000個であるとした場合、例えば、図示するように、先頭から19ビット毎に付されたアドレスが01000h〜7DFFFhである、合計1216000バイトの記憶領域を備えていればよい。
【0072】
BPTが図5に示すデータ構造を有するとした場合、BPTを形成する記憶領域に付された各々のアドレスは、論理アドレスと所定のオフセット値との和に等しい。(図5は、オフセット値が“1000h”である場合を例示するものである。)
そして、各々のアドレスを付された19ビットの記憶領域に格納されている内容は、当該アドレスが示す論理アドレスに対応付けられているページの物理アドレス(物理ブロックアドレス及びページアドレスの組)を表す。
【0073】
具体的には、例えば図5に示すように、アドレス1001hを付された記憶領域に値“0A10Fh”(2進数“0001010000100001111”)が格納されており、オフセット値が1000hであるとする。この場合は、物理アドレスが0A10Fh(物理ブロックアドレスが“0284h”で、ページアドレスが“0Fh”)であるページには、論理アドレスとして0001hが対応付けられている。
【0074】
ただし、各々のアドレスを付された記憶領域に格納されている内容が所定の値を表す場合(例えば、図示するように、物理アドレスの値“7FFFFh”を表す場合)は、その値を格納している記憶領域のアドレスが示す論理アドレスには、物理アドレスが対応付けられていないことを表す。
【0075】
書き込みポインタは、CPU121がユーザデータを書き込むべきページを指定する変数(ポインタ)であり、具体的には、該当するページの物理アドレスを示しているものである。書き込みポインタの値は、後述する処理に従って更新される。
【0076】
コンピュータ2はパーソナルコンピュータ等からなり、PCMCIAスロットを備え、OS及びドライバを表すプログラムデータを記憶し、電源投入後、OSを実行する。そして、PCMCIAスロットにメモリユニット1が装着されたことを検知すると、OSの処理に従ってドライバを起動する。
【0077】
ドライバの処理を行うコンピュータ2は、コントローラ12に上述の命令を供給したり、フラッシュメモリ11に書き込む対象のデータを供給して、CPU121に、フラッシュメモリ11へのアクセスを行わせる。そして、自らが供給した命令に従ってCPU121がフラッシュメモリ11から読み出して自らに供給したデータを、CPU121より取得する。
【0078】
(動作)
次に、この記憶システムの動作を、図6〜図10を参照して説明する。
図6は、初期処理を示すフローチャートである。
図7は、データ読み出しの処理を示すフローチャートである。
図8は、データ書き込みの処理を示すフローチャートである。
図9は、ディレクトリ及びFAT更新の処理を示すフローチャートである。
図10は、空きブロック確保の処理を示すフローチャートである。
【0079】
(初期処理)
この記憶システムが起動すると、メモリユニット1のコントローラ12のCPU121は、図6に示す初期処理を実行する。
初期処理を開始すると、CPU121は、RAM123の記憶領域のうち、BPT及びBSIを格納する部分の初期化を行う(図6、ステップS101)。
【0080】
ステップS101でCPU121は、具体的には、RAM123の記憶領域のうちBPTを格納する部分について、上述のアドレスが示す各19ビットの区画に、物理アドレスが対応付けられていないことを示す所定の値(例えば、上述の値“7FFFFh”)を書き込む。また、BSIを格納する部分のビットの論理値を、すべて“0”とする。
【0081】
次に、CPU121は、フラッシュメモリ11の、冗長部にあるデータを未だ読み出されていないブロックのうちから、最も物理ブロックアドレスが若いものを特定し、特定されたブロックに属する各ページの冗長部に格納されているデータをすべて読み出す(ステップS102)。
【0082】
次に、CPU121は、ステップS102で読み出したデータに基づき、ステップS102でデータを読み出したブロックが空きブロックであるか否かを判別する(ステップS103)。具体的には、例えば、ステップS102で読み出したデータが、所定の形式の空きブロックコードを含んでいるか否かを判別する。そして、空きブロックでないと判別すると、CPU121は、処理をステップS105に移す。
【0083】
一方、このブロックが空きブロックであるとステップS103で判別すると、CPU121は、このブロックを示す物理ブロックアドレスから、BSIのうちこのブロックの状態を示すビットがRAM123の記憶領域中で占める位置を算出する。そして、位置を算出したビットの論理値を“1”に書き換える(ステップS104)。ステップS104の処理を終えると、CPU121は処理をステップS106に移す。
【0084】
一方、ステップS105で、CPU121は、フラッシュメモリ11から読み出した論理アドレスを読み出した各々のページの物理アドレスをRAM123の記憶領域に書き込む。ステップS105でCPU121がページの物理アドレスを書き込む論理的位置は、このページから読み出した論理アドレスに相当するアドレスを付された部分とする。これにより、BPTに、物理アドレスと論理アドレスとの対応付けを示す新たな情報が追加される。
【0085】
そして、CPU121は、フラッシュメモリ11の同一のブロックから読み出したすべての論理アドレスについてステップS105の処理を終えると、処理をステップS106に移す。
【0086】
ステップS106で、CPU121は、ステップS102で冗長部に格納されているデータを読みとられたブロックの次のブロックが存在するか否かを判別する。そして、存在すると判別すると処理をステップS102に戻し、存在しないと判別すると、処理をステップS107に移す。
【0087】
ステップS107でCPU121は、書き込みポインタ初期値が格納されているページにアクセスして書き込みポインタ初期値を読み出し、RAM123に記憶させ、初期処理を終了する。
以上説明した初期処理により、BSI及びBPTが作成され、書き込みポインタの初期値が特定される。
【0088】
(データ読み出しの処理)
初期処理が終了すると、メモリユニット1のCPU121は、コンピュータ2より、フラッシュメモリ11へのアクセスの指示を受け付ける。
コンピュータ2は、CPU121にフラッシュメモリ11からのデータの読み出しを指示するときは、まず、ディレクトリ及びFATを読み出すため、読み出しを指示する命令と、ディレクトリ及びFATが記憶されている各ページの論理アドレスを、CPU121に供給する(図7、ステップS201)。
【0089】
データの読み出しを指示する命令と、論理アドレスとを供給されたCPU121は、論理アドレスをキーとしてBPTを検索し、ディレクトリ及びFATが記憶されている各ページの物理アドレスを索出し、索出した物理アドレスが示す各ページより、ディレクトリやFATを構成するデータを読み出して、コンピュータ2に供給する(ステップS202)。コンピュータ2は、CPU121から供給されたディレクトリ及びFATを一時記憶する。
【0090】
次に、コンピュータ2は、読み出す対象のデータを含むファイルのファイル名を有するファイルの内容が格納されている先頭のページの論理アドレスを索出するため、このファイル名をキーとして、CPU121より供給され一時記憶したディレクトリを検索する(ステップS203)。
【0091】
次に、コンピュータ2は、ステップS203で索出した論理アドレスをキーとして、CPU121から供給されたFATを検索し、ディレクトリから論理アドレスを索出されたページに後続するページの論理アドレスがあればすべて索出して、該当するページが連続する順序を特定する(ステップS204)。
【0092】
そして、コンピュータ2は、ステップS203及びS204で索出されたページの記憶内容を読み出すため、読み出しを指示する命令と、ユーザデータを読み出すべきページ(つまり、ステップS203及びS204で索出されたページで未だデータを読み出されていないページのうちの先頭のページ)の論理アドレスとを、CPU121に供給する(ステップS205)。
【0093】
CPU121は、ステップS205で読み出しを指示する命令及び論理アドレスを供給されると、RAM123にアクセスし、ステップS205でコンピュータ2より供給された論理アドレスをキーとしてBPTを検索して、この論理アドレスに対応付けられた物理アドレスがあるか否かを判別する(ステップS206)。
そして、該当する物理アドレスがないと判別すると、CPU121は、所定のエラーメッセージ(例えば、所定値“FFh”)をコンピュータ2に供給して(ステップS207)、データ読み出しの処理を終了(異常終了)する。
【0094】
一方、該当する物理アドレスがあると判別すると、CPU121は、この物理アドレスが示すページよりデータを読み出す(ステップS208)。そして、読み出したデータのうちデータ領域に格納されていたデータに基づいてECCを生成し、生成したECCと、読み出したデータのうち冗長部に格納されていたECCとに基づいて、データ領域に格納されていたデータが正しく読み出されたか否かを判別する(ステップS209)。
【0095】
ステップS209で、正しく読み出されたと判別すると、CPU121は、データ領域に格納されていたデータをコンピュータ2に供給する(ステップS210)。
【0096】
正しく読み出されていないと判別すると、CPU121は、データ領域に格納されていたデータを正しい内容へと訂正することが可能か否かを、冗長部に格納されていたECC等に基づいて判別する(ステップS211)。そして、復元が可能であると判別すると、データ領域に格納されていたデータを訂正してコンピュータ2に供給する(ステップS212)。
【0097】
ステップS211で、訂正ができないと判別すると、訂正できない当該データを読み出したページの冗長部(又は、このページと同じブロック内の他の任意のページの冗長部)に格納されている不良ブロックフラグを、後発不良ブロックを表す値へと上書き更新し、データの読み取りに失敗したことをコンピュータ2に通知する(ステップS213)。コンピュータは、この通知を受けると、データ読み出しの処理を中断(異常終了)する。
【0098】
一方、コンピュータ2は、ステップS210又はS212でCPU121より読み出し対象のデータを供給されると、ユーザデータを読み出すべきページが残っているか否かを判別する(ステップS214)。そして、該当するページが残っていると判別したときは処理をステップS205に戻し、残っていないと判別したときは処理を終了する。
【0099】
以上説明したステップS201〜S214の処理により、フラッシュメモリ11よりデータが読み出され、コンピュータ2へと供給される。
【0100】
(データ書き込みの処理)
また、フラッシュメモリ11へのデータの書き込みを行う場合、まず、コンピュータ2は、ディレクトリ及びFATを読み出すため、上述のステップS201と同様に、読み出しを指示する命令と、ディレクトリ及びFATが記憶されている各ページの論理アドレスを、CPU121に供給する(図8、ステップS301)。ただし、既にデータの読み出し等のためにディレクトリ及びFATを一時記憶している場合はステップS301の処理を省略し、ステップS303から処理を始める。
【0101】
データの読み出しを指示する命令及び論理アドレスを供給されたCPU121は、上述のステップS202と実質的に同一の処理を行うことによりディレクトリ及びFATを読み出して、コンピュータ2に供給する(ステップS302)。コンピュータ2は、CPU121から供給されたディレクトリ及びFATを一時記憶する。
【0102】
次に、コンピュータ2は、フラッシュメモリ11に書き込む対象のファイルのファイル名をキーとして、CPU121より供給されたディレクトリを検索し、そのファイル名がディレクトリに格納されているか否かを判別する(ステップS303)そして、格納されていないと判別したときは、処理を後述のステップS305に移す。
【0103】
一方、格納されていると判別したとき、コンピュータ2は、ステップS303での検索により索出したファイル名に対応付けられている論理アドレスをキーとして、CPU121から供給されたFATを検索し、このファイル名が示すデータを格納する各ページの論理アドレスを索出して一時記憶し(ステップS304)、処理をステップS305に移す。
【0104】
ステップS305で、コンピュータ2は、後述するステップS306及びS313でCPU121に供給すべきデータを決定する。
具体的には、ステップS305でコンピュータ2は、例えばまず、書き込み対象のファイルの書き込みが完了しているか否かを判別し、完了していないと判別した場合は、書き込み対象のファイルに含まれるデータのうちフラッシュメモリ11にまだ書き込まれていない1ページ分のデータをステップS313で供給することと決定し、また、このデータを格納するページの論理アドレス(書込先の論理アドレス)をステップS306で供給することと決定する。
一方、書き込み対象のファイルの書き込みが完了していると判別した場合は、自己が一時記憶しているディレクトリ及びFATをフラッシュメモリに書き込んだか否かを判別する。そして、書き込みを終えていないと判別した場合は、自己が一時記憶するディレクトリ及びFATを構成するデータ1ページ分をステップS313で供給することと決定し、また、ディレクトリ及びFATを格納するページの論理アドレス(書込先の論理アドレス)をステップS306で供給することと決定する。
また、ディレクトリ及びFATの書き込みも完了していると判別した場合は、書き込みの完了を通知する所定のデータをステップS306で供給することと決定する。
【0105】
ステップS306で、コンピュータ2は、ステップS305で決定した結果に従い、データを格納する対象のページの論理アドレス又は書き込み完了の通知を供給する。また、論理アドレスを供給する場合は、更に、フラッシュメモリ11への1ページ分のデータの書き込みを指示する命令も供給する。
【0106】
なお、コンピュータ2は、書き込み対象のファイルに含まれるデータをステップS313で供給すると決定した場合、例えば、図9に示すディレクトリ及びFAT更新の処理を行うことにより、ステップS306でCPU121に供給する論理アドレスの決定と、ディレクトリ及びFATの更新を行う。
【0107】
すなわち、コンピュータ2はまず、自己が一時記憶しているディレクトリ及びFATを解析して、データが書き込まれていないページの論理アドレス(つまり、ファイル名に対応付けられていない論理アドレス)を、書き込むデータを格納するために必要な数だけ、書き込み対象のページに割り当てる論理アドレスとして特定する(図9、ステップS401)。
【0108】
ただし、書き込む対象のファイルのファイル名がディレクトリに含まれるとステップS303で判別した場合、ステップS401でコンピュータ2は、このファイル名に対応付けられている論理アドレス(つまり、ステップS304で一時記憶した論理アドレス)を、データを書き込む対象のページの論理アドレスとして優先的に特定するようにしてもよい。
【0109】
次に、コンピュータ2は、ステップS401で特定した各論理アドレスの並び順を決定する(ステップS402)。この並び順は、これらの論理アドレスを割り当てられた各ページの並び順を表すものであり、また、これらのページに書き込まれたデータの並び順を表すものでもある。
【0110】
コンピュータ2がステップS401〜S402の処理を行った場合、ステップS306でコンピュータ2は、ステップS401で特定した論理アドレスでCPU121に供給していないもののうちで、ステップS402で決めた並び順の先頭にあたる論理アドレスを、CPU121に供給すればよい。
【0111】
次に、コンピュータ2は、自ら一時記憶しているディレクトリ及びFATに、ステップS401で特定した論理アドレスを、図3に示す上述のデータ構造をとるようにして格納する(ステップS403)。なお、ディレクトリ及びFATにより表される論理アドレスの前後関係は、ステップS401で特定した並び順通りになるようにする。ステップS403の処理により、フラッシュメモリ11に新たに書き込むべきディレクトリ及びFATが作成される。
【0112】
一方、CPU121は、ステップS306でコンピュータより書込先の論理アドレス又は書き込み完了の通知などのデータを供給されると、これらのデータのうちに、書き込み完了の通知が含まれているか否かを判別する(図8、ステップS307)。そして、含まれていると判別すると処理をステップS319に移し、供給されていないと判別すると、ステップS308以降の処理を行う。
【0113】
ステップS308でCPU121は、RAM123にアクセスして、ステップS306でコンピュータ2より供給された論理アドレスが示すページの物理アドレスを、BPTより検索する。
【0114】
次に、CPU121は、ステップS308で物理アドレスが索出されたか否かを判別し(ステップS309)、索出されなかったと判別すると処理をステップS311に進める。
【0115】
一方、CPU121は、物理アドレスが索出されたとステップS309で判別すると、フラッシュメモリ11にアクセスし、索出されたこの物理アドレスを割り当てられているページの冗長部に旧データフラグを上書きし(ステップS310)、処理をステップS311に進める。また、ステップS310でCPU121はRAM123にアクセスして、ステップS308で特定された物理アドレスを、物理アドレスが対応付けられていないことを表す値(例えば上述の値“7FFFFh”)へと更新する。つまり、このページへの論理アドレスの割り当てを解除する。
【0116】
次にCPU121はRAM123にアクセスし、書き込みポインタが現在指し示している物理アドレスを、コンピュータ2より供給された書込先の論理アドレスに対応付けた形で、BPTに格納する(ステップS311)。そしてCPU121は、フラッシュメモリ11に書き込むべき1ページ分のデータがコンピュータ2から供給されるのを待機する(ステップS312)。
【0117】
フラッシュメモリ11に書き込むデータがコンピュータ2から供給されると(ステップS313)、CPU121はフラッシュメモリ11にアクセスし、書き込みポインタが現在指し示しているページに、コンピュータ2から供給された1ページ分のデータを書き込む(ステップS314)。また、ステップS314でCPU121は、このページの冗長部に、ステップS306でコンピュータ2から供給された論理アドレスを書き込む。
【0118】
次に、CPU121はRAM123にアクセスし、ステップS314で新たにデータを書き込まれたページが、ブロックの末尾のページであるか否かを、例えば書き込みポインタの現在の値に基づいて判別する(ステップS315)。(具体的には、例えば、書き込みポインタの現在の値の下位6ビットの値が“3Fh”であるか否かを判別すればよい。)そして、末尾のページではなかったと判別すると、処理をステップS318に移す。
【0119】
一方、新たにデータを書き込まれたページが末尾のページであったとステップS315で判別すると、CPU121は、RAM123が記憶するBSIの内容を、このブロックが空きブロックでないことを表すように更新する(ステップS316)。
【0120】
次に、CPU121は、BSIの内容に基づいて現在の空きブロックの数を数え、空きブロックの数が所定量(例えば、2個)以下か否かを判別する(ステップS317)。そして、所定量より大きいと判別すると、処理をステップS318に移す。
【0121】
一方、空きブロックの数が所定量以下であると判別すると、CPU121は、図10に示す空きブロック確保の処理を開始する。
空きブロック確保の処理を開始すると、CPU121は、データを消去して空きブロックにする対象のブロックを1個以上特定する(図10、ステップS501)。そして、特定したブロック内の各ページのうち、旧データフラグが冗長部に格納されていないページに格納されているデータ(退避対象のデータ)を、冗長部に格納されているデータも含めて読み出し、RAM123に記憶させる(ステップS502)。
【0122】
なお、ステップS501でCPU121がフラッシュイレースする対象のブロックを決定する基準は任意であり、例えばCPU121は、フラッシュイレースされて空きブロックになった最新のブロック以降のブロック(つまり、このブロックより大きな物理ブロックアドレスを与えられているブロック)のうち、物理ブロックアドレスがもっとも小さい非空きブロック(空きブロックでないブロック)を、フラッシュイレースする対象として決定すればよい。ただし、該当する非空きブロックが1個もない場合は、フラッシュメモリ11のすべての非空きブロックのうちもっとも物理ブロックアドレスが小さいものを、フラッシュイレースする対象とする。
【0123】
フラッシュイレースする対象のブロックをこのように決定することにより、フラッシュイレースされる対象は、実質的にサイクリックに順位付けされた物理ブロックアドレスの順に、サイクリックに指定される。そして、フラッシュイレースする対象のブロックをこのように決定すれば、ステップS501の処理が行われるたびに、一番古い書き込みがある非空きブロックがフラッシュイレースする対象として特定される。
【0124】
次に、CPU121は、ステップS501で特定したブロックをフラッシュイレースして空きブロックにし、空きブロックとなったこのブロックの各ページに空きブロックコードを書き込む(ステップS503)。(ただし、フラッシュメモリ11がNAND型のフラッシュメモリより構成されている場合であって、空きブロックコードが値“1”のビットのみからなっている場合は、特に空きブロックコードを書き込む動作は不要である。)
また、CPU121はRAM123にアクセスして、BSIの内容を、このブロックが空きブロックであることを表すように更新する(ステップS504)。
【0125】
次に、CPU121は、書き込みポインタをインクリメントする(ステップS505)。具体的には、CPU121は、書き込みポインタが現在指し示しているページ以降のページで、論理アドレスが書き込まれていないページのうち先頭のものを特定する。そして、特定したページの物理アドレスを指し示すように、RAM123が記憶する書き込みポインタの値を更新する。なお、書き込みポインタが現在指し示しているページがブロックの末尾のページである場合、ステップS505でCPU121は、BSIを検索することにより新たな空きブロックを1個特定し、特定した空きブロックの先頭ページを特定し、特定した当該先頭ページの物理アドレスを指し示すように、RAM123が記憶する書き込みポインタの値を更新すればよい。
【0126】
次に、CPU121は、退避対象のデータを書き戻す(ステップS506)。すなわち、ステップS502でRAM123に記憶させた退避対象のデータのうち、まだフラッシュメモリ11に書き戻されていないものを1ページ分、書き込みポインタが現在指し示しているページに書き込む。なお、CPU121は、退避対象のデータのうちフラッシュメモリ11に書き戻した部分をRAM123の記憶領域から消去してもよい。
【0127】
次に、CPU121は、退避対象のデータがすべて書き戻されたか否かを判別し(ステップS507)、書き戻されていないものがあると判別すると、処理をステップS505に戻す。
【0128】
一方、すべて書き戻されたとステップS507で判別すると、CPU121は空きブロック確保の処理を終了し、ステップS505の処理と同様にして書き込みポインタをインクリメントし(ステップS318)、次の書込先の論理アドレス又は書き込み完了の通知がコンピュータ2から供給されるのを待機する。なお、ステップS501でフラッシュイレースする対象のブロックを複数個決定し、個々のブロック毎にステップS502〜S507の処理を繰り返して行うようにしてもよい。
【0129】
CPU121が次の書込先の論理アドレス又は書き込み完了の通知を待機する状態に入ると、コンピュータ2は処理をステップS305に戻す。そして、CPU121は、ステップS306で次の書込先の論理アドレス又は書き込み完了の通知がコンピュータ2から供給されると、処理をステップS307に戻す。
【0130】
一方、CPU121は、書き込み完了の通知を供給されてステップS319に処理を移すと、ステップS505と同様の処理を行うことにより、RAM123に格納されている書き込みポインタの現在の値をインクリメントした結果を求め、一時記憶する。なお、書き込みポインタ自体はインクリメントしない。
【0131】
次に、CPU121は、書き込みポインタが現に指し示す物理アドレスを、書き込みポインタ初期値を格納するページに与えられる論理アドレス(ポインタ初期値用の論理アドレス)に対応付けた形で、BPTに格納する(ステップS320)。
【0132】
次に、CPU121は、ステップS319で求めた値を、書き込みポインタが現に指し示すページのデータ領域に、書き込みポインタ初期値として書き込む(ステップS321)。また、ステップS321では、このページの冗長部に、ポインタ初期値用の論理アドレスを書き込む。
ステップS321の処理が終わると、この記憶システムはデータ書き込みの処理を終了する。
【0133】
以上説明した処理により、コンピュータ2から供給されたデータがフラッシュメモリ11に格納される。また、BSIの内容が、データの書き込みの結果新たに生じた空きブロック及び消滅した空きブロックを示すよう変更される。一方、BPTの内容も変更され、新たに空きブロックとなったブロック内で旧データフラグがないページに割り当てられていた論理アドレスが、そのページの内容を転記されたページに新たに割り当てられる。
【0134】
この記憶システムでは、ユーザデータの書き込みはページ単位で行われるので、ユーザデータを書き込む毎に新たな空きブロックを探索して書き込むという操作が不要になる。従って、この記憶システムは、ユーザデータの書き換え時に、ブロックに対して効率の悪いフラッシュイレースを行わずに済み、フラッシュメモリ11の劣化を起こしにくい。
【0135】
また、この記憶システムは、空きブロックの数が十分にあるうちはブロックのフラッシュイレースを行わないので、無用のフラッシュイレースが避けられる。この点も、フラッシュメモリ11の劣化防止に寄与する。
【0136】
また、各ブロックは、書き込まれているデータが古い順にフラッシュイレースの対象となっていくから、ブロックがフラッシュイレースされる頻度が均等になる。従って、特定のメモリブロックが集中的に劣化することによりフラッシュメモリ11全体の寿命が短くなる、ということが防止される。
【0137】
また、データを書き込むページは書き込みポインタにより物理アドレス順に指定されるので、特定のブロックに書き込みが集中することが避けられ、従って、書き込みが集中したブロックにフラッシュイレースの機会が集中することが避けられる。この点も、フラッシュメモリ11の劣化防止に寄与する。
【0138】
なお、この記憶システムの構成は、上述のものに限られない。
例えば、フラッシュメモリ11の記憶領域のブロックの数、1ブロック当たりのページの数、各ページの記憶容量、データ領域及び冗長部の記憶容量は、いずれも任意である。また、フラッシュメモリ11は、EEPROMから構成されるものである必要はなく、コンピュータにより読み書き可能な任意の記憶装置であってよい。
また、ディレクトリ及びFATが格納されるページの論理アドレスは上述の値である必要はなく、また、ディレクトリ及びFATが格納されるページの個数も任意である。
【0139】
また、RAM123は、例えばFeRAM(Ferroelectric RAM:強誘電性RAM)からなる不揮発性メモリより構成されていてもよい。この場合、この記憶システムは、既にRAM123がBSI及びBPTを記憶している場合には、初期処理を省略してもよい。すなわち、起動するたびにBPTやBSIの作成を逐一行わなくてもよい。
【0140】
また、CPU121は、必ずしもPCMCIAスロットを介してコンピュータ2に接続されるものでなくてもよく、IEEE1394インターフェースやUSB(Universal Serial Bus)あるいはその他の任意のインターフェースを介して接続されていてもよい。また、CPU121は必ずしもコンピュータ2に有線接続される必要はなく、例えばBluetooth等の規格に準拠したインターフェースを介してコンピュータ2に無線接続されるものであってもよい。
【0141】
また、CPU121は、必ずしも旧データフラグをフラッシュメモリ11に書き込む処理を行わなくてもよい。
この場合、CPU121は、ステップS502で退避対象のデータを特定するため、旧データフラグを参照する代わりに、ステップS501で特定したブロック内の各々のページについて、このページの物理アドレスと、このページの冗長部に格納されている論理アドレスにBPTにより対応付けられている物理アドレスとが一致するか否かを判別してもよい。そして、二つの物理アドレスが一致するページに格納されているデータを退避対象のデータとして特定すればよい。
【0142】
また、BPTは、物理アドレスの全桁を格納している必要はなく、例えば、物理アドレスのうち、上位の所定桁数だけを格納するようにしてもよいし、あるいは下位の所定桁数だけを、仮物理アドレスとして格納するようにしてもよい。
BPTが物理アドレスの全桁に代えてこのような仮物理アドレスを格納するようにすれば、物理アドレス全桁を格納する場合に比べて、BPTのデータ量は小さくなる。従って、BPTを格納するRAM123の記憶容量も小さくて済み、この記憶システムを小型に構成できるようになる。
【0143】
仮物理アドレスが、物理アドレスのうち上位の所定桁数だけからなる場合、CPU121は、ステップS208やS308では、データの読み書きの対象となるファイルがあるページを特定するために、BPTを参照して、まず、このページの論理アドレスに対応付けられている仮物理アドレス(物理アドレスの上位の桁)を特定する。次に、CPU121はフラッシュメモリ11にアクセスして、物理アドレスの上位の桁が特定した仮物理アドレスに一致していて旧データフラグが格納されていないページのうち、冗長部に当該論理アドレスが格納されているページを特定する。特定されたページが、データの読み書きの対象となるファイルがあるページである。
【0144】
また、仮物理アドレスが、物理アドレスのうち上位の所定桁数だけからなる場合、旧データフラグを利用することなくデータの読み書きの対象となるファイルがあるページを特定する手法も考えられる。
具体的には、例えばCPU121は、BPTを参照してこのページの仮物理アドレス(物理アドレスの上位の桁)を特定した後、フラッシュメモリ11にアクセスして、物理アドレスの上位の桁が特定した仮物理アドレスに一致していて冗長部に当該論理アドレスが格納されているページのうち、物理アドレスがもっとも大きいものを特定する。特定されたページが、データの読み出し又は書き込みの対象となるページである。
書き込みポインタは、データがページに書き込まれる毎にインクリメントされるので、仮物理アドレスに一致していて冗長部に当該論理アドレスが格納されているページのうち物理アドレスがもっとも大きいページは、当該論理アドレスを現時点で割り当てられているページであるということができる。
【0145】
一方、仮物理アドレスが、物理アドレスのうち下位の所定桁数だけからなる場合は、例えば、フラッシュメモリ11のページは複数のゾーンのいずれかへと分類されているものとし、物理アドレスのうちこの下位の所定桁数を除いた上位の桁は、ページが属すゾーンを示すものとする。なお、個々のゾーンの記憶容量の大きさはブロック1個分より大きくても小さくても、ブロック1個分と等しくてもよい。また、ゾーンがブロックに一致していてもよい。
【0146】
そして、ページが複数のゾーンのいずれかへと分類されている場合、各々の論理アドレスはいずれか1つのゾーンに属するページに割り当てられるものとする。従って、ページに与えられた論理アドレスに基づいて、このページが属するゾーンを特定することができる。
【0147】
ページが複数のゾーンのいずれかへと分類されている場合、CPU121は、データの読み書きの対象となるファイルがあるページを特定するため、BPTを参照して、このページの論理アドレスに対応付けられている仮物理アドレス(物理アドレスの下位の桁)を特定し、一方、この論理アドレスに基づいて、このページが属するゾーンも特定する。次に、CPU121は、特定したゾーン及び仮物理アドレスに基づいてこのページの物理アドレスを特定し、特定した物理アドレスが示すページにアクセスする。
【0148】
また、この記憶システムは、BPTをフラッシュメモリ11が記憶するようにしてもよい。この場合、CPU121は、RAM123に、BPTを構成するデータが格納されているページ(以下、BPT格納ページと呼ぶ)の位置を示すBPTページリストを記憶させるようにしてもよい。
【0149】
BPTページリストは、具体的には、例えば、BPT格納ページの論理アドレス(以下、BPTページポインタと呼ぶ)と、当該BPT格納ページの物理アドレスを、互いに対応付けて格納するテーブルからなる。一方、CPU123は、BPTの一部をBPT格納ページに格納する際、たとえばこのBPT格納ページの冗長部に、このBPT格納ページに割り当てられたBPTページポインタを格納するものとする。
【0150】
フラッシュメモリ11がBPTを記憶している場合、CPU121は、図11に示すように、初期処理において、BPTを作成する動作に代えて、BPTページリストを作成する動作を行う。
すなわち、CPU121は、上述のステップS105の処理に代えて、フラッシュメモリ11から読み出したBPTページポインタと、このBPTページポインタを読み出したページ(BPT格納ページ)の物理アドレスとを、互いに対応付けてRAM123に記憶させる動作を行う(図11、ステップS105B)。この動作により、BPTページリストが作成される。
【0151】
なお、この記憶システムは、RAM123が不揮発性メモリより構成されている場合であって既にRAM123がBPTページリストを記憶している場合は、ステップS105Bの処理を省略してもよい。
【0152】
また、RAM123がBPTページリストを記憶している場合、CPU121は、データ読み出しの処理においてBPTを参照するため、ステップS206の処理を行う代わりに、図12に示すステップS206Bの処理を行う。すなわち、RAM123からBPTページリストを読み出し、このBPTページリストに基づいて、BPT格納テーブルの物理アドレスを特定し、特定した物理アドレスが示すページにアクセスして、BPTの内容を読み出し、読み出したBPTを用いて物理アドレスの特定を行う。
【0153】
また、フラッシュメモリ11がBPTを記憶している場合、CPU121は、データ書き込みの処理等においてBPTの内容を更新する場合は、上述のステップS311の処理に代えて、図13に示すステップS601〜S603の処理を行う。
【0154】
すなわち、まずCPU121は、ステップS205〜S214の処理と同様の処理を行うことによりフラッシュメモリ11からBPTを読み出し、RAM123に一時記憶させる(図13、ステップS601)。
【0155】
ただし、ステップS601でCPU121は、ユーザデータを読み出すべきページの論理アドレスをコンピュータ2から取得してBPTを検索して物理アドレスを得る代わりに、BPTページリストに格納されているBPTページポインタ(すなわちBPT格納ページの物理アドレス)をRAM123から読み出すものとする。また、コンピュータ2がステップS214の処理を行う代わりに、BPTをなすデータをまだ読み出されていないBPT格納ページが残っているか否かを、CPU121が判別するものとする。
【0156】
次に、CPU121は、上述のステップS311の処理と実質的に同一の処理を行うことにより、RAM123に一時記憶されたBPTの内容を更新する(ステップS602)。
【0157】
次に、CPU121は、書き換えが終わったBPTを、上述したステップS314〜S318の処理に従って、1ページ分ずつ書き込む(ステップS603)。ただし、BPTの一部である1ページ分のデータを書き込まれて新たにBPT格納ページとなったページの物理アドレスは、BPTに登録する代わりにBPTページリストに登録する。
【0158】
すなわち、ステップS603でCPU121は、書き込みポインタが現在指し示している物理アドレスを、新たに書き込んだBPTの一部が更新される前に割り当てられていたBPTページポインタに対応付けた形で、BPTページリストに格納する。また、このBPTページポインタに従前対応付けられていた物理アドレスは、BPTページリストから削除する。
【0159】
なお、BPTを構成するデータが、上述したゾーンのうちいずれか所定のゾーンにのみ格納される場合、BPTページリストには、このデータを格納するBPT格納ページの物理アドレスに代えて、このBPT格納ページの当該ゾーン内での位置を示す上述の仮物理アドレスを格納するようにしてもよい。
BPTページリストが、BPT格納ページの物理アドレスの全桁に代えて仮物理アドレスを格納するようにすれば、物理アドレス全桁を格納する場合に比べて、BPTページリストのデータ量は小さくなる。従ってRAM123の記憶容量も小さくて済み、この記憶システムを小型に構成できるようになる。
【0160】
また、BPT格納ページに対応付けられるBPTページポインタの値は、このBPT格納ページに格納されているデータが、BPTのうち、どの範囲の論理アドレスを示す部分かを指定するものであってもよい。
この場合、CPU121は、ステップS601では、BPTのうち、読み書きの対象となるファイルの内容を含むページの論理アドレスを含む部分をBPTページリストの内容に基づいて特定し、特定した部分のみをフラッシュメモリ11から読み出してRAM123に一時記憶させるようにしてもよい。そして、一時記憶された当該部分をBPTとして扱うことにより、後述のステップS602〜S603の処理を行うようにすればよい。このような処理を行うものとすれば、BPTを参照するたびにフラッシュメモリ11からBPTの全体を逐一読み出す、という操作を要しないので、BPTの参照に要する時間が短くなる。
【0161】
また、この記憶システムは、BSIをフラッシュメモリ11が記憶するようにしてもよい。この場合、CPU121は、RAM123に、BSIを構成するデータが格納されているページ(以下、BSI格納ページと呼ぶ)の位置を示すBSIページポインタテーブルを記憶させるようにしてもよい。
【0162】
BSIページポインタテーブルは、具体的には、例えば、BSI格納ページの論理アドレス(以下、BSIページポインタと呼ぶ)と、当該BSI格納ページの物理アドレスを、互いに対応付けて格納するテーブルからなる。一方、CPU123は、BSIの一部をBSI格納ページに格納する際、たとえばこのBSI格納ページの冗長部に、このBSI格納ページに割り当てられたBSIページポインタを格納するものとする。
【0163】
フラッシュメモリ11がBSIを記憶している場合、CPU121は、図14に示すように、初期処理において、BSIを作成する動作に代えて、BSIページポインタテーブルを作成する動作を行う。
すなわち、CPU121は、上述のステップS104の処理に代えて、フラッシュメモリ11から読み出したBSIページポインタと、このBSIページポインタを読み出したページ(BSI格納ページ)の物理アドレスとを、互いに対応付けてRAM123に記憶させる動作を行う(図14、ステップS104B)。この動作により、BSIページポインタテーブルが作成される。
【0164】
なお、この記憶システムは、RAM123が不揮発性メモリより構成されている場合であって既にRAM123がBSIページポインタテーブルを記憶している場合は、ステップS104Bの処理を省略してもよい。
【0165】
また、フラッシュメモリ11がBSIを記憶している場合、CPU121は、データ書き込みの処理等においてBSIの内容を更新する場合は、上述のステップS316やS504の処理に代えて、図15に示すステップS701〜S703の処理を行う。
【0166】
すなわち、まずCPU121は、ステップS205〜S214の処理と同様の処理を行うことによりフラッシュメモリ11からBSIを読み出し、RAM123に一時記憶させる(図15、ステップS701)。
【0167】
ただし、ステップS701でCPU121は、ユーザデータを読み出すべきページの論理アドレスをコンピュータ2から取得してBSIを検索して物理アドレスを得る代わりに、BSIページポインタテーブルに格納されているBSIページポインタをRAM123から読み出すものとする。また、コンピュータ2がステップS214の処理を行う代わりに、BSIをなすデータをまだ読み出されていないBSI格納ページが残っているか否かを、CPU121が判別するものとする。
【0168】
次に、CPU121は、上述のステップS316(又はS504)の処理と実質的に同一の処理を行うことにより、RAM123に一時記憶されたBSIの内容を更新する(ステップS702)。
【0169】
次に、CPU121は、書き換えが終わったBSIを、上述したステップS314〜S318の処理に従って、1ページ分ずつ書き込む(ステップS703)。ただし、BSIの一部である1ページ分のデータを書き込まれて新たにBSI格納ページとなったページの物理アドレスはBPTに登録する代わりにBSIページポインタテーブルに格納し、また、このBSIページポインタに従前対応付けられていた物理アドレスは、BSIページポインタテーブルから削除する。
【0170】
なお、BSIを構成するデータが、上述したゾーンのうちいずれか所定のゾーンにのみ格納される場合、BSIページポインタテーブルには、このデータを格納するBSI格納ページの物理アドレスに代えて、このBSI格納ページの当該ゾーン内での位置を示す仮物理アドレスを格納するようにしてもよい。
BSIページポインタテーブルが、BSI格納ページの物理アドレスの全桁に代えて仮物理アドレスを格納するようにすれば、物理アドレス全桁を格納する場合に比べて、BSIページポインタテーブルのデータ量は小さくなる。従ってRAM123の記憶容量も小さくて済み、この記憶システムを小型に構成できるようになる。
【0171】
また、BSI格納ページに対応付けられるBSIページポインタの値は、このBSI格納ページに格納されているデータが、BSIのうち、どの範囲の論理アドレスを示す部分かを指定するものであってもよい。この場合、CPU121は、ステップS701では、BSIのうち、読み書きの対象となるファイルの内容を含むページの論理アドレスを含む部分をBSIページポインタテーブルの内容に基づいて特定し、特定した部分のみをフラッシュメモリ11から読み出してRAM123に一時記憶させるようにしてもよい。そして、一時記憶された当該部分をBSIとして扱うことにより、後述のステップS702〜S703の処理を行うようにすればよい。このような処理を行うものとすれば、BSIを参照するたびにフラッシュメモリ11からBSIの全体を逐一読み出す、という操作を要しないので、BSIの参照に要する時間が短くなる。
【0172】
また、組み込みメモリユニット1とコンピュータ2とは互いに固定的に接続されていてもよく、図16に示すように、メモリユニット1及びコンピュータ2が同一の筐体に組み込まれていてもよい。
【0173】
以上、この発明の実施の形態を説明したが、この発明の記憶システムは、専用のシステムによらず、通常のコンピュータシステムを用いて実現可能である。例えば、フラッシュメモリ11を装着するスロットを備えるパーソナルコンピュータに上述の動作を実行するためのプログラムを格納した媒体(フロッピー(登録商標)ディスク、CD−ROM等)から該プログラムをインストールすることにより、上述の処理を実行する記憶システムを構成することができる。
【0174】
また、例えば、通信回線のBBSに該プログラムをアップロードし、これらを通信回線を介して配信してもよく、また、該プログラムを表す信号により搬送波を変調し、得られた変調波を伝送し、この変調波を受信した装置が変調波を復調して該プログラムを復元するようにしてもよい。
そして、該プログラムを起動し、OSの制御下に、他のアプリケーションプログラムと同様に実行することにより、上述の処理を実行することができる。
【0175】
なお、OSが処理の一部を分担する場合、あるいは、OSが本願発明の1つの構成要素の一部を構成するような場合には、記録媒体には、その部分を除いたプログラムを格納してもよい。この場合も、この発明では、その記録媒体には、コンピュータが実行する各機能又はステップを実行するためのプログラムが格納されているものとする。
【0176】
【発明の効果】
以上説明したように、この発明によれば、劣化が起きにくい記憶装置や、記憶装置の劣化を起こしにくいメモリ管理方法が実現される。
【図面の簡単な説明】
【図1】本発明の実施の形態にかかる記憶システムの構成を示すブロック図である。
【図2】フラッシュメモリの記憶領域の論理的構造を模式的に示す図である。
【図3】ディレクトリ及びFATのデータ構造を模式的に示す図である。
【図4】BSIのデータ構造を模式的に示す図である。
【図5】BPTのデータ構造を模式的に示す図である。
【図6】初期処理を示すフローチャートである。
【図7】データ読み出しの処理を示すフローチャートである。
【図8】データ書き込みの処理を示すフローチャートである。
【図9】ディレクトリ及びFAT更新の処理を示すフローチャートである。
【図10】空きブロック確保の処理を示すフローチャートである。
【図11】フラッシュメモリがBPTを記憶する場合の初期処理を示すフローチャートである。
【図12】フラッシュメモリがBPTを記憶する場合のデータ読み出しの処理を示すフローチャートである。
【図13】フラッシュメモリがBPTを記憶する場合のデータ書き込みの処理の変形部分を示すフローチャートである。
【図14】フラッシュメモリがBSIを記憶する場合の初期処理を示すフローチャートである。
【図15】フラッシュメモリがBSIを記憶する場合のデータ書き込みの処理の変形部分を示すフローチャートである。
【図16】図1の記憶システムの変形例の構成を示すブロック図である。
【符号の説明】
1     メモリユニット
11    フラッシュメモリ
12    コントローラ
121   CPU
122   ROM
123   RAM
2     コンピュータ
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a storage device, a memory management method and a program, and more particularly to a block erasure type storage device, a memory management method and a program for managing a storage area of the block erasure type storage device.
[0002]
[Prior art]
An EEPROM (Electrically Erasable / Programmable Read Only Memory) flash memory is used as a recording medium that can be accessed (read, write, and erase data) by a computer or the like.
In the flash memory, data is erased in units of a predetermined storage capacity (generally called “blocks”).
[0003]
Of the flash memories, in particular, of the NAND type, it is difficult to sufficiently prevent the occurrence of a defective block in which data cannot be normally stored in a manufacturing stage. For this reason, conventionally, a continuous logical address different from the physical address allocated to each block is dynamically allocated to a normal block, and an address conversion table showing a correspondence relationship with the logical address is created, so that the address becomes invalid. The complexity of the external access procedure due to the continuity is avoided (for example, see Patent Document 1).
[0004]
[Patent Document 1]
WO98 / 30239 pamphlet
[0005]
Physical addresses are assigned in units of blocks. When a page is specified from a logical address, the page address indicating the order of the page in the block is used in addition to the physical address associated with the logical address. Has been identified. (Note that if data is stored in order from the first sector in the same block, continuously supplied data (for example, data constituting one file) will be stored consecutively in the same block. Therefore, when rewriting the data, it is necessary to take care that the order of the page storing the data to be rewritten is maintained in the block.
[0006]
Specifically, data that is not to be rewritten is transcribed from a transfer source block that stores data to be rewritten to a vacant block to which data is to be transcribed so that the data order is maintained. In other words, the data on the n-th page of the block of the transfer source is transferred to the n-th page of the transfer destination, where n is the order of the page. The data to be rewritten is rewritten so that the data after rewriting maintains the order of the data before rewriting. In other words, the data obtained by rewriting the data on the m-th page of the transfer source block is transferred to the m-th page of the transfer destination, where m is the order of the page. Then, an operation of flash erasing (that is, erasing the stored contents) the block of the transfer source is performed.
[0007]
[Problems to be solved by the invention]
However, when such an operation is performed, when a file whose data amount is extremely small compared with the storage capacity of one block is rewritten, pages storing data irrelevant to this file and data are not stored. A block containing a large number of empty pages is flash erased.
[0008]
The NAND flash memory is characterized in that a large-capacity configuration can be realized at low cost, but it deteriorates due to repeated flash erase, and data cannot be read or written normally. Therefore, when the above operation is performed, inefficient flash erase is frequently performed for rewriting a small amount of data, and the deterioration of the flash memory is accelerated.
[0009]
In particular, when an OS (Operating System) manages the storage contents of a flash memory in the same manner as that for managing the storage contents of a hard disk device or a flexible disk, each data managed by the OS and these data are stored. A FAT (File Allocation Table) or the like indicating the correspondence with the logical address is written in the flash memory and frequently updated. Since the data amount of the FAT is usually much smaller than the storage capacity of one block, inefficient flash erase is frequently performed with rewriting of the FAT.
[0010]
The present invention has been made in view of the above circumstances, and has as its object to provide a storage device that is unlikely to cause deterioration and a memory management method that does not easily cause deterioration of the storage device.
[0011]
[Means for Solving the Problems]
In order to achieve the above object, a storage device according to a first aspect of the present invention includes:
Storage means including a plurality of memory blocks for storing user data, to which physical addresses have been assigned;
A table storage means for storing an address conversion table representing a correspondence between a physical address of a page constituting the memory block and a logical address of the page;
Write page point means for specifying a free page capable of storing user data from among the pages and storing a write pointer indicating a physical address of the specified free page;
When the data to be written and the logical address are supplied to itself, the data to be written is written to the empty page specified by the write pointer, and the association between the physical address of the empty page and the logical address is made. Writing means for updating the address conversion table to represent
It is characterized by the following.
[0012]
According to such a storage device, since the writing of the user data is performed in page units, it is not necessary to search for and write a new free block (a block in which the user data is not stored) every time the user data is written. become. Therefore, even when writing of user data involves erasing of old data (specifically, when rewriting of user data), inefficient flash erasing of the memory block is not performed, and deterioration of the storage device occurs. Hateful.
[0013]
The writing means is, for example,
An erasure target designating means for designating a memory block from which data is to be erased among memory blocks storing user data;
Whether the user data stored in the memory block specified by the erasure target specifying means is valid is determined for each page constituting the specified memory block, and the user data determined to be valid is stored in another memory. Erasing means for erasing data stored in the specified memory block after transferring to the block;
, User data may be written with erasure of old data.
[0014]
The writing unit includes an empty block number determination unit that determines whether the number of memory blocks that do not store user data has reached a number that does not satisfy a predetermined condition,
In this case, when it is determined that the number of memory blocks that do not store user data has become less than the predetermined condition, the erasure target designation unit deletes data from the memory blocks that store user data. If a memory block to be erased is specified, data is not erased while the number of empty blocks is sufficient, so that unnecessary flash erase can be avoided.
[0015]
The writing means may determine that the user data stored in the page to which the logical address is assigned when the data and the logical address to be written are supplied to the self is invalid user data. Means for adding an invalid flag indicating
The erasure target designation means erases the memory block storing the oldest user data among the memory blocks storing the user data and including the page to which the invalid flag is added. If it is specified as a memory block to be erased, the frequency of flash erase of each memory block becomes uniform. Therefore, it is possible to prevent the lifetime of the entire storage device from being shortened due to the intensive deterioration of a specific memory block.
The erasing means may, for example, exclude user data stored in the page to which the invalid flag has been added from being transferred to the other memory block.
[0016]
The physical address includes a block address indicating a block to which a page indicated by the physical address belongs, and the block addresses may be ranked cyclically.
In this case, the erasure target designating means, among the memory blocks storing the user data, a memory block to which the first block address is given after the block from which the data was last erased is set as the data to be erased. If it is specified as a memory block, the memory blocks are flash-erased in the order of the block addresses, and the frequency of flash erasure of each memory block becomes uniform.
[0017]
The writing means may determine that the user data stored in the page to which the logical address is assigned when the data and the logical address to be written are supplied to the self is invalid user data. A means for additionally writing the invalid flag shown may be provided.
In this case, if the erasing means excludes the user data stored in the page to which the invalid flag has been additionally written from the object to be transferred to the other memory block, the erasing means determines whether or not the memory block is flash erased. Thus, the invalid user data is deleted from the storage area of the storage device.
[0018]
The writing means may include means for writing a logical address supplied thereto to a page to which the data to be written has been written.
In this case, the erasing unit determines whether or not the logical address stored in the page matches the logical address associated with the physical address of the page based on the address conversion table. If it is determined that the user data stored in the page is excluded from the target to be transcribed to the another memory block, invalid user data is stored in the storage device when the memory block is flash erased. It is erased from the area.
[0019]
Physical addresses may be ranked cyclically.
In this case, if the write page point means specifies the leading empty page among the empty pages to which the physical address of the page in which the user data is written and the physical address of the page after writing the data, Are performed in the order of the physical addresses, so that writing is prevented from being concentrated on a specific memory block, and therefore, flash erase opportunities are prevented from being concentrated on the memory block on which writing is concentrated.
[0020]
For example, when the logical address of the page to be read is supplied to itself, the storage device specifies a physical address associated with the logical address based on the address conversion table, and indicates the specified physical address. A reading unit for reading user data from a page and outputting it to the outside may be provided.
[0021]
Also, the storage device, for example, when the logical address of the page to be read is supplied to itself, identifies the page given the logical address based on the address conversion table, and sets the user data from the identified page. May be provided with a reading means for reading out and outputting to the outside.
[0022]
If the address conversion table represents the correspondence between a predetermined upper digit of the physical address of the page and the logical address of the page, the information amount of the physical address can be small, and the address conversion table is stored. This saves storage space for storage and reduces the overall size of the storage device.
In this case, the writing unit may include, for example, a unit that writes a logical address supplied thereto to a page in which the data to be written is written,
For example, when the logical address of the page to be read is supplied to itself, the reading unit specifies, based on the address conversion table, the value of the upper digit of the physical address associated with the logical address, Among the pages whose upper digits of the physical address match the specified value, any page may be used as long as it reads user data from the page in which the logical address of the page to be read is written and outputs the user data to the outside.
[0023]
The writing means may determine that the user data stored in the page to which the logical address is assigned when the data and the logical address to be written are supplied to the self is invalid user data. A means for additionally writing the invalid flag shown may be provided.
In this case, for example, the logical address of the page to be read is written among the pages whose upper digits of the physical address match the specified value, and the invalid flag is added thereto. What is necessary is just to read user data from a page that is not present and output it to the outside.
[0024]
Physical addresses may be ranked cyclically.
in this case,
The write page point means may identify a leading free page among free pages to which a physical address of a page to which user data is written is assigned a physical address subsequent to the physical address of the page.
The reading means reads the user data from the lowest-ranked page of the pages in which the high-order digit of the physical address matches the specified value and in which the logical address of the page to be read is written, and externally reads the user data. It may be output.
[0025]
The address conversion table indicates the correspondence between predetermined lower-order digits of the physical address of the page and the logical address of the page, and the range of values of the physical address that can be associated with the logical address is for each logical address. In this case, since the amount of information of the physical address is small, the storage area for storing the address conversion table is saved, and the size of the entire storage device is reduced.
In this case, for example, when the logical address of the page to be read is supplied to itself, based on the address conversion table, the reading unit may change the value of the lower digit of the physical address associated with the logical address based on the address conversion table. Specified and reads out user data from the page given the physical address within the range that can be associated with the logical address among the pages where the lower digit of the physical address matches the specified value and outputs it to the outside Should be fine.
[0026]
The table storage means may be constituted by a nonvolatile memory for storing the address conversion table. With such a configuration, the storage device does not need to store the address translation table every time the storage device is started.
[0027]
The table storage means may include the page storing the address conversion table. Even with such a configuration, the storage device does not need to store the address translation table every time the storage device is started.
In this case, the writing unit reads, for example, at least a part of the address conversion table from the page, and compares the read part with the physical address of the free page indicated by the write pointer and the logical address. It suffices to provide a conversion table updating means for updating to indicate the association and writing the updated portion to another free page.
[0028]
The translation table updating unit may include a unit that stores an address translation table storage position list that indicates a physical address of a page that stores data constituting the address translation table.
In this case, the conversion table updating means includes, for example,
At least a part of the address conversion table is read from the page given the physical address indicated by the stored address conversion table storage position list, and the read part is replaced with the physical address of the free page indicated by the write pointer. Means for updating to indicate the association with the logical address, and writing the updated part to another free page;
Means for updating the stored address conversion table storage location list so as to indicate the physical addresses of the other free pages, so that the address conversion table can be referred to.
[0029]
If the range of the value of the upper digit of the physical address of the page storing the data constituting the address conversion table is predetermined, the amount of information in the address conversion table storage position list can be small, A storage area for storing the conversion table storage position list is saved, and the entire storage device is also reduced in size.
In this case, the conversion table updating means includes, for example,
Means for storing an address conversion table storage position list representing lower predetermined digits of a physical address of a page storing data constituting the address conversion table;
Of the pages in which the lower digit of the physical address is specified by the stored address conversion table storage position list, at least a part of the address conversion table is read from a page whose upper digit is in the range, and the read portion is read. Means for updating the physical address of a free page pointed to by the write pointer to indicate the association with the logical address, and writing the updated portion to another free page;
Means for updating the stored address conversion table storage location list so as to indicate the physical addresses of the other free pages, so that the address conversion table can be referred to.
[0030]
The conversion table updating means specifies a page that stores a portion indicating a correspondence between a logical address supplied to itself and the physical address from among the pages that store the address conversion table, and stores the specified page. Only the portion to be read is read, and the read portion is updated so as to represent the association between the physical address of the free page indicated by the write pointer and the logical address, and the updated portion is replaced with another free page. It may be written.
With such a configuration, since the operation of reading the entire address translation table one by one every time it is necessary to refer to the address translation table is not performed, the time spent accessing the address translation table is not performed. Be shortened.
[0031]
The storage device may further include a non-volatile memory that stores a free block table including information for identifying a memory block in which the user data is not stored. With such a configuration, the storage device does not need to rebuild the free block table every time it starts up.
In this case, the writing means includes, for example,
As a result of writing the data to be written supplied to itself to a free page, it is determined whether or not there is no free page from the memory block including the free page. Means for updating the empty block table to indicate that user data is stored;
Means for updating the empty block table so as to indicate that the memory block whose data to be erased is erased by the erasing means does not store the user data, by referring to the empty block table. Good.
[0032]
Some of the pages may constitute a free block table storage unit that stores a free block table including information for identifying a memory block in which no user data is stored. Even with such a configuration, the storage device does not need to rebuild the free block table every time it starts up.
In this case, the writing means includes, for example,
As a result of writing the data to be written supplied to itself to a free page, it is determined whether or not there is no free page from the memory block including the free page. Reading at least a part of the block table, updating the empty block table so as to indicate that the memory block including the empty page stores the user data, and updating the updated empty block table with the empty block. Means for storing in the table storage means;
At least a part of the free block table is read from the free block table storage means, and the free block table is stored in the free block table so as to indicate that the memory block erased by the erase means does not store the user data. Means for updating the empty block table in the empty block table storage means, and referring to the empty block table.
[0033]
The writing unit may include a unit that stores a free block table pointer that indicates a physical address of a page that stores data forming the free block table.
In this case, the writing unit may refer to the free block table by reading at least a part of the free block table from the page given the physical address indicated by the stored free block table pointer, for example. .
[0034]
If the range of the value of the upper digit of the physical address of the page storing the data constituting the free block table is predetermined, the amount of information of the free block table pointer can be small. A storage area for storing the pointer is saved, and the entire storage device is also reduced in size.
In this case, the writing unit includes, for example, a unit that stores a free block table pointer that represents a predetermined lower order digit of a physical address of a page that stores data forming the free block table. By reading at least a part of the free block table from a page in which the high-order digit is in the range where the lower-order digit of the physical address is specified by the table pointer, the free-block table is referred to. Just do it.
[0035]
The writing unit specifies a page storing a portion to be updated in the free block table from among the pages storing the free block table, and reads only a portion stored in the specified page. Is also good.
With such a configuration, the operation of reading the entire free block table one by one every time it is necessary to refer to the free block table is not performed. Be shortened.
[0036]
The memory management method according to the second aspect of the present invention includes:
A memory management method for managing a plurality of memory blocks for storing user data to which physical addresses are assigned,
A table storage step of storing an address conversion table representing a correspondence between a physical address of a page constituting the memory block and a logical address of the page;
A write page point step of specifying a free page in which user data can be stored from among the pages, and storing a write pointer indicating a physical address of the specified free page;
When data to be written and a logical address are supplied, the data to be written is written to a free page specified by the write pointer, and the association between the physical address of the free page and the logical address is represented. Writing the address translation table.
It is characterized by the following.
[0037]
According to such a memory management method, since the writing of the user data is performed in page units, an operation of searching for and writing a new empty block (a block in which no user data is stored) every time the user data is written is performed. It becomes unnecessary. Therefore, even when writing of user data involves erasing of old data (specifically, when rewriting of user data), inefficient flash erasing of the memory block can be prevented from being performed, and the device having the memory block can be used. Deterioration hardly occurs.
[0038]
The writing step includes:
An erasure target specifying step of specifying a memory block from which data is to be erased among the memory blocks storing the user data;
Whether the user data stored in the memory block specified in the erasure target specifying step is valid or not is determined for each page constituting the specified memory block, and the user data determined to be valid is stored in another memory. Erasing the data stored in the specified memory block after transferring to the block;
, The user data may be written with erasure of old data.
[0039]
The writing step includes an empty block number determination step of determining whether the number of memory blocks that do not store user data has fallen below a predetermined condition. If it is determined that the number of unstored memory blocks does not satisfy the predetermined condition, a memory block from which data is to be erased is designated from among the memory blocks storing user data. Since the data is not erased while the number of free blocks is sufficient, unnecessary flash erase can be avoided.
[0040]
The program according to the third aspect of the present invention includes:
A computer connected to storage means including a plurality of memory blocks for storing user data, which is assigned a physical address,
A table storage means for storing an address conversion table representing a correspondence between a physical address of a page constituting the memory block and a logical address of the page;
Write page point means for specifying a free page capable of storing user data from among the pages and storing a write pointer indicating a physical address of the specified free page;
When the data to be written and the logical address are supplied to itself, the data to be written is written to the empty page specified by the write pointer, and the association between the physical address of the empty page and the logical address is made. Writing means for updating the address translation table to represent
It is characterized in that it is intended to function as
[0041]
According to a computer that executes such a program, since writing of user data is performed in page units, a new empty block (a block that does not store user data) is searched and written every time user data is written. No operation is required. Therefore, even when writing of user data involves erasing of old data (specifically, when rewriting of user data), inefficient flash erasing of the memory block is not performed, and deterioration of the storage device occurs. Hateful.
[0042]
The writing means is, for example,
An erasure target designating means for designating a memory block from which data is to be erased among memory blocks storing user data;
Whether the user data stored in the memory block specified by the erasure target specifying means is valid is determined for each page constituting the specified memory block, and the user data determined to be valid is stored in another memory. Erasing means for erasing data stored in the specified memory block after transferring to the block;
, User data may be written with erasure of old data.
[0043]
The writing unit includes an empty block number determination unit that determines whether the number of memory blocks that do not store user data has fallen below a predetermined condition. If it is determined that the number of unstored memory blocks does not satisfy the predetermined condition, a memory block from which data is to be erased is designated from among the memory blocks storing user data. Since data is not erased while the number of free blocks is sufficient, unnecessary flash erase can be avoided.
[0044]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings, taking a storage system including a flash memory as an example.
[0045]
FIG. 1 is a block diagram illustrating a physical configuration of a storage system according to an embodiment of the present invention.
As shown, the storage system includes a memory unit 1 and a computer 2. The memory unit 1 is detachably mounted on the computer 2 via a slot provided in the computer 2.
The slot provided in the computer 2 is, for example, a PCMCIA slot for relaying a PCMCIA bus.
[0046]
The memory unit 1 includes a flash memory 11 and a controller 12.
[0047]
The flash memory 11 includes a storage device such as an EEPROM (Electrically Erasable / Programmable Read Only Memory). The flash memory 11 responds to an access made by the controller 12, stores the data supplied from the computer 2, supplies the stored data to the computer 2, and erases the stored data.
[0048]
The storage area of the flash memory 11 is composed of, for example, 524288 pages as shown in FIG. 2, and each page has a storage capacity of 528 bytes. Addresses from 0 to 527 are continuously given to the memory cells included in each page.
[0049]
As shown, each page is composed of a data area occupying an area of 512 bytes from the head and a redundant part occupying the last 16 bytes.
The data area stores user data (data supplied and written from the computer 2 and data to be supplied to the computer 2).
The redundant section stores an ECC (error correction code) for confirming that the contents of the user data stored in the data area belonging to the same page as the redundant section are not destroyed, and a bad block flag. .
[0050]
The bad block flag indicates that the block (described later) to which the page storing the bad block flag belongs is a block (non-defective block) in which data can be normally stored, or a block that is not a non-defective block, that is, a bad block. It is determined that the flash memory 11 is a block (initial defective block) determined to be defective before shipment by the manufacturer or the like, or is a defective block and data cannot be normally stored during use of the flash memory 11. This is data indicating whether the block is a block (later defective block).
[0051]
It is assumed that the bad block flag representing a good block can be updated so as to represent a late bad block by overwriting a value indicating the late bad block.
The NAND type flash memory can overwrite a memory cell storing a value “1” with a value “0”. (The value "1" cannot be overwritten on the memory cell storing the value "0", and the block including the memory cell needs to be flash erased (described later) once.)
Therefore, for example, when the flash memory 11 is configured by a NAND flash memory and the bad block flag is configured by 1 byte (8 bits) of data, the value of the 8-bit data is When the number of bits representing “0” is 1 or less, the block is a non-defective block. When the number of bits is 2 or more and 6 or less, it indicates a late defective block. Assuming that the block is a bad block, the bad block flag representing a non-defective block can be updated to represent a late bad block by overwriting the value indicating the late bad block. The operation of flash erasing the block to be stored becomes unnecessary.
[0052]
When the user data stored in the data area is invalid data (for example, when the updated data is stored in another data area of the flash memory 11), the user data is stored in the same page as the data area. An old data flag indicating that this data is invalid data is stored in the redundant portion to which the data belongs by a process described later.
[0053]
Each page forms one block in units of 64 pages from the top. Each block has a storage capacity of 32 kilobytes, and the entire storage area is composed of 8,192 blocks, and physical block addresses from 0 to 8191 are continuously given from the top. Each page belonging to each block is continuously assigned a page address from 0 to 63.
[0054]
Further, the value of the logical address given to the page is stored in the redundant portion of each page. The logical address is a unit recognized by the controller 12 as a data read / write unit when the flash memory 11 is read / written by an operation described later.
[0055]
The logical address of a page includes, for example, an upper digit (logical block address) indicating the block to which the page belongs, and a lower digit (page address) indicating the position of the page in the block. The total number of logical addresses is a predetermined amount smaller than the total number of pages physically provided in the flash memory 11, for example, 512,000.
[0056]
When the flash memory 11 is instructed by the controller 12 of the memory unit 1 to erase data of a specific block, the flash memory erases the storage contents of all the memory cells included in the block (specifically, for example, When the flash memory 11 is a NAND flash memory, the storage value of each memory cell is "1".
[0057]
In the data area of the flash memory 11, a directory, a FAT (File Allocation Table), and a write pointer initial value are stored, and are updated by processing described later.
[0058]
A page in which the directory, the FAT, and the write pointer initial value are stored is assigned a logical address that meets a predetermined condition. Specifically, for example, the top 4096 addresses (that is, addresses from 00000h to 00FFFh) are assigned as logical addresses.
[0059]
FIG. 3 is a diagram showing a mutual relationship between a directory, a FAT, and a logical block address. As illustrated, the logical address of the page in which the directory and the FAT are stored is indicated by a directory pointer stored in the CPU 121 (or stored in the RAM 123 by the CPU 121), for example.
[0060]
The directory stores a file name of a file stored in the flash memory 11 (that is, a set of data specified by the computer 2 as a target to be collectively handled) and a logical address at which a head of the file is stored. It is a table shown.
[0061]
The FAT is a table showing the arrangement of files in the storage area of the flash memory 11, and when the file does not fit in one page, as shown in FIG. Each is shown. An end code (EC) is added to the logical address of the page storing the last part of the file as shown in FIG. 3 to indicate that the page address represents the last part.
[0062]
The write pointer initial value indicates the latest value of a write pointer described later, which is a variable indicating a page to which the user data is to be written by the CPU 121. Specifies the page to which the user data is to be written.
[0063]
As shown in FIG. 1, the controller 12 includes a CPU (Central Processing Unit) 121, a ROM (Read Only Memory) 122, and a RAM (Random Access Memory) 123. The RAM 123 is composed of, for example, an SRAM (Static RAM).
[0064]
The CPU 121 is connected to the ROM 122, the RAM 123, and the flash memory 11, and is detachably connected to the computer 2 via a PCMCIA slot provided in the computer 2.
[0065]
The CPU 121 performs processing to be described later according to processing of a program stored in the ROM 122 in advance by a manufacturer or the like of the controller 12.
Then, when acquiring the command supplied from the computer 2 constituting the access device, the CPU 121 executes the command. The instructions executed by the CPU 121 include instructions for accessing the flash memory 11.
[0066]
The storage area of the RAM 123 is used as a work area of the CPU 121. This storage area includes an evacuation memory area, and further includes a BSI (Block Search Index) and a BPT (Block Pointer Table) and a write pointer.
[0067]
The save memory area is a storage area for temporarily storing data stored in a block including a page to be written in a data write process described later.
[0068]
The BSI stores information that specifies which of the blocks included in the storage area of the flash memory 11 is a free block (that is, a block in which flash erase is performed and user data is not stored). The BSI is created and updated in accordance with the processing of the controller 12 described later.
[0069]
FIG. 4 shows an example of the structure of the BSI when the total number of blocks in the flash memory 11 is 8,192. As shown in the figure, the BSI is made up of 1 kilobyte of data, and is associated one by one in order from the first bit to the 8192th block from the first bit, and the associated block is an empty block. When there is a certain block, "1" is stored.
[0070]
The BPT stores, for each page, information indicating the correspondence between the logical address of the page and the physical address. The BPT is created or updated in accordance with a process described below by the CPU 121.
[0071]
Specifically, the BPT has, for example, a data structure shown in FIG.
That is, the BPT occupies a predetermined logical position in the storage area of the RAM 123, for example, and has a storage area for storing a physical address associated with each logical address. Then, assuming that the total number of logical addresses is 512000, for example, as shown in the figure, if a storage area of a total of 1216000 bytes is provided in which the address assigned every 19 bits from the beginning is 01000h to 7DFFFh. Good.
[0072]
Assuming that the BPT has the data structure shown in FIG. 5, each address assigned to a storage area forming the BPT is equal to the sum of a logical address and a predetermined offset value. (FIG. 5 illustrates a case where the offset value is “1000h”.)
The content stored in the 19-bit storage area to which each address is assigned indicates a physical address (a set of a physical block address and a page address) of a page associated with the logical address indicated by the address. .
[0073]
Specifically, as shown in FIG. 5, for example, it is assumed that the value “0A10Fh” (binary “0001010000100001111”) is stored in the storage area to which the address 1001h is assigned, and the offset value is 1000h. In this case, a page having a physical address of 0A10Fh (a physical block address is “0284h” and a page address is “0Fh”) is associated with 0001h as a logical address.
[0074]
However, when the content stored in the storage area to which each address is assigned represents a predetermined value (for example, as shown in the figure, a value of a physical address “7FFFFh”), the value is stored. It indicates that the physical address is not associated with the logical address indicated by the address of the storage area in question.
[0075]
The write pointer is a variable (pointer) that specifies a page to which the CPU 121 writes user data, and specifically indicates a physical address of the corresponding page. The value of the write pointer is updated according to the processing described later.
[0076]
The computer 2 includes a personal computer or the like, has a PCMCIA slot, stores program data representing an OS and a driver, and executes the OS after power-on. Then, when it is detected that the memory unit 1 is mounted in the PCMCIA slot, the driver is started according to the processing of the OS.
[0077]
The computer 2 that performs the processing of the driver supplies the above-described instruction to the controller 12 or supplies data to be written to the flash memory 11, and causes the CPU 121 to access the flash memory 11. Then, the CPU 121 reads from the flash memory 11 and supplies the supplied data to the CPU 121 according to the command supplied by the CPU 121.
[0078]
(motion)
Next, the operation of the storage system will be described with reference to FIGS.
FIG. 6 is a flowchart showing the initial processing.
FIG. 7 is a flowchart showing the data reading process.
FIG. 8 is a flowchart showing a data write process.
FIG. 9 is a flowchart showing a directory and FAT update process.
FIG. 10 is a flowchart showing the process of securing an empty block.
[0079]
(Initial processing)
When this storage system is started, the CPU 121 of the controller 12 of the memory unit 1 executes an initial process shown in FIG.
When the initialization process is started, the CPU 121 initializes a portion for storing the BPT and the BSI in the storage area of the RAM 123 (FIG. 6, step S101).
[0080]
In step S101, the CPU 121 specifically stores a predetermined value indicating that the physical address is not associated with each of the 19-bit sections indicated by the above-described addresses in the storage area of the RAM 123 for storing the BPT. (For example, the above-mentioned value “7FFFFh”) is written. In addition, the logical values of the bits for storing the BSI are all “0”.
[0081]
Next, the CPU 121 specifies the block having the smallest physical block address among the blocks in the flash memory 11 from which the data in the redundant section has not been read yet, and determines the redundant section of each page belonging to the specified block. Is read out (step S102).
[0082]
Next, the CPU 121 determines whether or not the block from which the data was read in step S102 is an empty block based on the data read in step S102 (step S103). Specifically, for example, it is determined whether or not the data read in step S102 includes an empty block code of a predetermined format. When determining that the block is not an empty block, the CPU 121 shifts the processing to step S105.
[0083]
On the other hand, if it is determined in step S103 that this block is an empty block, the CPU 121 calculates the position occupied by the bit indicating the state of this block in the storage area of the RAM 123 in the BSI from the physical block address indicating this block. . Then, the logical value of the bit whose position has been calculated is rewritten to "1" (step S104). After finishing the process in step S104, the CPU 121 moves the process to step S106.
[0084]
On the other hand, in step S105, the CPU 121 writes the physical address of each page from which the logical address read from the flash memory 11 has been read into the storage area of the RAM 123. The logical position at which the CPU 121 writes the physical address of the page in step S105 is a portion to which an address corresponding to the logical address read from this page is added. As a result, new information indicating the association between the physical address and the logical address is added to the BPT.
[0085]
Then, when completing the process of step S105 for all the logical addresses read from the same block of the flash memory 11, the CPU 121 shifts the process to step S106.
[0086]
In step S106, the CPU 121 determines whether or not there is a block next to the block from which the data stored in the redundant unit has been read in step S102. Then, if it is determined that there is, the process returns to step S102, and if it is determined that it does not exist, the process proceeds to step S107.
[0087]
In step S107, the CPU 121 accesses the page in which the write pointer initial value is stored, reads the write pointer initial value, stores it in the RAM 123, and ends the initial processing.
Through the above-described initial processing, the BSI and the BPT are created, and the initial value of the write pointer is specified.
[0088]
(Data read processing)
When the initial processing is completed, the CPU 121 of the memory unit 1 receives an instruction to access the flash memory 11 from the computer 2.
When instructing the CPU 121 to read data from the flash memory 11, the computer 2 first reads a directory and a FAT. Therefore, the computer 2 uses a read instruction and a logical address of each page in which the directory and the FAT are stored. , To the CPU 121 (FIG. 7, step S201).
[0089]
The CPU 121 supplied with the instruction to read the data and the logical address searches the BPT using the logical address as a key, finds the physical address of each page in which the directory and the FAT are stored, and searches for the physical address. From each page indicated by the address, data that constitutes a directory or FAT is read and supplied to the computer 2 (step S202). The computer 2 temporarily stores the directory and the FAT supplied from the CPU 121.
[0090]
Next, the computer 2 uses the file name as a key to supply the logical address of the first page in which the content of the file having the file name of the file containing the data to be read is stored. The directory that has been temporarily stored is searched (step S203).
[0091]
Next, the computer 2 searches the FAT supplied from the CPU 121 using the logical address found in step S203 as a key, and if there is a logical address of a page subsequent to the page whose logical address has been found from the directory, all are searched. The search is performed, and the order in which the corresponding pages are continued is specified (step S204).
[0092]
Then, the computer 2 reads out the stored contents of the pages searched out in steps S203 and S204, so that the instruction instructing the reading and the page from which the user data should be read out (that is, the page searched out in steps S203 and S204 are used). The logical address of the first page of the pages from which data has not been read yet) is supplied to the CPU 121 (step S205).
[0093]
When the CPU 121 is supplied with the instruction to read and the logical address in step S205, the CPU 121 accesses the RAM 123, searches the BPT using the logical address supplied from the computer 2 as a key in step S205, and responds to this logical address. It is determined whether or not there is an assigned physical address (step S206).
When determining that there is no corresponding physical address, the CPU 121 supplies a predetermined error message (for example, a predetermined value “FFh”) to the computer 2 (step S207), and ends the data reading process (abnormal termination). I do.
[0094]
On the other hand, when determining that there is a corresponding physical address, the CPU 121 reads data from the page indicated by the physical address (step S208). Then, an ECC is generated based on the data stored in the data area of the read data, and is stored in the data area based on the generated ECC and the ECC of the read data stored in the redundant unit. It is determined whether the read data has been correctly read (step S209).
[0095]
If it is determined in step S209 that the data has been read correctly, the CPU 121 supplies the data stored in the data area to the computer 2 (step S210).
[0096]
When determining that the data has not been read correctly, the CPU 121 determines whether or not the data stored in the data area can be corrected to the correct content based on the ECC or the like stored in the redundant unit. (Step S211). If it is determined that the data can be restored, the data stored in the data area is corrected and supplied to the computer 2 (step S212).
[0097]
If it is determined in step S211 that the data cannot be corrected, the bad block flag stored in the redundant part of the page from which the data that cannot be corrected is read (or the redundant part of any other page in the same block as this page) is deleted. Then, it overwrites and updates the value with the value representing the late defective block, and notifies the computer 2 that the data reading has failed (step S213). Upon receiving this notification, the computer interrupts the data reading process (abnormal termination).
[0098]
On the other hand, when the data to be read is supplied from the CPU 121 in step S210 or S212, the computer 2 determines whether or not there is a page from which the user data should be read (step S214). When it is determined that the corresponding page remains, the process returns to step S205, and when it is determined that there is no remaining page, the process ends.
[0099]
Data is read from the flash memory 11 and supplied to the computer 2 by the processing of steps S201 to S214 described above.
[0100]
(Data write processing)
When writing data to the flash memory 11, the computer 2 first reads the directory and the FAT. Therefore, similarly to step S201, the computer 2 stores a command to instruct the reading and the directory and the FAT. The logical address of each page is supplied to the CPU 121 (FIG. 8, step S301). However, when the directory and the FAT are temporarily stored for data reading or the like, the process of step S301 is omitted, and the process starts from step S303.
[0101]
The CPU 121 supplied with the instruction to read the data and the logical address reads the directory and the FAT by performing substantially the same processing as in step S202 described above, and supplies the directory and the FAT to the computer 2 (step S302). The computer 2 temporarily stores the directory and the FAT supplied from the CPU 121.
[0102]
Next, the computer 2 searches the directory supplied from the CPU 121 using the file name of the file to be written to the flash memory 11 as a key, and determines whether or not the file name is stored in the directory (step S303). If it is determined that the data is not stored, the process proceeds to step S305 described later.
[0103]
On the other hand, when it is determined that the file is stored, the computer 2 searches for the FAT supplied from the CPU 121 using the logical address associated with the file name found by the search in step S303 as a key. The logical address of each page that stores the data indicated by the name is retrieved and temporarily stored (step S304), and the process proceeds to step S305.
[0104]
In step S305, the computer 2 determines data to be supplied to the CPU 121 in steps S306 and S313 described below.
More specifically, in step S305, the computer 2 first determines, for example, whether or not the writing of the file to be written has been completed, and if it determines that the writing has not been completed, the data included in the file to be written It is determined in step S313 that one page of data not yet written in the flash memory 11 is to be supplied, and the logical address (write destination logical address) of the page storing this data is determined in step S306. Decide to supply.
On the other hand, if it is determined that the writing of the file to be written has been completed, it is determined whether or not the directory and the FAT temporarily stored therein have been written to the flash memory. If it is determined that writing has not been completed, it is determined in step S313 that the directory temporarily stored therein and one page of data constituting the FAT are to be supplied in step S313, and the logic of the page storing the directory and the FAT is determined. It is determined that the address (the logical address of the writing destination) is supplied in step S306.
If it is determined that the writing of the directory and the FAT has also been completed, it is determined that predetermined data for notifying the completion of the writing is to be supplied in step S306.
[0105]
In step S306, the computer 2 supplies the logical address of the page to which data is to be stored or a write completion notification according to the result determined in step S305. When a logical address is supplied, a command for writing data of one page to the flash memory 11 is also supplied.
[0106]
If the computer 2 determines in step S313 that the data included in the file to be written is to be supplied, the computer 2 performs a directory and FAT update process illustrated in FIG. 9 to provide the logical address to be supplied to the CPU 121 in step S306. Is determined, and the directory and FAT are updated.
[0107]
That is, the computer 2 first analyzes the directory and the FAT temporarily stored therein, and writes the logical address of the page to which no data is written (that is, the logical address not associated with the file name) into the data to be written. Are specified as logical addresses to be allocated to pages to be written, as many as necessary to store (step S401 in FIG. 9).
[0108]
However, if it is determined in step S303 that the directory contains the file name of the file to be written, in step S401 the computer 2 determines the logical address associated with this file name (that is, the logical address temporarily stored in step S304). Address) may be preferentially specified as the logical address of the page to which data is to be written.
[0109]
Next, the computer 2 determines the arrangement order of each logical address specified in step S401 (step S402). This arrangement order indicates the arrangement order of each page to which these logical addresses are assigned, and also indicates the arrangement order of data written on these pages.
[0110]
When the computer 2 has performed the processing of steps S401 to S402, the computer 2 determines in step S306 that the logical address specified in step S401, which has not been supplied to the CPU 121, is the logical address at the head of the arrangement order determined in step S402. The address may be supplied to the CPU 121.
[0111]
Next, the computer 2 stores the logical address specified in step S401 in the directory and FAT temporarily stored in the computer 2 so as to take the above-described data structure shown in FIG. 3 (step S403). Note that the order of the logical addresses represented by the directory and the FAT is in the same order as specified in step S401. Through the processing in step S403, a directory and a FAT to be newly written in the flash memory 11 are created.
[0112]
On the other hand, when data such as a logical address of a write destination or a notification of write completion is supplied from the computer in step S306, the CPU 121 determines whether or not a write completion notification is included in these data. (Step S307 in FIG. 8). Then, if it is determined that it is included, the process proceeds to step S319. If it is determined that it is not supplied, the process from step S308 is performed.
[0113]
In step S308, the CPU 121 accesses the RAM 123, and searches the BPT for the physical address of the page indicated by the logical address supplied from the computer 2 in step S306.
[0114]
Next, the CPU 121 determines whether or not a physical address has been found in step S308 (step S309). If it is determined that the physical address has not been found, the process proceeds to step S311.
[0115]
On the other hand, when determining in step S309 that the physical address has been found, the CPU 121 accesses the flash memory 11 and overwrites the old data flag on the redundant part of the page to which the found physical address is assigned (step S309). (S310), the process proceeds to step S311. Further, in step S310, the CPU 121 accesses the RAM 123 and updates the physical address specified in step S308 to a value indicating that the physical address is not associated (for example, the above-described value “7FFFFh”). That is, the assignment of the logical address to this page is released.
[0116]
Next, the CPU 121 accesses the RAM 123 and stores the physical address indicated by the write pointer in the BPT in a form associated with the logical address of the write destination supplied from the computer 2 (step S311). Then, the CPU 121 waits for data of one page to be written to the flash memory 11 to be supplied from the computer 2 (step S312).
[0117]
When the data to be written to the flash memory 11 is supplied from the computer 2 (step S313), the CPU 121 accesses the flash memory 11 and replaces the data for one page supplied from the computer 2 with the page currently pointed to by the write pointer. Write (step S314). Further, in step S314, the CPU 121 writes the logical address supplied from the computer 2 in step S306 into the redundant portion of this page.
[0118]
Next, the CPU 121 accesses the RAM 123, and determines whether or not the page to which the data is newly written in step S314 is the last page of the block based on, for example, the current value of the write pointer (step S315). ). (Specifically, for example, it may be determined whether or not the value of the lower 6 bits of the current value of the write pointer is “3Fh”.) If it is determined that the page is not the last page, the process proceeds to step Move to S318.
[0119]
On the other hand, if it is determined in step S315 that the page to which data is newly written is the last page, the CPU 121 updates the contents of the BSI stored in the RAM 123 so as to indicate that this block is not an empty block (step S315). S316).
[0120]
Next, the CPU 121 counts the current number of empty blocks based on the content of the BSI, and determines whether the number of empty blocks is equal to or less than a predetermined amount (for example, two) (step S317). Then, if it is determined that it is larger than the predetermined amount, the process proceeds to step S318.
[0121]
On the other hand, when determining that the number of empty blocks is equal to or less than the predetermined amount, the CPU 121 starts the processing of securing empty blocks shown in FIG.
When the process of securing a free block is started, the CPU 121 specifies one or more blocks to be erased and set as a free block (FIG. 10, step S501). Then, of the pages in the specified block, the data stored in the page in which the old data flag is not stored in the redundant section (data to be saved) is read out including the data stored in the redundant section. Is stored in the RAM 123 (step S502).
[0122]
The criterion for determining the block to be flash-erased by the CPU 121 in step S501 is arbitrary. For example, the CPU 121 determines the block after the latest block that has been flash-erased and becomes an empty block (that is, a physical block larger than this block). A non-empty block (a block that is not a free block) having the smallest physical block address among blocks to which an address is assigned may be determined as a flash erase target. However, if there is no corresponding non-empty block, the one having the smallest physical block address among all non-empty blocks in the flash memory 11 is to be subjected to flash erase.
[0123]
By determining the block to be flash-erased in this way, the flash-erased target is specified cyclically in the order of the physical block addresses that are substantially cyclically ranked. If the block to be flash erased is determined in this way, each time the processing in step S501 is performed, the non-empty block having the oldest write is specified as the flash erase target.
[0124]
Next, the CPU 121 flash erases the block specified in step S501 into an empty block, and writes an empty block code to each page of the empty block (step S503). (However, when the flash memory 11 is formed of a NAND type flash memory and the empty block code is made up of only bits having the value “1”, the operation of writing the empty block code is not particularly necessary. is there.)
Further, the CPU 121 accesses the RAM 123 and updates the contents of the BSI so as to indicate that this block is a free block (step S504).
[0125]
Next, the CPU 121 increments the write pointer (step S505). More specifically, the CPU 121 specifies the first of pages after the page currently pointed to by the write pointer and in which the logical address is not written. Then, the value of the write pointer stored in the RAM 123 is updated so as to indicate the physical address of the specified page. If the page currently pointed to by the write pointer is the last page of the block, in step S505, the CPU 121 identifies one new empty block by searching for a BSI, and identifies the first page of the identified empty block. What is necessary is just to update the value of the write pointer stored in the RAM 123 so as to point to the specified physical address of the specified first page.
[0126]
Next, the CPU 121 writes back the data to be saved (step S506). In other words, of the data to be saved that has been stored in the RAM 123 in step S502, data that has not yet been written back to the flash memory 11 is written to the page currently pointed to by the write pointer for one page. Note that the CPU 121 may erase the portion of the data to be saved that has been written back to the flash memory 11 from the storage area of the RAM 123.
[0127]
Next, the CPU 121 determines whether or not all data to be saved has been written back (step S507). If it is determined that there is any data that has not been written back, the process returns to step S505.
[0128]
On the other hand, if it is determined in step S507 that all the data has been written back, the CPU 121 ends the process of securing the empty block, increments the write pointer in the same manner as the process of step S505 (step S318), and sets the logical address of the next write destination. Alternatively, it waits for a write completion notification to be supplied from the computer 2. In step S501, a plurality of blocks to be flash-erased may be determined, and the processing of steps S502 to S507 may be repeatedly performed for each block.
[0129]
When the CPU 121 enters a state of waiting for a notification of the logical address of the next write destination or a write completion, the computer 2 returns the processing to step S305. Then, when the logical address of the next writing destination or the notification of the writing completion is supplied from the computer 2 in step S306, the CPU 121 returns the processing to step S307.
[0130]
On the other hand, when the CPU 121 receives the write completion notification and shifts the process to step S319, the CPU 121 performs the same process as step S505 to obtain the result of incrementing the current value of the write pointer stored in the RAM 123. , Temporarily memorize. Note that the write pointer itself does not increment.
[0131]
Next, the CPU 121 stores the physical address currently pointed to by the write pointer in the BPT in a form associated with the logical address (logical address for the pointer initial value) given to the page storing the write pointer initial value (step S12). S320).
[0132]
Next, the CPU 121 writes the value obtained in step S319 as a write pointer initial value in the data area of the page currently pointed to by the write pointer (step S321). In step S321, a logical address for a pointer initial value is written in the redundant portion of this page.
When the processing in step S321 ends, the storage system ends the data writing processing.
[0133]
By the above-described processing, the data supplied from the computer 2 is stored in the flash memory 11. Further, the content of the BSI is changed to indicate a newly generated free block and a lost free block as a result of data writing. On the other hand, the content of the BPT is also changed, and the logical address assigned to the page without the old data flag in the newly vacant block is newly assigned to the page to which the content of the page has been transcribed.
[0134]
In this storage system, since the writing of the user data is performed in page units, it is not necessary to search for and write a new free block every time the user data is written. Therefore, the storage system does not need to perform inefficient flash erasing on the block when rewriting the user data, and is less likely to cause deterioration of the flash memory 11.
[0135]
In addition, the storage system does not perform flash erasing of blocks while the number of free blocks is sufficient, so that unnecessary flash erasing can be avoided. This also contributes to prevention of deterioration of the flash memory 11.
[0136]
In addition, since the written data of each block is subject to flash erasing in the order of older data, the frequency of flash erasing of the blocks becomes uniform. Therefore, it is possible to prevent the lifetime of the entire flash memory 11 from being shortened due to the intensive deterioration of a specific memory block.
[0137]
Further, since the page to which data is written is specified by the write pointer in the order of the physical address, it is possible to prevent the write from being concentrated on a specific block, and thus avoid the flash erase opportunity from being concentrated on the block on which the write has been concentrated. . This also contributes to prevention of deterioration of the flash memory 11.
[0138]
The configuration of this storage system is not limited to the above.
For example, the number of blocks in the storage area of the flash memory 11, the number of pages per block, the storage capacity of each page, and the storage capacity of the data area and the redundant section are all arbitrary. The flash memory 11 does not need to be constituted by an EEPROM, but may be any storage device that can be read and written by a computer.
The logical addresses of the pages where the directory and the FAT are stored need not be the above values, and the number of pages where the directory and the FAT are stored is arbitrary.
[0139]
Further, the RAM 123 may be configured by a nonvolatile memory made of, for example, a FeRAM (Ferroelectric RAM: ferroelectric RAM). In this case, the storage system may omit the initial processing when the RAM 123 has already stored the BSI and the BPT. That is, it is not necessary to create the BPT or BSI every time the computer is started.
[0140]
Further, the CPU 121 does not necessarily need to be connected to the computer 2 via the PCMCIA slot, and may be connected via an IEEE1394 interface, a USB (Universal Serial Bus), or any other interface. Further, the CPU 121 does not necessarily need to be connected to the computer 2 by wire, but may be connected to the computer 2 wirelessly via an interface conforming to a standard such as Bluetooth.
[0141]
Further, the CPU 121 does not necessarily need to perform the process of writing the old data flag to the flash memory 11.
In this case, in order to specify the data to be saved in step S502, the CPU 121 refers to the physical address of this page and the physical address of this page for each page in the block specified in step S501 instead of referring to the old data flag. It may be determined whether or not the logical address stored in the redundant unit matches the physical address associated with the BPT. Then, the data stored in the page where the two physical addresses coincide with each other may be specified as the data to be saved.
[0142]
The BPT does not need to store all the digits of the physical address. For example, the BPT may store only the upper predetermined number of digits of the physical address, or may store only the lower predetermined number of digits. , May be stored as a temporary physical address.
If the BPT stores such a temporary physical address instead of all the digits of the physical address, the data amount of the BPT becomes smaller than in the case where all the digits of the physical address are stored. Therefore, the storage capacity of the RAM 123 for storing the BPT can be small, and the storage system can be configured to be small.
[0143]
If the provisional physical address is composed of only a predetermined number of upper digits of the physical address, the CPU 121 refers to the BPT in steps S208 and S308 in order to identify the page on which the file to be read / written is located. First, a temporary physical address (upper digit of the physical address) associated with the logical address of this page is specified. Next, the CPU 121 accesses the flash memory 11 and stores the logical address in the redundant portion of the page in which the upper digit of the physical address matches the specified temporary physical address and the old data flag is not stored. Identify the page that is being viewed. The specified page is a page in which a file from which data is to be read or written exists.
[0144]
When the temporary physical address is composed of only a predetermined number of upper digits of the physical address, a method of specifying a page in which a file from which data is to be read or written without using the old data flag may be considered.
Specifically, for example, the CPU 121 refers to the BPT to specify the temporary physical address (upper digit of the physical address) of this page, and then accesses the flash memory 11 to specify the upper digit of the physical address. The page having the largest physical address is specified among the pages that match the temporary physical address and store the logical address in the redundant section. The specified page is a page from which data is read or written.
Since the write pointer is incremented each time data is written to the page, the page having the largest physical address among the pages that match the temporary physical address and store the logical address in the redundant portion is the logical address. Can be said to be the page currently assigned.
[0145]
On the other hand, when the temporary physical address is composed of only a predetermined number of lower digits of the physical address, for example, it is assumed that the page of the flash memory 11 is classified into one of a plurality of zones, and The upper digits excluding the predetermined lower digits indicate the zone to which the page belongs. The storage capacity of each zone may be larger or smaller than one block, or may be equal to one block. Further, the zone may correspond to the block.
[0146]
When a page is classified into any of a plurality of zones, each logical address is assigned to a page belonging to any one of the zones. Therefore, the zone to which the page belongs can be specified based on the logical address given to the page.
[0147]
When a page is classified into any of a plurality of zones, the CPU 121 refers to the BPT and associates the file with the logical address of the page with reference to the BPT in order to identify the page where the file to be read / written is located. The temporary physical address (lower digit of the physical address) is specified, and the zone to which the page belongs is also specified based on the logical address. Next, the CPU 121 specifies the physical address of this page based on the specified zone and temporary physical address, and accesses the page indicated by the specified physical address.
[0148]
In this storage system, the BPT may be stored in the flash memory 11. In this case, the CPU 121 may cause the RAM 123 to store a BPT page list indicating the position of a page (hereinafter, referred to as a BPT storage page) in which data constituting the BPT is stored.
[0149]
Specifically, the BPT page list includes, for example, a table in which a logical address of a BPT storage page (hereinafter, referred to as a BPT page pointer) and a physical address of the BPT storage page are stored in association with each other. On the other hand, when storing a part of the BPT in the BPT storage page, the CPU 123 stores the BPT page pointer assigned to the BPT storage page, for example, in a redundant portion of the BPT storage page.
[0150]
When the flash memory 11 stores a BPT, the CPU 121 performs an operation of creating a BPT page list in the initial processing instead of an operation of creating a BPT, as shown in FIG.
That is, instead of the processing in step S105 described above, the CPU 121 associates the BPT page pointer read from the flash memory 11 and the physical address of the page (BPT storage page) from which the BPT page pointer was read with the RAM 123 in association with each other. (FIG. 11, step S105B). With this operation, a BPT page list is created.
[0151]
This storage system may omit the process of step S105B when the RAM 123 is configured from a nonvolatile memory and the RAM 123 has already stored the BPT page list.
[0152]
When the RAM 123 stores the BPT page list, the CPU 121 performs the process of step S206B shown in FIG. 12 instead of performing the process of step S206 to refer to the BPT in the data reading process. That is, the BPT page list is read from the RAM 123, the physical address of the BPT storage table is specified based on the BPT page list, the page indicated by the specified physical address is accessed, the contents of the BPT are read, and the read BPT is read. The physical address is specified by using this.
[0153]
When the flash memory 11 stores the BPT and the CPU 121 updates the contents of the BPT in data writing processing or the like, the CPU 121 replaces the processing in step S311 described above with steps S601 to S603 shown in FIG. Is performed.
[0154]
That is, first, the CPU 121 reads the BPT from the flash memory 11 by performing the same processing as the processing of steps S205 to S214, and temporarily stores the BPT in the RAM 123 (FIG. 13, step S601).
[0155]
However, in step S601, the CPU 121 obtains the logical address of the page from which the user data is to be read from the computer 2 and searches for the BPT to obtain the physical address. Instead, the BPT page pointer (that is, the BPT page pointer) stored in the BPT page list is used. The physical address of the storage page) is read from the RAM 123. Further, instead of the computer 2 performing the processing of step S214, the CPU 121 determines whether or not there remains a BPT storage page from which the data forming the BPT has not been read yet.
[0156]
Next, the CPU 121 updates the contents of the BPT temporarily stored in the RAM 123 by performing substantially the same processing as the processing in step S311 described above (step S602).
[0157]
Next, the CPU 121 writes the rewritten BPT for one page at a time in accordance with the processing of steps S314 to S318 described above (step S603). However, the physical address of a page that is a part of the BPT and becomes a new BPT storage page by writing data for one page is registered in the BPT page list instead of being registered in the BPT.
[0158]
That is, in step S603, the CPU 121 associates the physical address currently pointed to by the write pointer with the BPT page pointer assigned before the part of the newly written BPT is updated, and sets the BPT page list in the BPT page list. To be stored. The physical address previously associated with the BPT page pointer is deleted from the BPT page list.
[0159]
When the data constituting the BPT is stored only in any one of the above-mentioned zones, the BPT page list includes the BPT storage page instead of the physical address of the BPT storage page storing this data. The above-mentioned temporary physical address indicating the position of the page in the zone may be stored.
If the BPT page list stores the temporary physical address instead of all the digits of the physical address of the BPT storage page, the data amount of the BPT page list becomes smaller than in the case where all the physical address digits are stored. Therefore, the storage capacity of the RAM 123 can be small, and this storage system can be made compact.
[0160]
Also, the value of the BPT page pointer associated with the BPT storage page may specify the range of the logical address in the BPT where the data stored in the BPT storage page indicates. .
In this case, in step S601, the CPU 121 specifies, based on the contents of the BPT page list, a part including the logical address of the page including the contents of the file to be read and written, and only the specified part in the flash memory. 11 and may be temporarily stored in the RAM 123. Then, by treating the temporarily stored portion as a BPT, the processes of steps S602 to S603 described below may be performed. If such processing is performed, it is not necessary to read out the entire BPT from the flash memory 11 every time the BPT is referred to, so that the time required for referencing the BPT is reduced.
[0161]
In this storage system, the BSI may be stored in the flash memory 11. In this case, the CPU 121 may cause the RAM 123 to store a BSI page pointer table indicating the position of a page in which data constituting the BSI is stored (hereinafter, referred to as a BSI storage page).
[0162]
Specifically, the BSI page pointer table is, for example, a table in which a logical address of a BSI storage page (hereinafter, referred to as a BSI page pointer) and a physical address of the BSI storage page are stored in association with each other. On the other hand, when storing a part of the BSI in the BSI storage page, the CPU 123 stores the BSI page pointer assigned to the BSI storage page in, for example, a redundant portion of the BSI storage page.
[0163]
When the flash memory 11 stores the BSI, the CPU 121 performs an operation of creating a BSI page pointer table instead of an operation of creating a BSI in the initial processing, as shown in FIG.
That is, instead of the processing in step S104 described above, the CPU 121 associates the BSI page pointer read from the flash memory 11 and the physical address of the page (BSI storage page) from which the BSI page pointer was read with the RAM 123 in association with each other. Is performed (FIG. 14, step S104B). With this operation, a BSI page pointer table is created.
[0164]
This storage system may omit the processing in step S104B if the RAM 123 is configured by a nonvolatile memory and the RAM 123 has already stored the BSI page pointer table.
[0165]
When the flash memory 11 stores the BSI, and when updating the contents of the BSI in the data writing processing or the like, the CPU 121 replaces the processing in the above-described steps S316 and S504 with step S701 shown in FIG. To S703.
[0166]
That is, first, the CPU 121 reads the BSI from the flash memory 11 by performing the same processing as the processing of steps S205 to S214, and temporarily stores the BSI in the RAM 123 (FIG. 15, step S701).
[0167]
However, in step S701, the CPU 121 obtains the logical address of the page from which the user data is to be read from the computer 2 and searches for the BSI to obtain the physical address. Instead, the CPU 121 stores the BSI page pointer stored in the BSI page pointer table in the RAM 123. Shall be read from. Instead of the computer 2 performing the processing in step S214, the CPU 121 determines whether or not there remains a BSI storage page from which data forming the BSI has not been read yet.
[0168]
Next, the CPU 121 updates the contents of the BSI temporarily stored in the RAM 123 by performing substantially the same processing as the processing in step S316 (or S504) described above (step S702).
[0169]
Next, the CPU 121 writes the rewritten BSI for each page in accordance with the processing of steps S314 to S318 described above (step S703). However, the physical address of a page that is a part of the BSI and has become a new BSI storage page by writing data for one page is stored in the BSI page pointer table instead of being registered in the BPT. The physical address previously associated with is deleted from the BSI page pointer table.
[0170]
When the data constituting the BSI is stored only in any one of the above-mentioned zones, the BSI page pointer table stores the BSI instead of the physical address of the BSI storage page storing the data. A temporary physical address indicating the position of the storage page in the zone may be stored.
If the BSI page pointer table stores a temporary physical address instead of all the digits of the physical address of the BSI storage page, the data amount of the BSI page pointer table is smaller than when all the physical addresses are stored. Become. Therefore, the storage capacity of the RAM 123 can be small, and this storage system can be made compact.
[0171]
Also, the value of the BSI page pointer associated with the BSI storage page may specify the range of the logical address of the BSI of the data stored in the BSI storage page. . In this case, in step S701, the CPU 121 specifies, based on the contents of the BSI page pointer table, a portion of the BSI including the logical address of the page including the contents of the file to be read and written, and flashes only the specified portion. The data may be read from the memory 11 and temporarily stored in the RAM 123. Then, by treating the temporarily stored portion as the BSI, the processes of steps S702 to S703 described below may be performed. If such processing is performed, it is not necessary to read the entire BSI from the flash memory 11 every time the BSI is referred to, so that the time required for the BSI reference is reduced.
[0172]
Further, the built-in memory unit 1 and the computer 2 may be fixedly connected to each other, or as shown in FIG. 16, the memory unit 1 and the computer 2 may be built in the same housing.
[0173]
The embodiments of the present invention have been described above. However, the storage system of the present invention can be realized using an ordinary computer system instead of a dedicated system. For example, by installing the program from a medium (floppy (registered trademark) disk, CD-ROM, or the like) storing a program for executing the above-described operation in a personal computer having a slot for mounting the flash memory 11, Can be configured.
[0174]
Further, for example, the program may be uploaded to a BBS of a communication line and distributed via the communication line.Also, a carrier wave is modulated by a signal representing the program, and the obtained modulated wave is transmitted. A device that has received the modulated wave may demodulate the modulated wave and restore the program.
Then, by starting the program and executing it under the control of the OS in the same manner as other application programs, the above-described processing can be executed.
[0175]
When the OS shares a part of the processing, or when the OS constitutes a part of one component of the present invention, the program excluding the part is stored in the recording medium. You may. Also in this case, in the present invention, it is assumed that the recording medium stores a program for executing each function or step executed by the computer.
[0176]
【The invention's effect】
As described above, according to the present invention, a storage device that is less likely to deteriorate and a memory management method that is less likely to cause deterioration of the storage device are realized.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration of a storage system according to an embodiment of the present invention.
FIG. 2 is a diagram schematically showing a logical structure of a storage area of the flash memory.
FIG. 3 is a diagram schematically illustrating a data structure of a directory and a FAT.
FIG. 4 is a diagram schematically showing a data structure of a BSI.
FIG. 5 is a diagram schematically illustrating a data structure of a BPT.
FIG. 6 is a flowchart illustrating an initial process.
FIG. 7 is a flowchart showing a data reading process.
FIG. 8 is a flowchart showing a data writing process.
FIG. 9 is a flowchart illustrating a directory and FAT update process.
FIG. 10 is a flowchart illustrating a process of securing an empty block.
FIG. 11 is a flowchart showing an initial process when the flash memory stores a BPT.
FIG. 12 is a flowchart showing a data reading process when the flash memory stores a BPT.
FIG. 13 is a flowchart showing a modified part of the data writing process when the flash memory stores the BPT.
FIG. 14 is a flowchart illustrating initial processing when the flash memory stores BSI.
FIG. 15 is a flowchart showing a modified part of the data writing process when the flash memory stores BSI.
FIG. 16 is a block diagram showing a configuration of a modification of the storage system of FIG. 1;
[Explanation of symbols]
1 memory unit
11 Flash memory
12 Controller
121 CPU
122 ROM
123 RAM
2 Computer

Claims (31)

物理アドレスを割り当てられた、ユーザデータを記憶するための複数のメモリブロックを含む記憶手段と、
前記メモリブロックを構成するページの物理アドレスと、当該ページの論理アドレスとの対応付けを表すアドレス変換テーブルを記憶するテーブル記憶手段と、
前記ページのうちからユーザデータを記憶可能な状態にある空きページを特定して、特定した空きページの物理アドレスを指示する書込ポインタを記憶する書込ページポイント手段と、
書き込み対象のデータ及び論理アドレスが自己に供給されたとき、当該書き込み対象のデータを、前記書込ポインタにより指示された空きページに書き込み、当該空きページの物理アドレスと当該論理アドレスとの対応付けを表すよう前記アドレス変換テーブルを更新する書込手段と、を備える、
ことを特徴とする記憶装置。
Storage means including a plurality of memory blocks for storing user data, to which physical addresses have been assigned;
A table storage means for storing an address conversion table representing a correspondence between a physical address of a page constituting the memory block and a logical address of the page;
Write page point means for specifying a free page capable of storing user data from among the pages and storing a write pointer indicating a physical address of the specified free page;
When the data to be written and the logical address are supplied to itself, the data to be written is written to the empty page specified by the write pointer, and the association between the physical address of the empty page and the logical address is made. Writing means for updating the address conversion table to represent
A storage device characterized by the above-mentioned.
前記書込手段は、
ユーザデータを記憶しているメモリブロックのうちからデータを消去する対象のメモリブロックを指定する消去対象指定手段と、
前記消去対象指定手段により指定されたメモリブロックに記憶されているユーザデータが有効か否かを、当該指定されたメモリブロックを構成するページ毎に判別し、有効と判別したユーザデータを他のメモリブロックに転記してから、当該指定されたメモリブロックが記憶するデータを消去する消去手段と、を備える、
ことを特徴とする請求項1に記載の記憶装置。
The writing means,
An erasure target designating means for designating a memory block from which data is to be erased among memory blocks storing user data;
Whether the user data stored in the memory block specified by the erasure target specifying means is valid or not is determined for each page constituting the specified memory block, and the user data determined to be valid is stored in another memory. Erasing means for erasing data stored in the specified memory block after transferring to the block,
The storage device according to claim 1, wherein:
前記書込手段は、ユーザデータを記憶していないメモリブロックの数が所定条件に満たない数になったか否かを判別する空きブロック数判別手段を備え、
前記消去対象指定手段は、ユーザデータを記憶していないメモリブロックの数が所定条件に満たない数になったと判別されたとき、ユーザデータを記憶しているメモリブロックのうちからデータを消去する対象のメモリブロックを指定する、
ことを特徴とする請求項2に記載の記憶装置。
The writing unit includes an empty block number determination unit that determines whether the number of memory blocks that do not store user data has reached a number that does not satisfy a predetermined condition,
The erasure target designating means, when it is determined that the number of memory blocks that do not store user data has fallen below a predetermined condition, an object to be erased from the memory blocks that store user data. Specify the memory block of
3. The storage device according to claim 2, wherein:
前記書込手段は、書き込み対象のデータ及び論理アドレスが自己に供給された時点で当該論理アドレスが割り当てられていたページに、当該ページに記憶されているユーザデータが無効なユーザデータであることを示す無効フラグを追記する手段を備え、
前記消去対象指定手段は、ユーザデータを記憶しているメモリブロックであっって前記無効フラグを追記されているページを含んでいるもののうち、もっとも古いユーザデータを記憶しているメモリブロックを、データを消去する対象のメモリブロックとして指定する、
ことを特徴とする請求項2又は請求項3に記載の記憶装置。
The writing means may determine that the user data stored in the page to which the logical address is assigned when the data and the logical address to be written are supplied to the self is invalid user data. Means for adding an invalid flag indicating
The erasure target designating means is a memory block storing the oldest user data among the memory blocks storing the user data and including the page to which the invalid flag is added. As a memory block to be erased,
The storage device according to claim 2 or 3, wherein:
前記消去手段は、前記無効フラグを追記されているページが記憶するユーザデータを、前記他のメモリブロックへと転記する対象から除外する、
ことを特徴とする請求項4に記載の記憶装置。
The erasing unit excludes the user data stored in the page to which the invalid flag has been additionally written, from a target to be transcribed to the other memory block.
The storage device according to claim 4, wherein:
物理アドレスは、当該物理アドレスが示すページが属するブロックを示すブロックアドレスを含んでいて、ブロックアドレスはサイクリックに順位付けされており、
前記消去対象指定手段は、ユーザデータを記憶しているメモリブロックのうち、最後にデータを消去されたブロック以降で先頭のブロックアドレスを与えられているものを、データを消去する対象のメモリブロックとして指定する、
ことを特徴とする請求項2又は請求項3に記載の記憶装置。
The physical address includes a block address indicating a block to which a page indicated by the physical address belongs, and the block addresses are cyclically ranked.
The erasure target designating means, among the memory blocks storing the user data, a memory block to which a leading block address is given after the block from which data was last erased is used as a memory block to be erased. specify,
The storage device according to claim 2 or 3, wherein:
前記書込手段は、書き込み対象のデータ及び論理アドレスが自己に供給された時点で当該論理アドレスが割り当てられていたページに、当該ページに記憶されているユーザデータが無効なユーザデータであることを示す無効フラグを追記する手段を備え、
前記消去手段は、前記無効フラグを追記されているページが記憶するユーザデータを、前記他のメモリブロックへと転記する対象から除外する、
ことを特徴とする請求項6に記載の記憶装置。
The writing means may determine that the user data stored in the page to which the logical address is assigned when the data and the logical address to be written are supplied to the self is invalid user data. Means for adding an invalid flag indicating
The erasing unit excludes the user data stored in the page to which the invalid flag has been additionally written, from a target to be transcribed to the other memory block.
7. The storage device according to claim 6, wherein:
前記書込手段は、前記書き込み対象のデータを書き込んだページに、自己に供給された論理アドレスを書き込む手段を備え、
前記消去手段は、ページが記憶している論理アドレスと、前記アドレス変換テーブルにより当該ページの物理アドレスに対応付けられている論理アドレスとが一致するか否かを判別し、一致しないと判別したとき、当該ページが記憶するユーザデータを、前記他のメモリブロックへと転記する対象から除外する、
ことを特徴とする請求項2乃至請求項6のいずれか1項に記載の記憶装置。
The writing means includes means for writing a logical address supplied to the page to which the data to be written is written,
The erasing means determines whether or not the logical address stored in the page matches the logical address associated with the physical address of the page based on the address conversion table, and determines that the logical address does not match. Excluding the user data stored in the page from being transferred to the other memory block;
The storage device according to any one of claims 2 to 6, wherein:
物理アドレスはサイクリックに順位付けされており、
前記書込ページポイント手段は、ユーザデータを書き込まれたページの物理アドレス以降の物理アドレスを与えられている空きページのうちの先頭の空きページを特定する、
ことを特徴とする請求項1乃至請求項8のいずれか1項に記載の記憶装置。
Physical addresses are ranked cyclically,
The write page point means specifies a leading empty page among empty pages to which physical addresses subsequent to the physical address of the page to which the user data has been written are given.
The storage device according to any one of claims 1 to 8, wherein:
読み出し対象のページの論理アドレスが自己に供給されたとき、前記アドレス変換テーブルに基づいて、当該論理アドレスに対応付けられた物理アドレスを特定し、特定した物理アドレスが示すページよりユーザデータを読み出して外部に出力する読出手段を備える、
ことを特徴とする請求項1乃至請求項9のいずれか1項に記載の記憶装置。
When the logical address of the page to be read is supplied to itself, a physical address associated with the logical address is specified based on the address conversion table, and user data is read from the page indicated by the specified physical address. Having a reading means for outputting to the outside,
The storage device according to claim 1, wherein:
読み出し対象のページの論理アドレスが自己に供給されたとき、前記アドレス変換テーブルに基づいて、当該論理アドレスを与えられたページを特定し、特定したページよりユーザデータを読み出して外部に出力する読出手段を備える、
ことを特徴とする請求項1乃至請求項9のいずれか1項に記載の記憶装置。
When a logical address of a page to be read is supplied to itself, a reading means for specifying a page given the logical address based on the address conversion table, reading user data from the specified page, and outputting the user data to the outside Comprising,
The storage device according to claim 1, wherein:
前記アドレス変換テーブルは、ページの物理アドレスの上位の所定桁分と、当該ページの論理アドレスとの対応付けを表すものであり、
前記書込手段は、前記書き込み対象のデータを書き込んだページに、自己に供給された論理アドレスを書き込む手段を備え、
前記読出手段は、読み出し対象のページの論理アドレスが自己に供給されたとき、前記アドレス変換テーブルに基づいて、当該論理アドレスに対応付けられた物理アドレスの上位の桁の値を特定し、物理アドレスの上位の桁が特定した値に一致する各ページのうち、当該読み出し対象のページの論理アドレスが書き込まれているページよりユーザデータを読み出して外部に出力する、
ことを特徴とする請求項11に記載の記憶装置。
The address conversion table represents a correspondence between a predetermined upper digit of a physical address of a page and a logical address of the page,
The writing means includes means for writing a logical address supplied to the page to which the data to be written is written,
When the logical address of the page to be read is supplied to itself, the reading means specifies the value of the upper digit of the physical address associated with the logical address based on the address conversion table, Reads out the user data from the page in which the logical address of the page to be read is written, and outputs the read data to the outside, among the pages whose upper digits match the specified value.
The storage device according to claim 11, wherein:
前記書込手段は、書き込み対象のデータ及び論理アドレスが自己に供給された時点で当該論理アドレスが割り当てられていたページに、当該ページに記憶されているユーザデータが無効なユーザデータであることを示す無効フラグを追記する手段を備え、
前記読出手段は、物理アドレスの上位の桁が特定した値に一致する各ページのうち、当該読み出し対象のページの論理アドレスが書き込まれていて、且つ、前記無効フラグを追記されていないページよりユーザデータを読み出して外部に出力する、
ことを特徴とする請求項12に記載の記憶装置。
The writing means may determine that the user data stored in the page to which the logical address is assigned when the data and the logical address to be written are supplied to the self is invalid user data. Means for adding an invalid flag indicating
The reading unit is configured to read a page from which the logical address of the page to be read is written and out of the pages in which the invalid flag is not added, among the pages in which the upper digit of the physical address matches the specified value. Read data and output to outside,
13. The storage device according to claim 12, wherein:
物理アドレスはサイクリックに順位付けされており、
前記書込ページポイント手段は、ユーザデータを書き込まれたページの物理アドレス以降の物理アドレスを与えられている空きページのうちの先頭の空きページを特定するものであり、
前記読出手段は、物理アドレスの上位の桁が特定した値に一致していて当該読み出し対象のページの論理アドレスが書き込まれているページのうち、もっとも順位の低いページよりユーザデータを読み出して外部に出力する、
ことを特徴とする請求項12に記載の記憶装置。
Physical addresses are ranked cyclically,
The write page point means specifies a leading free page among free pages to which physical addresses subsequent to the physical address of the page to which the user data is written are given,
The reading means reads the user data from the lowest-ranked page among the pages in which the high-order digit of the physical address matches the specified value and the logical address of the page to be read is written, and externally reads the user data. Output,
13. The storage device according to claim 12, wherein:
前記アドレス変換テーブルは、ページの物理アドレスの下位の所定桁分と、当該ページの論理アドレスとの対応付けを表すものであって、論理アドレスに対応付け得る物理アドレスの値の範囲は論理アドレス毎に定められており、
前記読出手段は、読み出し対象のページの論理アドレスが自己に供給されたとき、前記アドレス変換テーブルに基づいて、当該論理アドレスに対応付けられた物理アドレスの下位の桁の値を特定し、物理アドレスの下位の桁が特定した値に一致する各ページのうち、当該論理アドレスに対応付け得る範囲内の物理アドレスを与えられているページよりユーザデータを読み出して外部に出力する、
ことを特徴とする請求項11に記載の記憶装置。
The address conversion table indicates a correspondence between a predetermined lower-order digit of a physical address of a page and a logical address of the page. The range of values of the physical address that can be associated with the logical address is for each logical address. Stipulated in
The reading means, when the logical address of the page to be read is supplied to itself, specifies the value of the lower digit of the physical address associated with the logical address based on the address conversion table, Reads out user data from a page given a physical address within a range that can be associated with the logical address, and outputs the data to the outside, among the pages whose lower digits match the specified value.
The storage device according to claim 11, wherein:
前記テーブル記憶手段は、前記アドレス変換テーブルを記憶する不揮発性メモリより構成されている、
ことを特徴とする請求項1乃至請求項15に記載の記憶装置。
The table storage means includes a nonvolatile memory that stores the address conversion table.
The storage device according to any one of claims 1 to 15, wherein:
前記テーブル記憶手段は、前記アドレス変換テーブルを記憶する前記ページより構成されており、
前記書込手段は、当該ページから前記アドレス変換テーブルの少なくとも一部を読み出して、読み出した部分を、前記書込ポインタにより指示された空きページの物理アドレスと当該論理アドレスとの対応付けを表すよう更新して、更新した当該部分を他の空きページに書き込む変換テーブル更新手段を備える、
ことを特徴とする請求項1乃至請求項15に記載の記憶装置。
The table storage means includes the page that stores the address conversion table,
The writing unit reads at least a part of the address conversion table from the page, and indicates the read part as a correspondence between a physical address of a free page indicated by the write pointer and the logical address. Comprising a conversion table updating means for updating and writing the updated portion to another free page;
The storage device according to any one of claims 1 to 15, wherein:
前記変換テーブル更新手段は、
前記アドレス変換テーブルを構成するデータを記憶するページの物理アドレスを表すアドレス変換テーブル格納位置リストを記憶する手段と、
記憶した当該アドレス変換テーブル格納位置リストが示す物理アドレスを与えられたページから前記アドレス変換テーブルの少なくとも一部を読み出して、読み出した部分を、前記書込ポインタにより指示された空きページの物理アドレスと当該論理アドレスとの対応付けを表すよう更新して、更新した当該部分を他の空きページに書き込む手段と、
記憶した当該アドレス変換テーブル格納位置リストを、前記他の空きページの物理アドレスを表すよう更新する手段と、を備える、
ことを特徴とする請求項17に記載の記憶装置。
The conversion table updating means,
Means for storing an address conversion table storage position list representing physical addresses of pages storing data constituting the address conversion table;
At least a part of the address conversion table is read from the page given the physical address indicated by the stored address conversion table storage position list, and the read part is replaced with the physical address of the free page indicated by the write pointer. Means for updating to indicate the association with the logical address, and writing the updated part to another free page;
Means for updating the stored address conversion table storage location list to represent the physical address of the other free page.
18. The storage device according to claim 17, wherein:
前記アドレス変換テーブルを構成するデータを記憶するページの物理アドレスの上位の桁の値の範囲は予め定められており、
前記変換テーブル更新手段は、
前記アドレス変換テーブルを構成するデータを記憶するページの物理アドレスの下位の所定桁分を表すアドレス変換テーブル格納位置リストを記憶する手段と、
記憶した当該アドレス変換テーブル格納位置リストにより物理アドレスの下位の桁が特定されるページのうち、上位の桁が当該範囲にあるページから前記アドレス変換テーブルの少なくとも一部を読み出して、読み出した部分を、前記書込ポインタにより指示された空きページの物理アドレスと当該論理アドレスとの対応付けを表すよう更新して、更新した当該部分を他の空きページに書き込む手段と、
記憶した当該アドレス変換テーブル格納位置リストを、前記他の空きページの物理アドレスを表すよう更新する手段と、を備える、
ことを特徴とする請求項17に記載の記憶装置。
The range of the value of the upper digit of the physical address of the page storing the data constituting the address conversion table is predetermined,
The conversion table updating means,
Means for storing an address conversion table storage position list representing lower predetermined digits of a physical address of a page storing data constituting the address conversion table;
Of the pages in which the lower digit of the physical address is specified by the stored address conversion table storage position list, at least a part of the address conversion table is read from a page whose upper digit is in the range, and the read portion is read. Means for updating the physical address of a free page pointed to by the write pointer to indicate the association with the logical address, and writing the updated portion to another free page;
Means for updating the stored address conversion table storage location list to represent the physical address of the other free page.
18. The storage device according to claim 17, wherein:
前記変換テーブル更新手段は、前記アドレス変換テーブルを記憶するページのうちから、自己に供給された論理アドレスと前記物理アドレスとの対応付けを表す部分を記憶するページを特定し、特定したページが記憶する部分のみを読み出して、読み出した部分を、前記書込ポインタにより指示された空きページの物理アドレスと当該論理アドレスとの対応付けを表すよう更新して、更新した当該部分を他の空きページに書き込む、
ことを特徴とする請求項17、請求項18又は請求項19に記載の記憶装置。
The conversion table updating means specifies a page that stores a portion representing a correspondence between a logical address supplied to itself and the physical address from pages that store the address conversion table, and stores the specified page. And updates the read portion to indicate the association between the physical address of the free page indicated by the write pointer and the logical address, and transfers the updated portion to another free page. Write,
20. The storage device according to claim 17, wherein the storage device is a storage device.
前記ユーザデータが記憶されていないメモリブロックを識別する情報を含む空きブロックテーブルを記憶する不揮発性メモリを更に備え、
前記書込手段は、
自己に供給された書き込み対象のデータを空きページに書き込む結果、当該空きページを含むメモリブロックから空きページが無くなったか否かを判別し、無くなったと判別したとき、当該空きページを含むメモリブロックが前記ユーザデータを記憶していることを示すように前記空きブロックテーブルを更新する手段と、
記憶するデータを前記消去手段により消去されたメモリブロックが前記ユーザデータを記憶していないことを示すように前記空きブロックテーブルを更新する手段と、を備える、
ことを特徴とする請求項3乃至請求項20のいずれか1項に記載の記憶装置。
A nonvolatile memory storing a free block table including information for identifying a memory block in which the user data is not stored,
The writing means,
As a result of writing the data to be written supplied to itself to a free page, it is determined whether or not there is no free page from the memory block including the free page. Means for updating the empty block table to indicate that user data is stored;
Means for updating the empty block table so as to indicate that the memory block whose data to be stored has been erased by the erasing means does not store the user data.
The storage device according to any one of claims 3 to 20, wherein:
一部の前記ページは、ユーザデータが記憶されていないメモリブロックを識別する情報を含む空きブロックテーブルを記憶する空きブロックテーブル記憶手段を構成しており、
前記書込手段は、
自己に供給された書き込み対象のデータを空きページに書き込む結果、当該空きページを含むメモリブロックから空きページが無くなったか否かを判別し、無くなったと判別したとき、前記空きブロックテーブル記憶手段より前記空きブロックテーブルの少なくとも一部を読み出して、当該空きページを含むメモリブロックが前記ユーザデータを記憶していることを示すように前記空きブロックテーブルを更新して、更新後の空きブロックテーブルを前記空きブロックテーブル記憶手段に記憶させる手段と、
前記空きブロックテーブル記憶手段より前記空きブロックテーブルの少なくとも一部を読み出して、記憶するデータを前記消去手段により消去されたメモリブロックが前記ユーザデータを記憶していないことを示すように前記空きブロックテーブルを更新して、更新後の空きブロックテーブルを前記空きブロックテーブル記憶手段に記憶させる手段と、を備える、
ことを特徴とする請求項3乃至請求項20に記載の記憶装置。
Some of the pages constitute free block table storage means for storing a free block table including information for identifying a memory block in which no user data is stored,
The writing means,
As a result of writing the data to be written supplied to itself to a free page, it is determined whether or not there is no free page from the memory block including the free page. Reading at least a part of the block table, updating the empty block table so as to indicate that the memory block including the empty page stores the user data, and updating the updated empty block table with the empty block. Means for storing in the table storage means;
At least a part of the free block table is read from the free block table storage means, and the free block table is stored in the free block table so as to indicate that the memory block erased by the erase means does not store the user data. Means for updating the empty block table after the update in the empty block table storage means,
The storage device according to any one of claims 3 to 20, wherein:
前記書込手段は、前記空きブロックテーブルを構成するデータを記憶するページの物理アドレスを表す空きブロックテーブルポインタを記憶する手段を備え、記憶した当該空きブロックテーブルポインタが示す物理アドレスを与えられたページから前記空きブロックテーブルの少なくとも一部を読み出すものである、
ことを特徴とする請求項22に記載の記憶装置。
The writing unit includes a unit that stores a free block table pointer that indicates a physical address of a page that stores data that forms the free block table. Reading at least a part of the empty block table from
23. The storage device according to claim 22, wherein:
前記空きブロックテーブルを構成するデータを記憶するページの物理アドレスの上位の桁の値の範囲は予め定められており、
前記書込手段は、前記空きブロックテーブルを構成するデータを記憶するページの物理アドレスの下位の所定桁分を表す空きブロックテーブルポインタを記憶する手段を備え、記憶した当該空きブロックテーブルポインタにより物理アドレスの下位の桁が特定されるページのうち、上位の桁が当該範囲にあるページから前記空きブロックテーブルの少なくとも一部を読み出すものである、
ことを特徴とする請求項22に記載の記憶装置。
The range of the value of the upper digit of the physical address of the page storing the data constituting the free block table is predetermined,
The writing means includes means for storing a free block table pointer indicating a predetermined lower digit of a physical address of a page storing data constituting the free block table, and using the stored free block table pointer to store a physical address. Among the pages whose lower digits are specified, at least a part of the empty block table is read from pages whose higher digits are in the range.
23. The storage device according to claim 22, wherein:
前記書込手段は、前記空きブロックテーブルを記憶するページのうちから、前記空きブロックテーブルのうち更新すべき部分を記憶するページを特定し、特定したページが記憶する部分のみを読み出すものである、
ことを特徴とする請求項22、請求項23又は請求項24に記載の記憶装置。
The writing unit specifies a page that stores a part to be updated in the free block table from among the pages that store the free block table, and reads only a part that the specified page stores.
25. The storage device according to claim 22, wherein the storage device is a storage device.
物理アドレスを割り当てられた、ユーザデータを記憶するための複数のメモリブロックを管理するためのメモリ管理方法であって、
前記メモリブロックを構成するページの物理アドレスと、当該ページの論理アドレスとの対応付けを表すアドレス変換テーブルを記憶するテーブル記憶ステップと、
前記ページのうちからユーザデータを記憶可能な状態にある空きページを特定して、特定した空きページの物理アドレスを指示する書込ポインタを記憶する書込ページポイントステップと、
書き込み対象のデータ及び論理アドレスが供給されたとき、当該書き込み対象のデータを、前記書込ポインタにより指示された空きページに書き込み、当該空きページの物理アドレスと当該論理アドレスとの対応付けを表すよう前記アドレス変換テーブルを更新する書込ステップと、を含む、
ことを特徴とするメモリ管理方法。
A memory management method for managing a plurality of memory blocks for storing user data to which physical addresses are assigned,
A table storage step of storing an address conversion table representing a correspondence between a physical address of a page constituting the memory block and a logical address of the page;
A write page point step of specifying a free page in which user data can be stored from among the pages, and storing a write pointer indicating a physical address of the specified free page;
When data to be written and a logical address are supplied, the data to be written is written to a free page specified by the write pointer, and the association between the physical address of the free page and the logical address is represented. Writing the address translation table.
A memory management method characterized by the above-mentioned.
前記書込ステップは、
ユーザデータを記憶しているメモリブロックのうちからデータを消去する対象のメモリブロックを指定する消去対象指定ステップと、
前記消去対象指定ステップで指定されたメモリブロックに記憶されているユーザデータが有効か否かを、当該指定されたメモリブロックを構成するページ毎に判別し、有効と判別したユーザデータを他のメモリブロックに転記してから、当該指定されたメモリブロックが記憶するデータを消去する消去ステップと、を含む、
ことを特徴とする請求項26に記載のメモリ管理方法。
The writing step includes:
An erasure target specifying step of specifying a memory block from which data is to be erased among the memory blocks storing the user data;
It is determined whether the user data stored in the memory block specified in the erasure target specifying step is valid for each page constituting the specified memory block, and the user data determined to be valid is stored in another memory. Erasing the data stored in the specified memory block after transferring to the block,
27. The memory management method according to claim 26, wherein:
前記書込ステップは、ユーザデータを記憶していないメモリブロックの数が所定条件に満たない数になったか否かを判別する空きブロック数判別ステップを含み、
前記消去対象指定ステップでは、ユーザデータを記憶していないメモリブロックの数が所定条件に満たない数になったと判別されたとき、ユーザデータを記憶しているメモリブロックのうちからデータを消去する対象のメモリブロックを指定する、
ことを特徴とする請求項27に記載のメモリ管理方法。
The writing step includes an empty block number determining step of determining whether the number of memory blocks that do not store user data has become a number that does not satisfy a predetermined condition,
In the erasing target designating step, when it is determined that the number of memory blocks that do not store user data has fallen below a predetermined condition, data to be erased is selected from the memory blocks that store user data. Specify the memory block of
The memory management method according to claim 27, wherein:
物理アドレスを割り当てられた、ユーザデータを記憶するための複数のメモリブロックを含む記憶手段に接続されたコンピュータを、
前記メモリブロックを構成するページの物理アドレスと、当該ページの論理アドレスとの対応付けを表すアドレス変換テーブルを記憶するテーブル記憶手段と、
前記ページのうちからユーザデータを記憶可能な状態にある空きページを特定して、特定した空きページの物理アドレスを指示する書込ポインタを記憶する書込ページポイント手段と、
書き込み対象のデータ及び論理アドレスが自己に供給されたとき、当該書き込み対象のデータを、前記書込ポインタにより指示された空きページに書き込み、当該空きページの物理アドレスと当該論理アドレスとの対応付けを表すよう前記アドレス変換テーブルを更新する書込手段と、
して機能させるためのプログラム。
A computer connected to storage means including a plurality of memory blocks for storing user data, which is assigned a physical address,
A table storage means for storing an address conversion table representing a correspondence between a physical address of a page constituting the memory block and a logical address of the page;
Write page point means for specifying a free page capable of storing user data from among the pages and storing a write pointer indicating a physical address of the specified free page;
When the data to be written and the logical address are supplied to itself, the data to be written is written to the empty page specified by the write pointer, and the association between the physical address of the empty page and the logical address is made. Writing means for updating the address translation table to represent
Program to make it work.
前記書込手段は、
ユーザデータを記憶しているメモリブロックのうちからデータを消去する対象のメモリブロックを指定する消去対象指定手段と、
前記消去対象指定手段により指定されたメモリブロックに記憶されているユーザデータが有効か否かを、当該指定されたメモリブロックを構成するページ毎に判別し、有効と判別したユーザデータを他のメモリブロックに転記してから、当該指定されたメモリブロックが記憶するデータを消去する消去手段と、を備える、
ことを特徴とする請求項29に記載のプログラム。
The writing means,
An erasure target designating means for designating a memory block from which data is to be erased among memory blocks storing user data;
Whether the user data stored in the memory block specified by the erasure target specifying means is valid or not is determined for each page constituting the specified memory block, and the user data determined to be valid is stored in another memory. Erasing means for erasing data stored in the specified memory block after transferring to the block,
30. The program according to claim 29, wherein:
前記書込手段は、ユーザデータを記憶していないメモリブロックの数が所定条件に満たない数になったか否かを判別する空きブロック数判別手段を備え、
前記消去対象指定手段は、ユーザデータを記憶していないメモリブロックの数が所定条件に満たない数になったと判別されたとき、ユーザデータを記憶しているメモリブロックのうちからデータを消去する対象のメモリブロックを指定する、
ことを特徴とする請求項30に記載のプログラム。
The writing unit includes an empty block number determination unit that determines whether the number of memory blocks that do not store user data has reached a number that does not satisfy a predetermined condition,
The erasure target designating means, when it is determined that the number of memory blocks that do not store user data has fallen below a predetermined condition, an object to be erased from the memory blocks that store user data. Specify the memory block of
31. The program according to claim 30, wherein:
JP2003173987A 2002-06-19 2003-06-18 Storage device, memory management method, and program thereof Pending JP2004078902A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003173987A JP2004078902A (en) 2002-06-19 2003-06-18 Storage device, memory management method, and program thereof

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2002178674 2002-06-19
JP2003173987A JP2004078902A (en) 2002-06-19 2003-06-18 Storage device, memory management method, and program thereof

Publications (1)

Publication Number Publication Date
JP2004078902A true JP2004078902A (en) 2004-03-11

Family

ID=32032524

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003173987A Pending JP2004078902A (en) 2002-06-19 2003-06-18 Storage device, memory management method, and program thereof

Country Status (1)

Country Link
JP (1) JP2004078902A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006236304A (en) * 2004-10-27 2006-09-07 Sony Corp Storage device and information processing system
JP2006338371A (en) * 2005-06-02 2006-12-14 Toshiba Corp Memory system
JP2007102460A (en) * 2005-10-04 2007-04-19 Nec Electronics Corp Semiconductor storage device and memory controller
US7529904B2 (en) 2004-03-31 2009-05-05 International Business Machines Corporation Storing location identifier in array and array pointer in data structure for write process management
WO2011068109A1 (en) * 2009-12-03 2011-06-09 株式会社日立製作所 Storage device and memory controller
JP2011238261A (en) * 2004-10-27 2011-11-24 Sony Corp Storage device and information processing system
US8503241B2 (en) 2010-07-30 2013-08-06 Kabushiki Kaisha Toshiba Electronic apparatus and data reading method
CN112130762A (en) * 2020-09-07 2020-12-25 上海威固信息技术股份有限公司 Solid state disk data storage and operation method

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7529904B2 (en) 2004-03-31 2009-05-05 International Business Machines Corporation Storing location identifier in array and array pointer in data structure for write process management
US7818533B2 (en) 2004-03-31 2010-10-19 International Business Machines Corporation Storing location identifier in array and array pointer in data structure for write process management
KR101189259B1 (en) 2004-10-27 2012-10-09 소니 주식회사 Storage device and information processing system
US8904096B2 (en) 2004-10-27 2014-12-02 Sony Corporation Storage device and information processing system
US9317424B2 (en) 2004-10-27 2016-04-19 Sony Corporation Storage device and information processing system
US8554982B2 (en) 2004-10-27 2013-10-08 Sony Corporation Storage device and information processing system
JP2011238261A (en) * 2004-10-27 2011-11-24 Sony Corp Storage device and information processing system
JP2006236304A (en) * 2004-10-27 2006-09-07 Sony Corp Storage device and information processing system
JP2006338371A (en) * 2005-06-02 2006-12-14 Toshiba Corp Memory system
JP2007102460A (en) * 2005-10-04 2007-04-19 Nec Electronics Corp Semiconductor storage device and memory controller
GB2488480A (en) * 2009-12-03 2012-08-29 Hitachi Ltd Storage device and memory controller
WO2011068109A1 (en) * 2009-12-03 2011-06-09 株式会社日立製作所 Storage device and memory controller
JP5480913B2 (en) * 2009-12-03 2014-04-23 株式会社日立製作所 Storage device and memory controller
US8949515B2 (en) 2009-12-03 2015-02-03 Hitachi, Ltd. Storage device and memory controller
GB2488480B (en) * 2009-12-03 2017-07-19 Hitachi Ltd Storage device and memory controller
US8503241B2 (en) 2010-07-30 2013-08-06 Kabushiki Kaisha Toshiba Electronic apparatus and data reading method
CN112130762A (en) * 2020-09-07 2020-12-25 上海威固信息技术股份有限公司 Solid state disk data storage and operation method
CN112130762B (en) * 2020-09-07 2024-01-26 上海威固信息技术股份有限公司 Solid state disk data storage and operation method

Similar Documents

Publication Publication Date Title
KR100847506B1 (en) Storage device, memory management method and program
US20060143365A1 (en) Memory device, memory managing method and program
USRE46404E1 (en) Flash memory management method
JP3977370B2 (en) Flash memory address mapping method, mapping information management method, and flash memory using these methods
JP4132086B2 (en) Moving sectors in blocks in flash memory
US6865658B2 (en) Nonvolatile data management system using data segments and link information
KR100849446B1 (en) Storage device, memory managing apparatus, memory managing method, and computer-readable recording medium
US7242632B2 (en) Memory device, memory managing method and program
JPH08137634A (en) Flash disk card
JP2005242897A (en) Flash disk drive
JP2007133541A (en) Storage device, memory management device, memory management method and program
JP2007280108A (en) Storage medium controller, storage medium control method, and program
JP2004078902A (en) Storage device, memory management method, and program thereof
JP4130808B2 (en) Formatting method
JP3826115B2 (en) Storage device, memory management method, and program
JP3808842B2 (en) Storage device having rewritable nonvolatile memory and control method of nonvolatile memory for storage device
JP2012068765A (en) Memory controller, flash memory system with memory controller, and control method of flash memory
WO2020039927A1 (en) Non-volatile storage device, host device, and data storage system
JP2012037971A (en) Memory controller, nonvolatile memory system provided with memory controller, and method for controlling nonvolatile memory
JP5707695B2 (en) Flash disk device
JPH10312693A (en) Storage device
WO2006093304A1 (en) Storage device, memory block managing method, and program

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20060314

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060328

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20060718