JP2004038237A - Information processor and program therefor - Google Patents
Information processor and program therefor Download PDFInfo
- Publication number
- JP2004038237A JP2004038237A JP2002190244A JP2002190244A JP2004038237A JP 2004038237 A JP2004038237 A JP 2004038237A JP 2002190244 A JP2002190244 A JP 2002190244A JP 2002190244 A JP2002190244 A JP 2002190244A JP 2004038237 A JP2004038237 A JP 2004038237A
- Authority
- JP
- Japan
- Prior art keywords
- data storage
- storage area
- block
- cluster
- information
- 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.)
- Withdrawn
Links
Images
Abstract
Description
【0001】
【発明の属する技術分野】
本発明は、情報処理装置およびプログラムに関し、特にフラッシュメモリのファイル管理方法を改良した情報処理装置およびプログラムに関する。
【0002】
【従来の技術】
フラッシュメモリはEEPROM(Electorically Erasable and Programmable Read Only Memory)の一種であるが、通常のEEPROMが1バイトづつ消去を行うのに対して、ブロック単位または一括に消去できるように構成されているメモリである。データは比較的自由に繰り返し書き替えることができ、バックアップ電源を必要とせず、また構成が簡単なため、単位セル面積がRAMよりも小さいという長所を有している。また、書き込み、消去回数も10万回ぐらいは保証されている。さらに、記憶容量は数Mバイトから512Mバイトぐらいまで幅広いものがある。このため、パソコンなどのBIOS(基本入出力システム)の記憶などに用いられているほか、オンボードメモリとしても広く用いられるようになってきている。
ところで、フラッシュメモリの素子は、メーカおよびその型番によってその仕様が異なっており、殊に記憶容量にともなって一度に転送できるデータの最大単位であるブロックサイズが異なるためにその違いに応じて制御の仕方、処理方法を変えなければならないという問題があった。
【0003】
また、ファイルシステムは、ハードディスクなどの外部記憶装置上でファイルを管理する方式を意味しており、基本ソフトウェアであるOS(Operating System)によって提供され、種々の種類のファイルの編成方法やそれに対するアクセス方法などを示していて、ハードディスク装置などに記憶されたデータを効率的に操作し、管理するための仕組みや体系を実現するものである。
しかし、仕様が異なるフラッシュメモリに共通に適用できる独自のファイルシステムを作成することは手間や作業工数がかかり、結果的に高価なものになってしまう。
【0004】
一方、従来の情報記録装置でハードディスク装置上のファイル管理には、FAT(File Allocation Table )ファイルシステムと呼ばれる管理方法が採られていた。ここでは次のようにデータ記録をしていた。
この方法では、ハードディスク装置の記録領域を複数のブロックと呼ばれるデータ格納領域に分割する。また、このブロックはさらに小データ格納領域である複数のクラスタに、さらに、このクラスタはさらに複数のセクタに分割される。情報記録装置へのアクセスの単位はこのセクタである。そうして、このブロックとクラスタをファイルアロケーションテーブル(FAT)を用いて管理する。
図9に示すように、フォーマットされたディスクでのトラック21をさらに分割した物理的な最小記録単位がセクタ22である。FATディスクファイルシステムでデータの書き込みと読み出しはセクタ22単位で行われる。また、複数のセクタ22をまとめた論理的な最小記録単位をクラスタと呼ぶ。セクタ22はファイルを管理するための単位としては小さすぎるので、複数にまとめクラスタとすることでOSでの管理を容易にしている。このクラスタの使用状況を記憶するテーブルがFATである。
【0005】
FATの内容は対応するクラスタの使用状況を示し、使用中の場合はファイルが次のクラスタに続くかどうかなどの情報を含んでいる。セクタ22の大きさ(セクタサイズ)は512バイトなどで、クラスタの大きさ(クラスタサイズ)はMS−DOSでのFATでは1kバイト、MS−DOS3.0から採用されたFAT16では32kバイト、Windows95から採用されたFAT32では4kバイトである。(Windowsは、米国Microsoft Corporationの登録商標)クラスタサイズが大きいと管理やアクセスが容易になるが、大きすぎるとディスク装置のメモリ領域の利用効率は悪くなる。
【0006】
さらに、セクタ、クラスタよりも大きなデータの論理的な単位としてブロックがある。ファイルを構成する1件のデータの集まりであるレコードをさらに幾つかまとめてブロックとして処理する。外部記憶装置、主メモリ、周辺装置へのデータの転送の際には、レコード単位ではなくブロック単位でデータを転送することで、入出力の回数を減らして効率を上げることができる。これは、外部記憶装置などからデータを読み込む速度が内部のメモリから読み込む速度に比べて遅い場合にとくに有効である。ディスク装置に記憶されたデータの消去もブロック単位で行われる。
【0007】
FATディスクファイルシステムでは、通常データの書き込みに際しては、論理アドレスに従ってファイルを管理するための表であるディレクトリの番号の小さい順にFATのクラスタ情報(データ格納領域の使用/未使用状態を記録したもの)を参照し、未使用であるデータ格納領域を検索する。次に当該未使用データ格納領域にデータを格納し、ディレクトリ構造とFATを更新する。
【0008】
図10は従来のディレクトリ構造を示す説明図である。図11は従来のFATを示す説明図である。
図10のディレクトリ構造には、ファイル名やファイルが管理されているOSの種類を表す拡張子、バイト数や作成日時を表す属性およびFAT上の開始位置を表すFATエントリなどが記録されている。図11のFATには、そのクラスタファイルがどのクラスタに続くのか、あるいはそこで終了するのかを示す情報が記録されている。図11ではクラスタアドレスが002h,003h,004h,005h,008h,009hの6クラスタ使用のファイルと、クラスタアドレスが006h,007hの2クラスタ使用のファイルが存在しそれぞれのFATエントリが002h,006hと記録されている場合の例を示す。
【0009】
データの書き込みに当たって未使用領域を探す場合、図10のディレクトリから対応付けられたFATエントリを参照し、図11のFATからクラスタ情報を参照する。図12のフローチャートに示すように、もし、データ格納領域が未使用(すなわちクラスタ情報=0)であれば、該当データ格納領域にデータを格納し、FATのクラスタ情報を未使用(クラスタ情報=0)から使用(クラスタ情報=次クラスタ番号もしくは終了)に書き換える。さらに、ディレクトリ構造の書き換えを行う。ここで、ディレクトリ構造の書き換えは、ディレクトリ番号に割り当てられるFATエントリ(FAT番号を示す)、ファイル名、拡張子等である。
一方、データ格納領域が使用中(クラスタ情報≠0)であれば、次のディレクトリについて上記の手順を繰り返す。ここで、検索順はディレクトリの小さい順に行う。また、ディレクトリ番号とFATエントリは固定した形になっている。
【0010】
【発明が解決しようとする課題】
上述のごとく、フラッシュメモリの素子は、メーカおよびその型番によってその仕様が異なっており、殊にそのブロックサイズが異なるため、使用する素子ごとに制御の仕方、処理方法を変えなければならないという問題がある。これを避けるような、異なる素子に共通に適用できる独自のファイルシステムを新しく作成するには、手間や作業工数がかかるという問題がある。
本発明は、比較的簡単な方法でこの問題を解決して、仕様の異なるフラッシュメモリ素子のいずれでも素子として選ぶことができ、かつ、簡単な処理でファイル管理を効率良く実現することができる情報処理装置の実現を課題とする。
【0011】
【課題を解決するための手段】
上記課題を達成するため、本発明は、マイクロプロセッサなどの中央処理装置と、RAMとROMとフラッシュメモリとからなる情報記憶手段とを具備する情報処理装置において、前記フラッシュメモリの記憶領域を複数のデータ格納領域に分割し、さらに、このデータ格納領域を複数の小データ格納領域に分割し、各データ格納領域および各小データ格納領域の使用状況を管理テーブルで管理することを特徴とする。
【0012】
これにより、その処理を変更することなくフラッシュメモリのファイル管理を、データ格納領域をブロック、小データ格納領域をクラスタと見なして、FATファイルシステムで効率良く実現することができ、かつ、仕様の異なるフラッシュメモリ素子を共通な方法で管理することができる。また、管理テーブルを用いることで、ブロックの物理アドレス、そのブロックとそのブロック内の各クラスタの使用状況、ブロック内の各クラスタの物理アドレス、クラスタやブロックの良否を少ないメモリで管理することができる。
【0013】
また、複数のデータ格納領域を有し、そのデータ格納領域の各々がさらに複数の小データ格納領域に分割される情報記録手段と、この情報記録手段の前記データ格納領域および小データ格納領域の各々の使用状況を記録する管理テーブルとを具備する情報処理装置に用いられるプログラムにおいて、データの書き込みに際し、前記管理テーブルから未使用のデータ格納領域を検索する手順と、前記検索された未使用のデータ格納領域にデータを格納する手順と、前記管理テーブルの前記データ格納領域使用情報および前記小データ格納領域使用情報とを更新する手順とを情報処理装置に実行させることを特徴とする。
本発明のプログラムにより、フラッシュメモリのファイル管理を、データ格納領域をブロック、小データ格納領域をクラスタと見なして、FATファイルシステムで効率良く実現することができる。また、仕様の異なるフラッシュメモリ素子を共通な方法で管理することができる。管理テーブルを用いることで、ブロックの物理アドレス、そのブロックとそのブロック内の各クラスタの使用状況、ブロック内の各クラスタの物理アドレス、クラスタやブロックの良否を少ないメモリで管理することができる。
【0014】
【発明の実施の形態】
以下、本発明にかかる情報処理装置およびプログラムを添付図面を参照にして詳細に説明する。
【0015】
図1に、本発明が用いられる情報処理装置の構成を示す。図1において、符号1はCPU、符号2はRAM、符号3はROM、符号4はフラッシュメモリ、符号5はI/Oインターフェース、符号6はバスである。この構成でRAM2はCPU1のメインメモリとしての機能とアドレス管理テーブルなど全管理テーブルの記憶機能、ROM3はデバイスドライバ、FAT(File Allocation Table )ファイルシステムおよびユーザプログラムなどの記憶機能、フラッシュメモリ4はデータ記憶領域とシステム管理領域とクラスタ情報、不良ブロック情報などの記憶機能を分担すると共に、電源オフ時にRAM2上の管理テーブルを退避する機能を有する。これらハード部分と本発明の対応については順次発明の記述の中で説明することにする。
【0016】
また、このフラッシュメモリファイルシステムを層構成的にイメージしたのが図2である。図2において、符号11はCPU、符号12はフラッシュメモリ、符号13はアドレスバス、符号14はデータバス、符号15はデバイスドライバ、符号16はファイルシステム、符号17はユーザプログラムである。ハードウェア領域(物理領域)ではCPU11と、フラッシュメモリ12と、CPU11とフラッシュメモリ12を結ぶアドレスバス13およびデータバス14で構成されており、ソフトウェア領域(論理領域)は、OSと周辺機器(ここではフラッシュメモリ12)とを仲介する周辺機器管理プログラムであるデバイスドライバ15と、それに接続されるFAT(File Allocation Table )構成のファイルシステム16およびユーザプログラム17とで構成されている。このイメージはファイル媒体であるフラッシュメモリ12をハードディスクに置き換えるとMS−DOSなどで一般的に用いられているFATディスクファイルシステムと同等のものになる。デバイスドライバ15とFATファイルシステム16はユーザプログラム17などと共にROM3に記憶されている。
【0017】
ところで、先にも述べたように、フラッシュメモリの素子は、メーカおよびその型番によってその記憶容量などの仕様が異なっており、記憶容量によってブロックとして扱えるデータのサイズ(ブロックサイズ)が異なるために、素子種類ごとにデバイスドライバは制御の仕方、処理方法を変えなければならないという問題が生じ、内部カウンタの作業が複雑になるなどの問題があった。
この問題を解決するために本発明ではブロックサイズの違いを仮想クラスタおよび仮想セクタを設けるという管理方法によって吸収するようにし、1ブロック当たりのクラスタ数を変更することで、記憶容量が512バイトの整数倍であれば、素子を選ばずにフラッシュメモリファイルシステムを構成、利用することができ、論理側からはブロックサイズを意識せずに、管理することができるようにした。例えば、ブロックサイズが32kバイトの素子でも、ブロックサイズが64kバイトの素子でもフラッシュメモリとして採用することができる。
【0018】
図3に、本発明のフラッシュメモリファイルシステムでのメモリマップの実施例を示す。図3において、符号31は仮想セクタ、符号32は仮想クラスタ、符号33は物理ブロックであり、符号34は論理ブロックである。複数の仮想セクタ31で仮想クラスタ32を形成し、複数の仮想クラスタ32で物理ブロック33を分割するようにする。仮想クラスタ32を形成する仮想セクタ31の数は特に限定されるものではないが、素子のブロックサイズが余りなく仮想クラスタ32に分割されることが望ましい。
【0019】
この例では、FATファイルシステムに合わせて、フラッシュメモリ素子のメモリ容量を512バイトづつに分割してこれを仮想セクタ31とする。さらに2個の仮想セクタ31で仮想クラスタ32を構成し、物理ブロック33は64kバイトすなわち64個の仮想クラスタ32で構成している。さらに論理ブロック34に対してこのような物理ブロック33をアドレス管理テーブルで割り当てて物理ブロック33を管理する。物理的な記憶、読出しなどの処理の最小単位はセクタであり、論理的な処理の最小単位はクラスタである。さらに、メモリの消去の単位はブロックである。
【0020】
FATファイルシステムでは、固定的にデータの先頭を論理クラスタのアドレス0から書き始める。デバイスドライバは後に述べるように、クラスタの情報、物理ブロック33と論理ブロック34との管理を行っている。FATファイルシステムが新しい情報を論理クラスタのアドレス0から書き始めようとしたとき、すでに論理クラスタアドレス0に対応する仮想クラスタ32に書き込み情報があってクラスタステータスが1の場合は、クラスタステータスが0の論理クラスタを探してデータを書き込む。クラスタステータスが1の論理クラスタに上書きする場合は、デバイスドライバは書き込み情報のない空き物理ブロック33を見つけ、現在のブロックアドレスの物理ブロック33の情報をこの物理ブロック33に移し、上書きを行ってから、先の物理ブロック33の記憶内容を消去し、アドレス管理テーブルのブロックアドレスを新しい物理ブロック33のアドレスに書き換え、クラスタステータスを修正する。
このとき、論理ブロックアドレス0の情報が実際にどの物理ブロック33に書き込まれているかをデバイスドライバはアドレス管理テーブルで管理していて、論理側アドレスと物理側アドレスの対応をとる。
アドレス管理テーブルは電源がオンされたとき、フラッシュメモリ(図1の4)から読み出されたクラスタ管理テーブルを基に、RAM(図1の2)上に作成され、CPU(図1の1)が動作中はRAM2上で動作し、電源がオフされたとき、クラスタ管理テーブルがフラッシュメモリ4に退避して保持される。
【0021】
本発明では、このように仮想的にセクタとクラスタを設け、FATファイルシステムを用いるという独自の方法を採用してフラッシュメモリファイルシステムを管理するようにしたので、ブロックサイズの異なるフラッシュメモリ素子を共通に用いることを可能にし、処理をとくに変更することなく、ディスク管理に広く用いられているFATファイルシステムをそのまま用いることができ、比較的簡単な処理で論理ブロックと物理ブロックの管理を効率良く実現することができる。
【0022】
図4および図5にそって、本発明でのアドレス管理テーブルについて説明する。従来のこの種のアドレス管理テーブルの例では、例えば、図10のように論理側アドレスと物理側アドレスの対応だけを示しているのが一般的である。しかし、本発明のアドレス管理テーブルでは、論理側アドレスと物理側アドレスの相互変換を行うための対照表の機能と、ブロックおよびクラスタの使用状況を示している。
図4はアドレス管理テーブルとその内容を示している。図4において、符号41はアドレス管理テーブル、符号42はアドレス管理テーブル41の前半部分、符号43はアドレス管理テーブル41の後半部分である。また、図5はアドレス管理テーブル41の後半部分43のクラスタステータスと、物理ブロック上のクラスタアドレスの関係を示す図である。
【0023】
アドレス管理テーブル41は電源オン時にRAM2で作成されてデバイスドライバ15で用いられる。図4で示すように、アドレス管理テーブル41は論理ブロックの番号順に記載されている。アドレス管理テーブル41の1ブロック分の中身は、ブロックステータス、ブロックアドレスを示す2バイトの前半部分42と、クラスタステータスを示す8バイト、64ビットの後半部分43に別れている。
前半部分42の2バイト16ビットのうち、最上位1ビットはブロックステータスを表し、このブロックが使用されているか使用されていないかを示している。このブロックが一部でも使用されている場合は1、未使用の場合は0である。残りの15ビットは物理ブロックのアドレス番号を示している。15ビットであるため32768ブロックにまで対応することができる。
【0024】
データを書き込む場合、このアドレス管理テーブル41を参照し、ブロックステータスが0の場合は、そのままそのブロックにデータを書き込む。ブロックステータスおよびクラスタステータスが1の場合は、新たに空き物理ブロックを所得し、その物理ブロックにもとのデータを移動し、該当するクラスタのデータを上書きし、前の物理ブロックは消去する。そうして、アドレス管理テーブル41のブロックアドレスを新たに所得した物理ブロックのものとする。ただし、アドレス管理テーブル41のブロックステータスは該当するブロックにデータが存在するため1のままであり、クラスタステータスももとからデータがあり、移動した部分と、新たにデータを書き込んだ部分は1である。
【0025】
図6に、この間のこのアドレス管理テーブル41の変化を示す。今、図6(a)のように該当の論理ブロックが物理ブロック0に対応しており、物理ブロック1が消去済みの空きブロックであったとする。この論理ブロックにデータを上書きする場合は、空きブロックの物理ブロック1に物理ブロック0にあるこの論理ブロックの上書き部分以外のデータを移し、さらに物理ブロック1の上書き該当部分に新しくデータを書き込み、図6(b)のようにブロックアドレスを1にして物理ブロック0を消去する。ブロックを移動しても、データは残るのでブロックステータスは1のままである。
【0026】
後半部分43の8バイト64ビットは、ブロックの中のクラスタの使用状況すなわちクラスタステータスを表し、図5に示すように、各ビット位置がそれぞれこのブロック内のクラスタの位置(アドレス)を表している。クラスタステータスのビットが1の場合はそのクラスタが使用されていることを、0の場合は未使用を示している。64ビットあるので、1ブロック当たり64クラスタまでに対応している。FATファイルシステムからデータを書き込みにくる場合、クラスタステータスが0の場合はそのままデータを書き込み、クラスタステータスが1の場合は前のデータを消去してからデータを書き込む。
【0027】
このように本発明では使用状況の表示を含めた独自の表示形式のアドレス管理テーブルを設けたので、データの書き込みに当り、ステータスが0の場合はそのままデータを書き込むことができ、従来のようにその都度必ずデータの消去を行ってから書き込みを行う必要がなくなり、その結果データの書き込み速度を早くすることができる。
また、ブロックやクラスタのステータスを1ビットで示しているので、ブロックのステータスと物理アドレスに2バイトと、そのブロック内の各クラスタのステータスに8バイトと、これらの情報を管理するために要するメモリサイズは、1ブロック当たり10バイトで済むため、少ないメモリでフラッシュメモリを管理することができる。
【0028】
例えば、記憶容量が2Mバイトで1ブロック64kバイトのフラッシュメモリの管理に必要なアドレス管理テーブルのサイズは、
となる。
【0029】
次にブロック内の論理クラスタと物理クラスタのアドレス管理と不良ブロックの管理を行うための処理について図7に沿って説明する。従来はセクタ、クラスタの良、不良は、セクタ、クラスタがそれぞれデーター領域内部に付加情報として持っていた。このため、そのセクタ、クラスタを読み出して初めて良否が判定でき、良否判定に手間がかかるという問題があった。
【0030】
図7において、符号51は物理セクタ、符号52は物理クラスタ、符号53は物理ブロック、符号54−1および54−2は1ブロック分のクラスタ管理テーブルである。クラスタ管理テーブル54は論理クラスタアドレス順に物理クラスタアドレスとクラスタステータスという順に書かれている。物理クラスタアドレスはこの論理クラスタに対応する物理クラスタの先頭アドレスで表されている。この例においては“0140”、“0141”、…がそれに当たる。また、ここでのクラスタステータスはそのクラスタの良、不良を表し、良の場合は初期状態の“FFFF”で、不良の場合はそれ以外、例えば“F0FF”で表す。
【0031】
クラスタに不良がある場合は、そのブロック全体が保証できず使えなくなるので、図7の下部に示したクラスタ管理テーブル54−2のように、最初の欄は、物理クラスタのアドレスではなく、物理ブロック番号(この例では0005)を示し、その後にそのブロックが不良であることを表す“F0FF”を表示する。さらに、他の部分は初期状態の“FFFF”にしておく。
このテーブル情報は電源オン時にフラッシュメモリの指定された管理領域からRAM2上に読み出されデバイスドライバ15で用いられ、電源オフ時にはフラッシュメモリの管理領域に退避して保存される。
【0032】
以上のように、本発明では、データ領域とは別に管理領域を設け、この領域でクラスタ管理テーブルを用いて論理クラスタと物理クラスタの対応を取るようにすると共に、同じテーブルでブロックの不良を管理する。これにより、従来では各クラスタおよび各セクタ内部に持っていた付加情報を、クラスタ情報管理セクタで管理することにより、1ブロックを複数クラスタ、複数セクタで余り無く使用することが可能になる。したがって、比較的容易にクラスタ、セクタの管理が行えると共に、ブロックの不良管理も同時に行うことができ、使用領域を少なくして効率的な管理が行える。また、良、不良の判定をブロック単位で行っているので、判定が容易でかつ高速に行える。
【0033】
本発明でデータをフラッシュメモリに書き込む場合の処理のフローチャートを図8に示す。まず、ステップ101でデータの書き込みが新しい論理ブロックへの書き込みか、上書きかを判断する。上書きでない場合は、ステップ102でアドレス管理テーブル41からブロックステータスが0の論理ブロックを探す。そうしてステップ103で探し出した論理ブロックのブロックアドレスを求め、その論理ブロックのブロックステータスとデータを書き込むクラスタのクラスタステータスを1にする。そうして、ステップ104で、このアドレスへデータを書き込み終了する。
ステップ101で上書きの場合は、ステップ105で空き物理ブロックを探して、空き物理ブロックが見つかれば、ステップ106で管理テーブルのブロックアドレスとクラスタステータスを上書き終了の場合に合わせて修正する。そうして、ステップ107で現在の物理ブロックの上書き部分を除いたデータをこの空き物理ブロックに書き込む。ステップ108で上書きするデータを書き込み、ステップ109で元の物理ブロックを消去して終了する。
【0034】
【発明の効果】
以上説明したように本発明によると、フラッシュメモリの記憶領域を仮想的なセクタ、仮想的なクラスタで分割してハードディスク装置に対応させたので、フラッシュメモリのファイル管理をその処理を変更することなくFATファイルシステムで効率良く実現することができ、かつ、仕様の異なるフラッシュメモリ素子を共通に管理することができる。また、管理テーブルを用いることで、ブロックの物理アドレス、そのブロックとそのブロック内の各クラスタの使用状況、ブロック内の各クラスタの物理アドレス、クラスタやブロックの良否を少ないメモリで管理することができ、効率的にファイル管理を行うことができる。
【図面の簡単な説明】
【図1】本発明が用いられる情報処理装置の構成を示す図。
【図2】本発明のフラシュメモリファイルシステムの層構成イメージを示す図。
【図3】本発明のフラシュメモリファイルシステムのメモリマップの一例を示す図。
【図4】本発明のアドレス管理テーブルの説明図。
【図5】本発明のアドレス管理テーブルの説明図。
【図6】本発明で上書きの場合のアドレス管理テーブル変化を示す説明図。
【図7】本発明のクラスタ管理テーブルの説明図。
【図8】本発明でのデータの書き込み方法を示すフローチャート。
【図9】ハードディスクの記録単位を示す説明図。
【図10】従来のディレクトリ構造を示す説明図。
【図11】従来のFATを示す説明図。
【図12】従来のデータの書き込み手順を示すフローチャート。
【符号の説明】
1、11 CPU
2 RAM
3 ROM
4、12 フラッシュメモリ
5 I/Oインタフェース
6 バス
13 アドレスバス
14 データバス
16 ファイルシステム
17 ユーザプログラム
21 トラック
22 セクタ
31 仮想セクタ
32 仮想クラスタ
33、53 物理ブロック
34 論理ブロック
41 アドレス管理テーブル
42 前半部分
43 後半部分
51 物理セクタ
52 物理クラスタ
54−1、54−2 クラスタ管理テーブル[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to an information processing apparatus and a program, and more particularly to an information processing apparatus and a program in which a file management method of a flash memory is improved.
[0002]
[Prior art]
A flash memory is a type of EEPROM (Electrically Erasable and Programmable Read Only Memory), but is a memory configured to be able to erase in block units or collectively, while a normal EEPROM erases one byte at a time. . Data can be rewritten relatively freely and repeatedly, does not require a backup power supply, and has a simple configuration, so that the unit cell area is smaller than that of a RAM. Also, the number of times of writing and erasing is guaranteed to be about 100,000 times. Further, the storage capacity is wide ranging from several Mbytes to about 512 Mbytes. For this reason, it is used not only for storing a BIOS (basic input / output system) of a personal computer or the like, but also for being widely used as an on-board memory.
By the way, flash memory elements have different specifications depending on the maker and the model number. In particular, since the block size, which is the maximum unit of data that can be transferred at one time, differs depending on the storage capacity, the control of the element depends on the difference. There was a problem that the method and processing method had to be changed.
[0003]
The file system means a method of managing files on an external storage device such as a hard disk, and is provided by an operating system (OS) which is basic software, and organizes various types of files and accesses the files. It shows a method and the like, and implements a mechanism and system for efficiently operating and managing data stored in a hard disk device or the like.
However, creating a unique file system that can be commonly applied to flash memories having different specifications requires time and labor, resulting in an expensive system.
[0004]
On the other hand, in a conventional information recording apparatus, a management method called a FAT (File Allocation Table) file system has been adopted for managing files on a hard disk device. Here, data recording was performed as follows.
In this method, the recording area of the hard disk device is divided into a plurality of data storage areas called blocks. This block is further divided into a plurality of clusters which are small data storage areas, and this cluster is further divided into a plurality of sectors. The unit of access to the information recording device is this sector. Then, the blocks and clusters are managed using the file allocation table (FAT).
As shown in FIG. 9, a physical minimum recording unit obtained by further dividing the
[0005]
The contents of the FAT indicate the use status of the corresponding cluster, and include information such as whether or not the file continues to the next cluster when in use. The size of the sector 22 (sector size) is 512 bytes or the like. The adopted FAT32 is 4 kbytes. (Windows is a registered trademark of Microsoft Corporation in the United States.) If the cluster size is large, management and access are easy, but if the cluster size is too large, the efficiency of using the memory area of the disk device deteriorates.
[0006]
Further, there is a block as a logical unit of data larger than a sector or a cluster. Records, which are collections of one piece of data constituting the file, are further collectively processed as a block. When data is transferred to an external storage device, a main memory, or a peripheral device, by transferring data not in units of records but in units of blocks, the number of input / output operations can be reduced and efficiency can be increased. This is particularly effective when the speed of reading data from an external storage device or the like is lower than the speed of reading data from an internal memory. Erasure of data stored in the disk device is also performed in block units.
[0007]
In the FAT disk file system, when writing normal data, FAT cluster information (recording the used / unused state of the data storage area) in ascending order of directory numbers, which is a table for managing files according to logical addresses To search for an unused data storage area. Next, data is stored in the unused data storage area, and the directory structure and FAT are updated.
[0008]
FIG. 10 is an explanatory diagram showing a conventional directory structure. FIG. 11 is an explanatory diagram showing a conventional FAT.
In the directory structure of FIG. 10, a file name, an extension indicating the type of the OS in which the file is managed, an attribute indicating the number of bytes and creation date and time, and a FAT entry indicating a start position on the FAT are recorded. In the FAT of FIG. 11, information indicating which cluster the cluster file follows or the end of the cluster file is recorded. In FIG. 11, a file using six clusters with
[0009]
When searching for an unused area when writing data, the corresponding FAT entry is referenced from the directory in FIG. 10 and the cluster information is referenced from the FAT in FIG. As shown in the flowchart of FIG. 12, if the data storage area is unused (that is, cluster information = 0), data is stored in the corresponding data storage area, and the FAT cluster information is unused (cluster information = 0). ) To use (cluster information = next cluster number or end). Further, the directory structure is rewritten. Here, the rewriting of the directory structure includes a FAT entry (indicating a FAT number) assigned to the directory number, a file name, an extension, and the like.
On the other hand, if the data storage area is in use (cluster information # 0), the above procedure is repeated for the next directory. Here, the search order is performed in ascending order of the directory. Further, the directory number and the FAT entry are fixed.
[0010]
[Problems to be solved by the invention]
As described above, the flash memory elements have different specifications depending on the manufacturer and the model number. In particular, since the block size is different, there is a problem that the control method and the processing method must be changed for each element used. is there. In order to avoid this, creating a new unique file system that can be commonly applied to different elements has a problem that it takes time and labor.
The present invention solves this problem in a relatively simple manner, and can select any of flash memory elements having different specifications as an element, and can efficiently realize file management with simple processing. It is an object to realize a processing device.
[0011]
[Means for Solving the Problems]
In order to achieve the above object, the present invention provides an information processing apparatus including a central processing unit such as a microprocessor, and information storage means including a RAM, a ROM, and a flash memory, wherein a plurality of storage areas of the flash memory are provided. The data storage area is divided into a plurality of small data storage areas, and each data storage area and the usage status of each small data storage area are managed by a management table.
[0012]
As a result, the file management of the flash memory can be efficiently realized by the FAT file system without changing the processing by regarding the data storage area as a block and the small data storage area as a cluster, and having different specifications. Flash memory elements can be managed in a common way. Further, by using the management table, it is possible to manage the physical address of the block, the use status of the block and each cluster in the block, the physical address of each cluster in the block, and the quality of the cluster or block with a small memory. .
[0013]
An information recording unit having a plurality of data storage areas, each of which is further divided into a plurality of small data storage areas; and each of the data storage area and the small data storage area of the information recording means. In a program used in an information processing apparatus having a management table for recording the use status of a data, a procedure for searching for an unused data storage area from the management table when writing data; The information processing apparatus may execute a procedure for storing data in a storage area and a procedure for updating the data storage area use information and the small data storage area use information in the management table.
According to the program of the present invention, the file management of the flash memory can be efficiently realized by the FAT file system by regarding the data storage area as a block and the small data storage area as a cluster. Further, flash memory elements having different specifications can be managed by a common method. By using the management table, it is possible to manage the physical address of the block, the usage status of the block and each cluster in the block, the physical address of each cluster in the block, and the quality of the cluster or block with a small memory.
[0014]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, an information processing apparatus and a program according to the present invention will be described in detail with reference to the accompanying drawings.
[0015]
FIG. 1 shows a configuration of an information processing apparatus to which the present invention is applied. In FIG. 1,
[0016]
FIG. 2 illustrates this flash memory file system in a layered structure. In FIG. 2,
[0017]
By the way, as described above, flash memory elements have different specifications such as storage capacity depending on the manufacturer and the model number, and the size of data (block size) that can be handled as a block differs depending on the storage capacity. There is a problem that the device driver needs to change the control method and the processing method for each element type, and the operation of the internal counter becomes complicated.
In order to solve this problem, in the present invention, the difference in block size is absorbed by a management method of providing a virtual cluster and a virtual sector, and the number of clusters per block is changed so that the storage capacity is an integer of 512 bytes. If it is twice, the flash memory file system can be configured and used without selecting the element, and it can be managed from the logic side without being aware of the block size. For example, an element having a block size of 32 kbytes or an element having a block size of 64 kbytes can be adopted as a flash memory.
[0018]
FIG. 3 shows an embodiment of a memory map in the flash memory file system of the present invention. In FIG. 3,
[0019]
In this example, according to the FAT file system, the memory capacity of the flash memory device is divided into 512 bytes, and this is used as a
[0020]
In the FAT file system, the head of data is fixedly written from
At this time, the device driver manages in which physical block 33 the information of the
When the power is turned on, the address management table is created on the RAM (2 in FIG. 1) based on the cluster management table read from the flash memory (4 in FIG. 1), and the CPU (1 in FIG. 1). Operates on the
[0021]
In the present invention, a flash memory file system is managed by adopting a unique method of providing a virtual sector and a cluster and using the FAT file system as described above. The FAT file system widely used for disk management can be used as it is without any change in processing, and logical blocks and physical blocks can be efficiently managed with relatively simple processing. can do.
[0022]
An address management table according to the present invention will be described with reference to FIGS. In a conventional example of this type of address management table, for example, as shown in FIG. 10, for example, only the correspondence between the logical side address and the physical side address is generally shown. However, the address management table of the present invention shows the function of a comparison table for performing mutual conversion between the logical side address and the physical side address, and the use status of blocks and clusters.
FIG. 4 shows the address management table and its contents. 4, reference numeral 41 denotes an address management table,
[0023]
The address management table 41 is created in the
The most significant one bit of the two
[0024]
When writing data, the address management table 41 is referred to, and when the block status is 0, the data is written to the block as it is. When the block status and the cluster status are 1, a new free physical block is obtained, the original data is moved to the new physical block, the data of the corresponding cluster is overwritten, and the previous physical block is erased. Then, the block address in the address management table 41 is assumed to be that of the newly acquired physical block. However, the block status of the address management table 41 remains 1 because data exists in the corresponding block, and the cluster status also has data from the beginning, and the moved part and the newly written data are one. is there.
[0025]
FIG. 6 shows changes in the address management table 41 during this time. Now, it is assumed that the relevant logical block corresponds to the
[0026]
The 64 bytes of 8 bytes in the
[0027]
As described above, in the present invention, the address management table in a unique display format including the display of the use status is provided, so that when writing the data, when the status is 0, the data can be written as it is. In each case, it is not necessary to perform writing after erasing data, so that the data writing speed can be increased.
Also, since the status of a block or cluster is indicated by one bit, the status of the block and the physical address are 2 bytes, the status of each cluster in the block is 8 bytes, and a memory required for managing these information. Since the size is only 10 bytes per block, the flash memory can be managed with a small amount of memory.
[0028]
For example, the size of an address management table required for managing a flash memory having a storage capacity of 2 Mbytes and a block of 64 Kbytes is as follows.
It becomes.
[0029]
Next, processing for managing addresses of a logical cluster and a physical cluster in a block and managing a bad block will be described with reference to FIG. Conventionally, sectors and clusters have good or bad sectors and clusters as additional information in the data area. For this reason, there is a problem that the pass / fail can be determined only by reading the sector and the cluster, and the pass / fail determination takes time.
[0030]
7, reference numeral 51 denotes a physical sector, reference numeral 52 denotes a physical cluster, reference numeral 53 denotes a physical block, and reference numerals 54-1 and 54-2 denote a cluster management table for one block. The cluster management table 54 is written in the order of the physical cluster address and the cluster status in the order of the logical cluster address. The physical cluster address is represented by the head address of the physical cluster corresponding to this logical cluster. In this example, “0140”, “0141”,. Also, the cluster status here indicates good or bad of the cluster. If good, the initial status is "FFFF", and if bad, the status is otherwise "F0FF".
[0031]
If there is a defect in the cluster, the entire block cannot be guaranteed and cannot be used. Therefore, as shown in the cluster management table 54-2 shown in the lower part of FIG. 7, the first column is not the physical cluster address but the physical block. A number (0005 in this example) is shown, followed by "F0FF" indicating that the block is defective. Further, the other parts are set to “FFFF” in the initial state.
This table information is read out from the designated management area of the flash memory onto the
[0032]
As described above, in the present invention, a management area is provided separately from the data area, and in this area, correspondence between logical clusters and physical clusters is established using a cluster management table, and block defects are managed using the same table. I do. As a result, the additional information conventionally held in each cluster and each sector is managed by the cluster information management sector, so that one block can be used by a plurality of clusters and a plurality of sectors. Therefore, the cluster and the sector can be managed relatively easily, and the defect management of the block can be performed at the same time, so that the used area can be reduced and the efficient management can be performed. In addition, since the determination of good or bad is made in block units, the determination can be made easily and at high speed.
[0033]
FIG. 8 shows a flowchart of a process for writing data to a flash memory according to the present invention. First, in
In the case of overwriting in
[0034]
【The invention's effect】
As described above, according to the present invention, the storage area of the flash memory is divided into virtual sectors and virtual clusters to correspond to the hard disk device. It can be efficiently realized by the FAT file system, and the flash memory devices having different specifications can be managed in common. In addition, by using the management table, it is possible to manage the physical address of the block, the usage status of the block and each cluster in the block, the physical address of each cluster in the block, and the quality of the cluster or block with a small memory. Thus, file management can be performed efficiently.
[Brief description of the drawings]
FIG. 1 is a diagram showing a configuration of an information processing apparatus to which the present invention is applied.
FIG. 2 is a diagram showing a layer configuration image of a flash memory file system of the present invention.
FIG. 3 is a view showing an example of a memory map of the flash memory file system of the present invention.
FIG. 4 is an explanatory diagram of an address management table according to the present invention.
FIG. 5 is an explanatory diagram of an address management table according to the present invention.
FIG. 6 is an explanatory diagram showing a change in an address management table in the case of overwriting in the present invention.
FIG. 7 is an explanatory diagram of a cluster management table according to the present invention.
FIG. 8 is a flowchart showing a data writing method according to the present invention.
FIG. 9 is an explanatory diagram showing recording units of a hard disk.
FIG. 10 is an explanatory diagram showing a conventional directory structure.
FIG. 11 is an explanatory view showing a conventional FAT.
FIG. 12 is a flowchart showing a conventional data writing procedure.
[Explanation of symbols]
1,11 CPU
2 RAM
3 ROM
4,12 flash memory
5 I / O interface
6 bus
13 Address bus
14 Data bus
16 File System
17 User program
21 tracks
22 sectors
31 virtual sectors
32 virtual clusters
33, 53 physical block
34 Logical Block
41 Address Management Table
42 First half
43 Second half
51 physical sectors
52 Physical Cluster
54-1 and 54-2 Cluster Management Table
Claims (5)
前記フラッシュメモリの記憶領域を複数のデータ格納領域に分割し、さらに、このデータ格納領域を複数の小データ格納領域に分割し、各データ格納領域および各小データ格納領域の使用状況を管理テーブルで管理することを特徴とする情報処理装置。In an information processing apparatus including a central processing unit such as a microprocessor and an information storage unit including a RAM, a ROM, and a flash memory,
The storage area of the flash memory is divided into a plurality of data storage areas, and the data storage area is further divided into a plurality of small data storage areas. An information processing device characterized by management.
この小データ格納領域管理テーブル中にその小データ格納領域が不良でないことを示す小データ格納領域情報を含め、不良の小データ格納領域が含まれている場合はそのデータ格納領域全体を不良と見なして、小データ格納領域の物理アドレスに変えてデータ格納領域の物理アドレスとデータ格納領域不良情報とを含めることを特徴とする請求項1に記載の情報処理装置。Provide a small data storage area management table indicating the logical address of each of the small data storage areas in the data storage area and the corresponding physical address,
If the small data storage area management table includes small data storage area information indicating that the small data storage area is not defective, and if the small data storage area is defective, the entire data storage area is regarded as defective. 2. The information processing apparatus according to claim 1, wherein a physical address of the data storage area and data storage area defect information are included in place of the physical address of the small data storage area.
データの書き込みに際し、前記管理テーブルから未使用のデータ格納領域を検索する手順と、
前記検索された未使用のデータ格納領域にデータを格納する手順と、
前記管理テーブルの前記データ格納領域使用情報および前記小データ格納領域使用情報とを更新する手順と
を情報処理装置に実行させることを特徴とするプログラム。Information recording means having a plurality of data storage areas, each of which is further divided into a plurality of small data storage areas; and use of each of the data storage area and the small data storage area of the information recording means. In a program used in an information processing apparatus having a management table for recording a situation,
A step of retrieving an unused data storage area from the management table when writing data;
Storing data in the searched unused data storage area;
Updating the data storage area use information and the small data storage area use information in the management table.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002190244A JP2004038237A (en) | 2002-06-28 | 2002-06-28 | Information processor and program therefor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002190244A JP2004038237A (en) | 2002-06-28 | 2002-06-28 | Information processor and program therefor |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2004038237A true JP2004038237A (en) | 2004-02-05 |
Family
ID=31700213
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2002190244A Withdrawn JP2004038237A (en) | 2002-06-28 | 2002-06-28 | Information processor and program therefor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2004038237A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006011533A (en) * | 2004-06-22 | 2006-01-12 | Toshiba Corp | Memory card, semiconductor device, and control method of semiconductor memory |
JP2006338370A (en) * | 2005-06-02 | 2006-12-14 | Toshiba Corp | Memory system |
JP2012068862A (en) * | 2010-09-22 | 2012-04-05 | Toshiba Corp | Semiconductor memory controller |
-
2002
- 2002-06-28 JP JP2002190244A patent/JP2004038237A/en not_active Withdrawn
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006011533A (en) * | 2004-06-22 | 2006-01-12 | Toshiba Corp | Memory card, semiconductor device, and control method of semiconductor memory |
JP2006338370A (en) * | 2005-06-02 | 2006-12-14 | Toshiba Corp | Memory system |
JP2012068862A (en) * | 2010-09-22 | 2012-04-05 | Toshiba Corp | Semiconductor memory controller |
US8555027B2 (en) | 2010-09-22 | 2013-10-08 | Kabushiki Kaisha Toshiba | Semiconductor memory controlling device |
US9213604B2 (en) | 2010-09-22 | 2015-12-15 | Kabushiki Kaisha Toshiba | Semiconductor memory controlling device which writes data and error correction codes into different semiconductor storage drives |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7840617B2 (en) | Host device and memory system | |
US8041887B2 (en) | Memory device and control method thereof | |
JP3078946B2 (en) | Managing method of batch erase nonvolatile memory and semiconductor disk device | |
JP4238514B2 (en) | Data storage device | |
US7861028B2 (en) | System and method for configuration and management of flash memory | |
TWI424316B (en) | Controller, data storage device, and program product | |
JP4132086B2 (en) | Moving sectors in blocks in flash memory | |
US8458436B2 (en) | Device and memory system for memory management using access frequency information | |
JP4268396B2 (en) | Non-volatile memory device file management that can be programmed once | |
JP4356686B2 (en) | Memory device and memory control method | |
KR100847506B1 (en) | Storage device, memory management method and program | |
JPH11203191A (en) | Nonvolatile storage device, control method of nonvolatile storage device and information recording medium recorded with program for controlling nonvolatile storage device | |
US20030229753A1 (en) | Flash memory file system | |
US20060187738A1 (en) | Memory management device and memory device | |
US7647470B2 (en) | Memory device and controlling method for elongating the life of nonvolatile memory | |
JP2005516264A (en) | Method and apparatus for reducing block write operation time performed on non-volatile memory | |
JPH08137634A (en) | Flash disk card | |
US20110022807A1 (en) | Write once recording device | |
JP2008242944A (en) | Integrated memory management device and method | |
KR20010037155A (en) | Flash file system | |
JP5057887B2 (en) | Data update device, data update method, and data update program | |
JP4221959B2 (en) | Bridge file system, computer system, data management method and recording medium using bridge file system | |
JP4130808B2 (en) | Formatting method | |
US20050149493A1 (en) | Data recording apparatus and data recording method | |
JP2000181784A (en) | Non-volatile storage device which can be rewritten |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20050201 |
|
A761 | Written withdrawal of application |
Free format text: JAPANESE INTERMEDIATE CODE: A761 Effective date: 20070122 |