Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP3620110B2 - File storage device - Google Patents
[go: Go Back, main page]

JP3620110B2 - File storage device - Google Patents

File storage device Download PDF

Info

Publication number
JP3620110B2
JP3620110B2 JP22983495A JP22983495A JP3620110B2 JP 3620110 B2 JP3620110 B2 JP 3620110B2 JP 22983495 A JP22983495 A JP 22983495A JP 22983495 A JP22983495 A JP 22983495A JP 3620110 B2 JP3620110 B2 JP 3620110B2
Authority
JP
Japan
Prior art keywords
unit
data
file
writing
information management
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP22983495A
Other languages
Japanese (ja)
Other versions
JPH0973369A (en
Inventor
盛嗣 西田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panasonic Corp
Panasonic Holdings Corp
Original Assignee
Panasonic Corp
Matsushita Electric Industrial Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Panasonic Corp, Matsushita Electric Industrial Co Ltd filed Critical Panasonic Corp
Priority to JP22983495A priority Critical patent/JP3620110B2/en
Publication of JPH0973369A publication Critical patent/JPH0973369A/en
Application granted granted Critical
Publication of JP3620110B2 publication Critical patent/JP3620110B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【産業上の利用分野】
本発明は、磁性体や半導体メモリを使用し、複数の可変長データの随時書込みおよび読出しが可能なファイル記憶装置に関するものである。
【0002】
【従来の技術】
従来より、コンピュータのプログラム保存やデータ格納のために、大容量の読み書き可能な外部記憶装置が使用されてきた。これらの外部記憶装置では、記憶媒体の特徴として、任意の記憶領域に1バイト単位で読み書きが可能であっても、上記記憶媒体を数百バイトから数キロバイトといった小容量の区分(以下、「セクタ」という)に分割して読み書きの単位とし、複数のセクタを連結使用することで、可変長のデータ記憶を可能としている。また、可変長データにファイル名を付与し、複数の可変長ファイルの記憶を可能とする構成が一般に用いられている。このように、大容量の外部記憶装置では、セクタ分割により複数の可変長データを記憶する手法が確立されているが、上述したように、記憶媒体がセクタ単位で随時読み書きが可能であることが必要であり、その仕様を満たす大容量の記憶媒体としては磁気ディスクが主流となっていた。ところが、近年の不揮発性半導体メモリの集積度の向上により、フラッシュロムと呼ばれる数十メガバイトの記憶容量を持つメモリカードの開発が進み、磁気ディスクに比べて小型、軽量で機械的な衝撃に強いなどの特長を持つため、外部記憶装置への利用も考えられるようになってきた。これらのメモリカードは、上記特長を生かして、携帯型コンピュータや動作条件の厳しい産業用機器の外部記憶装置としての導入が進められている。
【0003】
以下、従来のファイル記憶装置について図を用いて説明する。
図6は従来のファイル記憶装置600を示すブロック図である。図6において、601は後述のデータ記憶部602のセクタの使用状況を管理すると共に各データのサイズ、先頭セクタ番号、個々のデータの識別子であるファイル名を一括管理することにより可変長データをファイルとして複数記憶できるようにしたファイル情報管理部、602はデータを小区画のセクタに分割して記憶するデータ記憶部、603は記憶媒体であるデータ記憶部602への読み書きが遅い場合に後述のアプリケーション部606からの読み書きへの応答時間を速くするため、ファイル情報管理部601、データ記憶部602の内容の複製を読み書きの応答時間が各段に短い半導体メモリに一時的に記憶するキャッシュ部、604は後述のアプリケーション部606からの指示で新規ファイルを作成する場合に必要なセクタの獲得、連結、データサイズ、ファイル名の記憶を行うファイル制御部、605は後述のアプリケーション部606がファイル制御部604へ新規ファイル作成の指示を行った後、実際に記憶するデータを転送して、データ記憶部602へ書き込ませるデータ転送部、606は新規ファイルの作成をファイル制御部604へ指示する主装置上のアプリケーション部である。
【0004】
以上のように構成されたファイル記憶装置について、その使用方法を説明する。
【0005】
上記キャッシュ部603の使用方法としては、書込みの場合には、キャッシュ部603へ書き込むと共にデータ記憶部602にも即時書き込むライトスルー方式と、キャッシュ部603にのみ書き込み、書込みデータが一定時間更新されない場合にデータ記憶部602へ書き込むライトバック方式とがある。読出しの場合には、読出しが指定されたセクタのデータがキャッシュ部603に記憶されている場合にデータ記憶部602の内容ではなくキャッシュ部603の内容を読み出す方法があり、これは上記両方式に共通の方法である。上述のライトスルー方式では読出し時間のみ短縮され、ライトバック方式では読出し時間、書込み時間ともに短縮される。また、このようなファイル記憶装置に重要なデータを保管する場合には、ファイル記憶装置を2重化して2台の装置に同時にデータを記憶することにより、一方の装置が故障しても他方の装置を使用することによりデータの損失を防ぐ方法が利用されている。
【0006】
【発明が解決しようとする課題】
しかしながら、従来のファイル記憶装置では、データ書込み中に記憶媒体上のファイル情報管理部601へファイル名、データサイズが書き込まれ、セクタ状態も変更されるので、書込み中に停電や主装置の障害が発生して書込み処理が継続できなくなった場合、書込みが完了していないデータもファイルとして作成されてしまうという問題点を有していた。しかも、これらのデータはチェックサムを取るなどの手段を別途講じないと書込みが不完全か否かを区別できず、チェックサムを取る手段の場合、構成が複雑となり、高コスト、大型化を招いていた。また、装置単体ではファイル情報管理部601は2重化されていないので、データ書込み完了後でファイル情報管理部601の更新中に同様の障害が発生すると、セクタの連結状態の不整合が発生し、書込み中のファイルだけでなく、その他のファイルの管理情報も破壊されるという問題点を有していた。さらに、上記ライトバック方式によるキャッシュ部を使用する場合、キャッシュ部からファイル情報管理部601への書込みも遅延されるので、停電などによるファイル破壊の危険性が大きくなるという問題点を有していた。さらに、装置自体を2重化する方法は装置自体の障害に対しては有効であるが、高コストとなり、大型化するという問題点を有していた。
【0007】
本発明は上記従来の問題点を解決するもので、書込み中に停電や主装置の障害が発生しても不完全なファイルを作成することがない小型、低コストのファイル記憶装置を提供することを目的とする。
【0008】
【課題を解決するための手段】
この目的を達成するために本発明の第1の発明におけるファイル記憶装置及びその書き込み方法は
複数のバイトを1単位とするセクタから成る読み書き可能な記憶媒体を有するファイル記憶装置であって、記憶媒体上に配置されたファイル名と先頭セクタ番号とセクタ連結順番とデータサイズとを記憶するファイル情報管理部とデータを記憶するデータ記憶部とを有し、ファイル情報管理部と同一種類のデータを保持しファイル情報管理部のファイル内容を更新するキャッシュ部と、データ記憶部との間でデータの読み出し書き込みを行うデータ転送部とを有し、主装置から書き込みを要求された時データ転送部のデータをデータ記憶部に書き込み、主装置から書き込みの完了を通知された時キャッシュ部のデータを情報管理部に書き込むことを特徴とするファイル制御装置及びその書き込み方法である。
【0010】
本発明の第2の発明におけるファイル記憶装置及びその書き込み方法は、複数のバイトを1単位とするセクタから成る読み書き可能な記憶媒体を有するファイル記憶装置であって、記憶媒体上に配置されたファイル名と先頭セクタ番号とセクタ連結順番とデータサイズとを記憶する第1と第2のファイル情報管理部とデータを記憶するデータ記憶部とを有し、第1のファイル情報管理部と同一種類のデータを保持し第1のファイル情報管理部のファイル内容を更新するキャッシュ部と、データ記憶部との間でデータの読み出し書き込みを行うデータ転送部と、起動時に第1および第2のファイル情報管理部のいずれか一方にファイル内容の誤りを検出した場合には誤りの無い他のファイル情報管理部のデータを誤りを検出したファイル情報管理部に複写して訂正する初期診断部とを有し、主装置から書き込みを要求された時データ転送部のデータをデータ記憶部に書き込み、主装置から書き込みの完了を通知された時キャッシュ部のデータを第1の情報管理部に書き込むと共に、起動時に初期診断部により誤り検出と訂正とを行うことを特徴とするファイル記憶装置及びその書き込み方法である。
【0011】
【作用】
この構成によって、ファイル制御部により、データの書き込み完了時にキャッシュ部のデータをファイル情報管理部に書き込むようにすることができるので、データ書込み完了まではファイル情報管理部になんら変更が加えられず、途中で停電や主装置の障害が発生しても、不完全なファイルが作成されることはない。また、装置自体は2重化されず、小形化、低コスト化が達成される。
【0012】
また、第1および第2のファイル情報管理部のいずれか一方にファイル内容の誤りを検出した場合には誤りの無いファイル情報管理部のデータを誤りを検出したファイル情報管理部に複写して訂正するようにしたので、ファイル作成以前または以後の完全なファイルを使用して誤りを検出したファイル内容を訂正でき、中途半端なファイルを作成することがない。さらに、一方のファイル情報管理部が破壊されても、破壊されていない方のファイル内容で複写することにより、同様に訂正可能である。さらに、装置自体は2重化されず、小形化、低コスト化が達成される。
【0013】
【実施例】
(実施例1)
以下、本発明の一実施例に係るファイル記憶装置について図を用いて説明する。
【0014】
図1は本発明の一実施例に係るファイル記憶装置100を示すブロック図である。
【0015】
図1において、101はデータ記憶部103上のデータを管理する第1のファイル情報管理部、102は第1のファイル情報管理部101と同一種類のデータを保持する第2のファイル情報管理部、104は読み書き速度が速い半導体メモリで構成され、第1のファイル情報管理部101の全内容を保持するキャッシュ部、105は主装置上のアプリケーション部108からファイルの読み書きを要求された場合の処理を行うファイル制御部、106はアプリケーション部108から指定されたデータの読み書きをデータ記憶部103との間で行うデータ転送部、107はファイル記憶装置100の立上げ時にファイル内容の誤りを検出、訂正する初期診断部である。上記第1のファイル情報管理部101、第2のファイル情報管理部102およびデータ記憶部103は記憶媒体上に配置される。
【0016】
以上のように構成されたファイル記憶装置において可変長データを複数記憶する方法について説明する。図2は第1のファイル情報管理部101、第2のファイル情報管理部102およびデータ記憶部103を示すデータ状態図である。データ記憶部103は、従来例と同様、記憶媒体を小区画のセクタに分割して割り当てたものである。本実施例では、データ記憶部103は1セクタ512バイトの12個のセクタで構成されるとし、データサイズが200バイト、600バイトの2つのデータにそれぞれファイル1b、ファイル2bというファイル名を付与してデータ記憶部103に記憶する場合について説明する。図2に示すように第1のファイル情報管理部101はディレクトリ1およびファイルアロケーションテーブル(FAT)1aを有し、ディレクトリ1は、領域1101、201のファイル1b、2b、領域1102、202のデータサイズ200、600、領域1103の先頭セクタ番号211、212から構成される。第2のファイル情報管理部102はディレクトリ2およびファイルアロケーションテーブル(FAT)2aを有する。第2のファイル情報管理部102については第2の実施例で説明する。ファイル1bはデータサイズが200バイトであり、1セクタ(512バイト)以内に収まるので、FAT1a上ではセクタ番号211のように記憶されるが、ファイル2bはデータサイズが600バイトなので、512バイトのセクタが2個必要となり、FAT1a上ではセクタ212に次のセクタ番号213が書き込まれ、最終セクタ213にはその印としてFFが書込まれている。
【0017】
このような構成のファイル記憶装置100において、主装置のアプリケーション部からファイル記憶装置へ図2のファイル2bを新たに書き込む場合の動作を図3を用いて説明する。図3はファイル記憶装置100の動作を説明するための動作手順図である。図3において、101は第1のファイル情報管理部、103はデータ記憶部、104はキャッシュ部、105はファイル制御部、106はデータ転送部、108はアプリケーション部であり、これらは図1と同様のものなので、同一符号を付して説明は省略する。まず、アプリケーション部108から新規ファイル作成を指示するオープン要求を受信したファイル制御部105は、キャッシュ部104上のディレクトリ領域に新規ファイルを記憶する領域があるか検索し(S1、S2)、空領域があればアプリケーション部108から指定されたファイル名を図2に示したような領域201に登録し、データサイズの初期値として“0”を領域202に登録し、アプリケーション部108へ肯定応答であるオープン確認を返す(S3)。アプリケーション部108は、オープン確認受信後、200バイトの書込み要求をデータ転送部106へ行う(S4、S5)。データ転送部106は記憶に必要な空セクタ212(図2参照)を探して、ディレクトリ1の先頭セクタ番号領域203に書き込み(S6)、データサイズ領域202にファイル長200を加算し、書込み要求されたデータ200バイトを保持する(S7)。
【0018】
次に再度、アプリケーション部108が200バイトの書込み要求を行う(S8)。これで合計して400バイトの書込み要求(蓄積サイズ)であるが、この蓄積サイズは1セクタ分512バイトを超過しないので、データ転送部106に蓄積される(S9、S10)。次に、3回目の200バイトの書込み要求を受信した段階で、1セクタ分512バイトを記憶媒体上のデータ記憶部103へ書き込む(S11)。また、200バイトのうちの残りの88バイトはデータ転送部106に保持されるが(S12)、この88バイトの保持のために新たな空セクタ213(図2参照)を探し、空セクタ212にそのセクタ番号213を書き込む(S13)。最後に、書込み完了を知らせるクローズ通知をアプリケーション部108からファイル制御部105が受信すると、データ転送部106に残された88バイトのデータをデータ記憶部103に書き込む(S15)と共に、第1のファイル情報管理部101には、キャッシュ部104に保持されている内容のデータが書き込まれる(S16)。
【0019】
以上のように本実施例によれば、セクタに対するデータの書き込み完了時にファイル名、ファイル長等の管理情報であるキャッシュ部104のデータを第1のファイル情報管理部101に書き込むようにしたので、データ書込み完了までは第1のファイル情報管理部101の内容にはなんら変更が加えられず、途中で停電や主装置の障害が発生しても、第1のファイル情報管理部101にはなんら影響は及ばず、従って第1のファイル情報管理部101において不完全なファイルが作成されることはない。途中で停電や主装置の障害が発生した場合にはファイル作成は再度やり直すことになる。
【0020】
(実施例2)
以下、本発明の第2の実施例に係るファイル記憶装置について説明する。本実施例に係るファイル記憶装置は図1と同様の構成である。第1の実施例では第2のファイル情報管理部102を使用しなかったが(図3参照)、本実施例では第2のファイル情報管理部102を使用する。つまり、ファイル情報管理部が第1のファイル情報管理部101と第2のファイル情報管理部102とに2重化される事になる。
【0021】
まず、図3のステップ15、16のファイル書込み完了処理中に停電が発生した場合に生じるデータ破壊について図4を用いて説明する。図4(a)は第1のファイル情報管理部101のデータ状態図、図4(b)は第2のファイル情報管理部102のデータ状態図である。図4(a)、(b)において、400、401はディレクトリ、402〜404はファイルアロケーションテーブル、405〜414はセクタである。
【0022】
図4(a)において、セクタ405、406、407、408を使用するファイルのデータ書込みが完了し、図3のステップ16のクローズ通知のキャッシュ掃き出し通知で、第1のファイル情報管理部101に対するディレクトリ400、401とFAT402との書込みが完了した時点で停電が発生すると、セクタ406が指すセクタ407は以前の空状態のままになり、このファイルはセクタの連結が406で切れたままになる。この状態で、この後に停電が復旧して別途新たなファイルが作成され、セクタ407が使用されると、セクタ406が示すファイルと新たに作成されるファイルとが同時にセクタ407を使用するリンク交差状態が発生する。また、図4(b)に示すように、新規作成されるファイルのセクタの連結の順番がセクタ411、412の後、セクタ413、414のように配置されていて、セクタ413まで更新された状態で停電が発生すると、セクタ410が空セクタを指すことにより、上述のリンク交差状態が発生する可能性が生まれるとともに、2つのセクタ413、414はどのファイルにも使用されず、ディレクトリに登録されている全てのファイルを削除しても使用中のまま残るので、利用できるデータ記憶部103のサイズが小さくなるという問題が発生する。これらの問題を解消するのが本実施例である。
【0023】
次に、本実施例に係るファイル記憶装置の動作を図5を用いて説明する。図5(a)、(b)、(c)は第1、第2のファイル情報管理部101、102のデータ状態図である。本実施例ではファイル情報管理部が第1のファイル情報管理部101、第2のファイル情報管理部102というように2重化され、図3のステップ16のファイルクローズのキャッシュ掃き出し通知の処理の際に、第1のファイル情報管理部101のディレクトリ500、FAT501、第2のファイル情報管理部102のディレクトリ502、FAT503のように、順次に書込みを行う。このため、書込み中に停電が発生しても、障害発生個所は図5(b)のFAT504のように1か所に限定されることになる。この場合、停電復旧後、初期診断部107で、第1のファイル情報管理部101、第2のファイル情報管理部102の全ファイルのセクタ連結状態の検査と、ファイルに使用されていないセクタが空であるかどうかを検査して、空のセクタ504を発見し、第2のファイル情報管理部102の内容を第1のファイル情報管理部101のファイル一面に複写することにより、ファイル作成前の状態に戻すことができる。逆に、図5(c)に示すように、障害個所が第2のファイル情報管理部102のFAT506に発見された場合は、更新が完了している第1のファイル情報管理部101の内容(対応するFAT506の内容)を第2のファイル情報管理部102に複写することにより、新規作成されたファイルが正しく連結された状態で再現することができる。
【0024】
以上のように本実施例によれば、第1のファイル情報管理部101、第2のファイル情報管理部102のいずれか一方にファイル内容の誤りを検出した場合には誤りの無いファイル情報管理部のデータを誤りを検出したファイル情報管理部に複写して訂正するようにしたので、ファイル作成以前または以後の完全なファイルを使用して誤りを検出したファイル内容を訂正でき、中途半端なファイルを作成することがない。さらに、一方のファイル情報管理部が破壊されても、破壊されていない方のファイル内容で複写することにより、同様に訂正可能である。
【0025】
【発明の効果】
以上のように本発明は、ファイル名と先頭セクタ番号とセクタ連結順番とデータサイズとを記憶するファイル情報管理部と、ファイル情報管理部と同一種類のデータを保持するキャッシュ部と、キャッシュ部を制御するファイル制御部とを備えたことにより、データの書き込み完了時にキャッシュ部のデータをファイル情報管理部に書き込むようにすることができるので、データ書込み完了まではファイル情報管理部の内容にはなんら変更が加えられず、途中で停電や主装置の障害が発生しても、ファイル情報管理部にはなんら影響は及ばず、従ってファイル情報管理部において不完全なファイルが作成されることのないファイル記憶装置を実現することができる。また、装置自体は2重化されないので、小型化、低コスト化が可能なファイル記憶装置を実現することができる。
【0026】
また、ファイル制御部により、セクタに対するデータの書き込み完了時にキャッシュ部のデータをファイル情報管理部に書き込むことにより、データ書込みが完了するまでに停電や主装置の障害が発生しても、ファイル情報管理部にはなんら影響が及ばないようにすることができ、ファイル情報管理部において不完全なファイルが作成されることのないファイル記憶装置を実現することができる。
【0027】
さらに、ファイル名と先頭セクタ番号とセクタ連結順番とデータサイズとを記憶する第1と第2のファイル情報管理部と、第1のファイル情報管理部と同一種類のデータを保持し、データ書込み完了時に第1、第2のファイル情報管理部の内容を順次更新するキャッシュ部と、起動時に第1および第2のファイル情報管理部のいずれか一方にファイル内容の誤りを検出した場合には誤りの無いファイル情報管理部のデータを誤りを検出したファイル情報管理部に複写して訂正する初期診断部とを備えたことにより、ファイル作成以前つまりファイル更新以前またはファイル作成以後つまりファイル更新以後の完全なファイルを使用して誤りを検出したファイル内容を訂正できるので、中途半端なファイルを作成することのないファイル記憶装置を実現することができる。また、装置自体は2重化されないので、小型化、低コスト化が可能なファイル記憶装置を実現することができる。
【図面の簡単な説明】
【図1】本発明の一実施例に係るファイル記憶装置を示すブロック図
【図2】第1のファイル情報管理部、第2のファイル情報管理部およびデータ記憶部を示すデータ状態図
【図3】ファイル記憶装置の動作を説明するための動作手順図
【図4】(a)は第1のファイル情報管理部のデータ状態図(b)は第2のファイル情報管理部のデータ状態図
【図5】(a)、(b)、(c)は第1、第2のファイル情報管理部のデータ状態図
【図6】従来のファイル記憶装置を示すブロック図
【符号の説明】
100 ファイル記憶装置
101 第1のファイル情報管理部
102 第2のファイル情報管理部
103 データ記憶部
104 キャッシュ部
105 ファイル制御部
106 データ転送部
107 初期診断部
108 アプリケーション部
[0001]
[Industrial application fields]
The present invention relates to a file storage device using a magnetic material or a semiconductor memory and capable of writing and reading a plurality of variable length data at any time.
[0002]
[Prior art]
Conventionally, large capacity read / write external storage devices have been used for computer program storage and data storage. In these external storage devices, a characteristic of the storage medium is that the storage medium can be classified into a small capacity such as several hundred bytes to several kilobytes (hereinafter referred to as "sector" ”), Which is used as a read / write unit, and a plurality of sectors are concatenated and used to enable variable length data storage. Further, a configuration is generally used in which a file name is assigned to variable length data and a plurality of variable length files can be stored. As described above, in a large-capacity external storage device, a technique for storing a plurality of variable-length data by sector division has been established. However, as described above, a storage medium can be read and written as needed in units of sectors. A magnetic disk is the mainstream as a large-capacity storage medium that meets the specifications. However, due to recent improvements in the integration of non-volatile semiconductor memories, development of memory cards with a storage capacity of several tens of megabytes called flash ROM has progressed, making them smaller, lighter and more resistant to mechanical shock than magnetic disks. Because of this feature, it has become possible to consider using it as an external storage device. Taking advantage of the above features, these memory cards are being introduced as external storage devices for portable computers and industrial equipment with severe operating conditions.
[0003]
A conventional file storage device will be described below with reference to the drawings.
FIG. 6 is a block diagram showing a conventional file storage device 600. In FIG. 6, reference numeral 601 manages the use status of sectors in the data storage unit 602, which will be described later, and also manages variable length data by managing the size of each data, the head sector number, and the file name that is the identifier of each data. A plurality of file information management units 602, a data storage unit 602 that stores data divided into small sector sectors, and 603, an application described later when reading and writing to the data storage unit 602, which is a storage medium, is slow A cache unit 604 that temporarily stores a copy of the contents of the file information management unit 601 and the data storage unit 602 in a semiconductor memory with a short read / write response time in each stage in order to speed up the response time from the unit 606 to the read / write Is a sector necessary for creating a new file in response to an instruction from the application unit 606 described later. A file control unit 605 for acquiring, concatenating, data size, and storing a file name; after an application unit 606 described later instructs the file control unit 604 to create a new file, the data to be actually stored is transferred, A data transfer unit 606 to be written in the data storage unit 602 is an application unit on the main apparatus that instructs the file control unit 604 to create a new file.
[0004]
A method of using the file storage device configured as described above will be described.
[0005]
As a method of using the cache unit 603, in the case of writing, a write-through method in which data is written to the cache unit 603 and immediately written to the data storage unit 602, and writing is performed only in the cache unit 603, and write data is not updated for a certain period of time. There is a write back method for writing to the data storage unit 602. In the case of reading, there is a method of reading the content of the cache unit 603 instead of the content of the data storage unit 602 when the data of the sector designated to be read is stored in the cache unit 603. It is a common method. In the above write-through method, only the reading time is shortened, and in the write-back method, both the reading time and the writing time are shortened. In addition, when important data is stored in such a file storage device, by duplicating the file storage device and storing data simultaneously in two devices, even if one device fails, the other Methods are used to prevent data loss by using devices.
[0006]
[Problems to be solved by the invention]
However, in the conventional file storage device, the file name and data size are written to the file information management unit 601 on the storage medium during data writing, and the sector state is also changed. When the writing process cannot be continued due to the occurrence, data that has not been written is also created as a file. In addition, these data cannot be distinguished whether or not the writing is incomplete unless measures such as taking a checksum are taken, and in the case of means for taking the checksum, the configuration becomes complicated, resulting in high cost and large size. It was. In addition, since the file information management unit 601 is not duplicated in a single device, if a similar failure occurs during the update of the file information management unit 601 after data writing is complete, an inconsistency in the sector connection state occurs. In addition to the file being written, the management information of other files was destroyed. Further, when using the write back cache unit, writing from the cache unit to the file information management unit 601 is also delayed, which increases the risk of file destruction due to a power failure or the like. . Further, the method of duplicating the device itself is effective for the failure of the device itself, but has a problem that the cost is increased and the size is increased.
[0007]
The present invention solves the above-mentioned conventional problems, and provides a small and low-cost file storage device that does not create an incomplete file even if a power failure or a main device failure occurs during writing. With the goal.
[0008]
[Means for Solving the Problems]
In order to achieve this object, a file storage device and a writing method thereof according to the first invention of the present invention include :
A file storage device having a readable / writable storage medium composed of sectors each having a plurality of bytes as a unit, the file storing the file name, head sector number, sector connection order, and data size arranged on the storage medium and a data storage unit for storing the information management unit and the data, a cache unit that holds the same type of data and file information managing unit updates the contents of a file in the file information managing unit, the data between the data storage unit A data transfer unit that reads / writes the data, writes data in the data transfer unit to the data storage unit when a write request is received from the main unit, and stores data in the cache unit when a write completion is notified from the main unit The present invention relates to a file control apparatus and a method for writing the file control apparatus, wherein the file control apparatus writes to an information management unit .
[0010]
According to a second aspect of the present invention, there is provided a file storage device and a writing method therefor , comprising: a file storage device having a readable / writable storage medium comprising sectors each having a plurality of bytes as a unit, the file being arranged on the storage medium and a first data storage unit for storing a file information management unit and the data of the second to store the name and the top sector number and sector connecting order and data size, the first file information managing unit of the same type A cache unit that holds the data of the first file information management unit and updates the file contents of the first file information management unit, a data transfer unit that reads and writes data between the data storage unit, and first and second file information at startup file information detected errors data of another file information managing unit error-free if it detects an error in the file content to one of the management unit And a initial diagnosis unit for correcting are copied to processing section writes the data in the data transfer unit when requested to write from the main unit to the data storage unit, the cache unit when notified of the completion of the writing from the main unit Is written in the first information management unit, and an error is detected and corrected by the initial diagnosis unit at the time of activation.
[0011]
[Action]
With this configuration, the file control unit can write the data of the cache unit to the file information management unit when the data writing is completed, so no change is made to the file information management unit until the data writing is completed, If a power failure or main unit failure occurs during the process, an incomplete file will not be created. Further, the apparatus itself is not duplicated, and downsizing and cost reduction are achieved.
[0012]
If an error in the file contents is detected in either the first or second file information management unit, the data in the file information management unit without error is copied to the file information management unit in which the error is detected and corrected. As a result, it is possible to correct the file contents in which an error is detected using a complete file before or after the file is created, and a halfway file is not created. Further, even if one of the file information management units is destroyed, it can be corrected in the same manner by copying the content of the file that has not been destroyed. Furthermore, the apparatus itself is not duplicated, and downsizing and cost reduction are achieved.
[0013]
【Example】
(Example 1)
Hereinafter, a file storage device according to an embodiment of the present invention will be described with reference to the drawings.
[0014]
FIG. 1 is a block diagram showing a file storage device 100 according to an embodiment of the present invention.
[0015]
In FIG. 1, 101 is a first file information management unit that manages data on the data storage unit 103, 102 is a second file information management unit that holds the same type of data as the first file information management unit 101, Reference numeral 104 denotes a semiconductor memory having a high read / write speed and holds the entire contents of the first file information management unit 101. Reference numeral 105 denotes a process when a file read / write is requested from the application unit 108 on the main apparatus. A file control unit 106 performs data reading / writing with the data storage unit 103 and reads / writes data designated by the application unit 108, and 107 detects and corrects file content errors when the file storage device 100 is started up. It is an initial diagnosis part. The first file information management unit 101, the second file information management unit 102, and the data storage unit 103 are arranged on a storage medium.
[0016]
A method of storing a plurality of variable length data in the file storage device configured as described above will be described. FIG. 2 is a data state diagram showing the first file information management unit 101, the second file information management unit 102, and the data storage unit 103. As in the conventional example, the data storage unit 103 is obtained by dividing a storage medium into small sections and assigning them. In this embodiment, the data storage unit 103 is composed of 12 sectors of 512 bytes per sector, and file names of file 1b and file 2b are assigned to two data having a data size of 200 bytes and 600 bytes, respectively. A case where data is stored in the data storage unit 103 will be described. As shown in FIG. 2, the first file information management unit 101 has a directory 1 and a file allocation table (FAT) 1a. The directory 1 has the data sizes of the files 1b and 2b in the areas 1101 and 201 and the data sizes in the areas 1102 and 202. 200, 600, and head sector numbers 211 and 212 of the area 1103. The second file information management unit 102 has a directory 2 and a file allocation table (FAT) 2a. The second file information management unit 102 will be described in the second embodiment. Since the file 1b has a data size of 200 bytes and fits within one sector (512 bytes), it is stored as the sector number 211 on the FAT 1a. However, since the file 2b has a data size of 600 bytes, a 512-byte sector is stored. Are required, the next sector number 213 is written in the sector 212 on the FAT 1a, and FF is written in the last sector 213 as the mark.
[0017]
In the file storage device 100 having such a configuration, an operation when the file 2b of FIG. 2 is newly written from the application unit of the main device to the file storage device will be described with reference to FIG. FIG. 3 is an operation procedure diagram for explaining the operation of the file storage device 100. 3, 101 is a first file information management unit, 103 is a data storage unit, 104 is a cache unit, 105 is a file control unit, 106 is a data transfer unit, and 108 is an application unit, which are the same as in FIG. Therefore, the same reference numerals are given and the description is omitted. First, the file control unit 105 that has received an open request instructing creation of a new file from the application unit 108 searches for an area for storing a new file in the directory area on the cache unit 104 (S1, S2), and an empty area. If there is, the file name designated by the application unit 108 is registered in the region 201 as shown in FIG. 2, “0” is registered in the region 202 as the initial value of the data size, and the application unit 108 is acknowledged. An open confirmation is returned (S3). After receiving the open confirmation, the application unit 108 issues a 200-byte write request to the data transfer unit 106 (S4, S5). The data transfer unit 106 searches for an empty sector 212 (see FIG. 2) necessary for storage, writes it in the first sector number area 203 of the directory 1 (S6), adds the file length 200 to the data size area 202, and is requested to write. 200 bytes of stored data are held (S7).
[0018]
Next, the application unit 108 makes a 200-byte write request again (S8). This is a total 400 bytes write request (accumulation size), but since this accumulation size does not exceed 512 bytes for one sector, it is accumulated in the data transfer unit 106 (S9, S10). Next, when receiving the third 200-byte write request, 512 bytes for one sector are written to the data storage unit 103 on the storage medium (S11). The remaining 88 bytes of the 200 bytes are held in the data transfer unit 106 (S12). In order to hold the 88 bytes, a new empty sector 213 (see FIG. 2) is searched for, and the empty sector 212 is stored. The sector number 213 is written (S13). Finally, when the file control unit 105 receives a close notification informing the completion of writing from the application unit 108, the remaining data of the data transfer unit 106 is written into the data storage unit 103 (S15) and the first file Data of the content held in the cache unit 104 is written into the information management unit 101 (S16).
[0019]
As described above, according to the present embodiment, the data of the cache unit 104, which is management information such as the file name and file length, is written to the first file information management unit 101 when data writing to the sector is completed. No changes are made to the contents of the first file information management unit 101 until the data writing is completed, and even if a power failure or a failure of the main unit occurs in the middle, there is no effect on the first file information management unit 101. Therefore, the first file information management unit 101 does not create an incomplete file. If a power failure or main device failure occurs in the middle, file creation will be started again.
[0020]
(Example 2)
The file storage device according to the second embodiment of the present invention will be described below. The file storage device according to this embodiment has the same configuration as that shown in FIG. In the first embodiment, the second file information management unit 102 is not used (see FIG. 3), but in the present embodiment, the second file information management unit 102 is used. That is, the file information management unit is duplicated into the first file information management unit 101 and the second file information management unit 102.
[0021]
First, data destruction that occurs when a power failure occurs during the file writing completion process in steps 15 and 16 of FIG. 3 will be described with reference to FIG. 4A is a data state diagram of the first file information management unit 101, and FIG. 4B is a data state diagram of the second file information management unit 102. 4A and 4B, 400 and 401 are directories, 402 to 404 are file allocation tables, and 405 to 414 are sectors.
[0022]
In FIG. 4A, the data writing of the file using the sectors 405, 406, 407, and 408 is completed, and the directory for the first file information management unit 101 is notified by the cache flush notification of the close notification in step 16 of FIG. If a power failure occurs when the writing of 400, 401 and FAT 402 is completed, sector 407 pointed to by sector 406 remains in the previous empty state, and this file remains disconnected at 406. In this state, after the power failure is restored and a new file is created and the sector 407 is used, the file indicated by the sector 406 and the newly created file simultaneously use the sector 407. Will occur. Further, as shown in FIG. 4B, the sector linkage order of the newly created file is arranged as sectors 413 and 414 after the sectors 411 and 412, and the sector 413 is updated. When a power outage occurs, the sector 410 points to an empty sector, which may cause the above-mentioned link crossing condition, and the two sectors 413 and 414 are not used for any file and are registered in the directory. Even if all existing files are deleted, they remain in use, so that there is a problem that the size of the usable data storage unit 103 is reduced. The present embodiment solves these problems.
[0023]
Next, the operation of the file storage device according to the present embodiment will be described with reference to FIG. 5A, 5B, and 5C are data state diagrams of the first and second file information management units 101 and 102. FIG. In this embodiment, the file information management unit is duplicated such as the first file information management unit 101 and the second file information management unit 102, and at the time of processing of the file close cache flush notification in step 16 of FIG. In addition, writing is sequentially performed like the directory 500 and the FAT 501 of the first file information management unit 101 and the directory 502 and the FAT 503 of the second file information management unit 102. For this reason, even if a power failure occurs during writing, the location where a failure has occurred is limited to one place, such as FAT 504 in FIG. In this case, after the power failure is restored, the initial diagnosis unit 107 checks the sector connection status of all the files in the first file information management unit 101 and the second file information management unit 102, and empty sectors are not used for the file. Is detected, the empty sector 504 is found, and the contents of the second file information management unit 102 are copied to the entire file of the first file information management unit 101, so that the state before the file is created Can be returned to. On the other hand, as shown in FIG. 5C, when a faulty part is found in the FAT 506 of the second file information management unit 102, the contents of the first file information management unit 101 that has been updated ( By copying the content of the corresponding FAT 506) to the second file information management unit 102, it is possible to reproduce the newly created file in a correctly linked state.
[0024]
As described above, according to the present embodiment, when an error in the file contents is detected in either the first file information management unit 101 or the second file information management unit 102, there is no error in the file information management unit. Since the file data was copied to the file information management unit that detected the error and corrected, the file contents that detected the error can be corrected using the complete file before or after the file was created. Never created. Further, even if one of the file information management units is destroyed, it can be corrected in the same manner by copying the content of the file that has not been destroyed.
[0025]
【The invention's effect】
As described above, the present invention includes a file information management unit that stores a file name, a head sector number, a sector connection order, and a data size, a cache unit that holds the same type of data as the file information management unit, and a cache unit. By providing a file control unit for controlling, the data in the cache unit can be written into the file information management unit when the data writing is completed, so there is no content in the file information management unit until the data writing is completed. A file that is not changed and does not affect the file information management unit even if a power failure or main unit failure occurs in the middle, so an incomplete file is not created in the file information management unit A storage device can be realized. Also, since the device itself is not duplicated, a file storage device that can be reduced in size and cost can be realized.
[0026]
In addition, the file control unit writes the data in the cache unit to the file information management unit when the writing of data to the sector is completed, so that even if a power failure or failure of the main unit occurs before the data writing is completed, the file information management The file information management unit can realize a file storage device in which an incomplete file is not created.
[0027]
Furthermore, the first and second file information management units that store the file name, the first sector number, the sector connection order, and the data size, and the same type of data as the first file information management unit are held, and the data writing is completed If an error in the file content is detected in either the cache unit that sequentially updates the contents of the first and second file information management units or the first and second file information management units at startup By providing an initial diagnosis unit that copies and corrects the data of the missing file information management unit to the file information management unit that detected the error, it is possible to complete the file before file creation, that is, before file update, or after file creation, that is, after file update. File storage device that does not create a half-finished file because it can correct the contents of the file that detected the error using the file. It can be realized. Also, since the device itself is not duplicated, a file storage device that can be reduced in size and cost can be realized.
[Brief description of the drawings]
FIG. 1 is a block diagram illustrating a file storage device according to an embodiment of the present invention. FIG. 2 is a data state diagram illustrating a first file information management unit, a second file information management unit, and a data storage unit. FIG. 4A is a data state diagram of the first file information management unit, and FIG. 4B is a data state diagram of the second file information management unit. 5 (a), (b), and (c) are data state diagrams of the first and second file information management units. FIG. 6 is a block diagram showing a conventional file storage device.
DESCRIPTION OF SYMBOLS 100 File storage device 101 1st file information management part 102 2nd file information management part 103 Data storage part 104 Cache part 105 File control part 106 Data transfer part 107 Initial diagnosis part 108 Application part

Claims (4)

複数のバイトを1単位とするセクタから成る読み書き可能な記憶媒体を有するファイル記憶装置の書き込み方法であって、
前記記憶媒体上に配置された、ファイル名と先頭セクタ番号とセクタ連結順番とデータサイズとを記憶するファイル情報管理部と、データを記憶するデータ記憶部とを有し、
前記ファイル情報管理部と同一種類のデータを保持し前記ファイル情報管理部のファイル内容を更新するキャッシュ部と、前記データ記憶部との間でデータの読み出し書き込みを行うデータ転送部とを有し、
主装置から書き込みを要求された時前記データ転送部のデータを前記データ記憶部に書き込む書き込み要求ステップと、主装置から書き込みの完了を通知された時前記キャッシュ部のデータを前記情報管理部に書き込むクローズ通知ステップとを有することを特徴とするファイル記憶装置の書き込み方法。
A method of writing a file storage device having a readable / writable storage medium composed of sectors each having a plurality of bytes as a unit,
A file information management unit for storing a file name, a head sector number, a sector connection order, and a data size, and a data storage unit for storing data, which are arranged on the storage medium;
Includes a cache unit to update the contents of a file in the file information managing unit retains the file information managing unit of the same type of data, and a data transfer unit for reading data from and writing data to and from the data storage unit ,
Write request step for writing data in the data transfer unit to the data storage unit when writing is requested from the main unit, and writing the data in the cache unit to the information management unit when notified of completion of writing from the main unit A file storage device writing method comprising: a close notification step.
複数のバイトを1単位とするセクタから成る読み書き可能な記憶媒体を有するファイル記憶装置の書き込み方法であって、
前記記憶媒体上に配置された、ファイル名と先頭セクタ番号とセクタ連結順番とデータサイズとを記憶する第1と第2のファイル情報管理部と、データを記憶するデータ記憶部とを有し、
前記第1のファイル情報管理部と同一種類のデータを保持し前記1のファイル情報管理部のファイル内容を更新するキャッシュ部と、
前記データ記憶部との間でデータの読み出し書き込みを行うデータ転送部と、
起動時に前記第1および前記第2のファイル情報管理部のいずれか一方にファイル内容の誤りを検出した場合には誤りの無い他のファイル情報管理部のデータを誤りを検出したファイル情報管理部に複写して訂正する初期診断部とを有し、
主装置から書き込みを要求された時前記データ転送部のデータを前記データ記憶部に書き込む書き込み要求ステップと、主装置から書き込みの完了を通知された時前記キャッシュ部のデータを前記第1の情報管理部に書き込むクローズ通知ステップと、起動時に前記初期診断部により誤り検出と訂正とを行う初期診断ステップとを有することを特徴とするファイル記憶装置の書き込み方法。
A method of writing a file storage device having a readable / writable storage medium composed of sectors each having a plurality of bytes as a unit,
It has the disposed on the storage medium, the first and the file information managing section and the second storing the file name and the start sector number and the sector coupling order and data size, a data storage unit for storing data ,
A cache unit to update the contents of a file in the first file information managing unit retains the same type of data and the first file information management unit,
A data transfer unit that reads and writes data to and from the data storage unit;
In the file information managing unit which detects an error of the data of other file information managing unit error-free if it detects an error in the file content to one of said first and said second file information management unit at start An initial diagnosis unit that copies and corrects ,
A write request step for writing data of the data transfer unit to the data storage unit when a write request is made from the main unit; and a first information management of the data of the cache unit when a completion of writing is notified from the main unit A file storage device writing method, comprising: a close notification step for writing to a storage unit; and an initial diagnosis step for performing error detection and correction by the initial diagnosis unit at startup.
複数のバイトを1単位とするセクタから成る読み書き可能な記憶媒体を有するファイル記憶装置であって、
前記記憶媒体上に配置された、ファイル名と先頭セクタ番号とセクタ連結順番とデータサイズとを記憶するファイル情報管理部と、データを記憶するデータ記憶部とを有し、
前記ファイル情報管理部と同一種類のデータを保持し前記ファイル情報管理部のファイル内容を更新するキャッシュ部と、前記データ記憶部との間でデータの読み出し書き込みを行うデータ転送部とを有し、
主装置から書き込みを要求された時前記データ転送部のデータを前記データ記憶部に書き込み、主装置から書き込みの完了を通知された時前記キャッシュ部のデータを前記情報管理部に書き込むことを特徴とするファイル記憶装置。
A file storage device having a readable / writable storage medium composed of sectors each having a plurality of bytes as a unit,
A file information management unit for storing a file name, a head sector number, a sector connection order, and a data size, and a data storage unit for storing data, which are arranged on the storage medium;
Includes a cache unit to update the contents of a file in the file information managing unit retains the file information managing unit of the same type of data, and a data transfer unit for reading data from and writing data to and from the data storage unit ,
The data of the data transfer unit is written into the data storage unit when writing is requested from the main device, and the data of the cache unit is written into the information management unit when notified of completion of writing from the main device. File storage device.
複数のバイトを1単位とするセクタから成る読み書き可能な記憶媒体を有するファイル記憶装置であって、
前記記憶媒体上に配置された、ファイル名と先頭セクタ番号とセクタ連結順番とデータサイズとを記憶する第1と第2のファイル情報管理部と、データを記憶するデータ記憶部とを有し、
前記第1のファイル情報管理部と同一種類のデータを保持し前記1のファイル情報管理部のファイル内容を更新するキャッシュ部と、
前記データ記憶部との間でデータの読み出し書き込みを行うデータ転送部と、
起動時に前記第1および前記第2のファイル情報管理部のいずれか一方にファイル内容の誤りを検出した場合には誤りの無い他のファイル情報管理部のデータを誤りを検出したファイル情報管理部に複写して訂正する初期診断部とを有し、
主装置から書き込みを要求された時前記データ転送部のデータを前記データ記憶部に書 き込み、主装置から書き込みの完了を通知された時前記キャッシュ部のデータを前記第1の情報管理部に書き込むと共に、起動時に前記初期診断部により誤り検出と訂正とを行うことを特徴とするファイル記憶装置。
A file storage device having a readable / writable storage medium composed of sectors each having a plurality of bytes as a unit,
It has the disposed on the storage medium, the first and the file information managing section and the second storing the file name and the start sector number and the sector coupling order and data size, a data storage unit for storing data ,
A cache unit to update the contents of a file in the first file information managing unit retains the same type of data and the first file information management unit,
A data transfer unit that reads and writes data to and from the data storage unit;
In the file information managing unit which detects an error of the data of other file information managing unit error-free if it detects an error in the file content to one of said first and said second file information management unit at start An initial diagnosis unit that copies and corrects ,
Inclusive can write the data of the data transfer unit to the data storage unit when requested to write from the main unit, the first information management section data of the cache unit when notified of the completion of the writing from the main unit A file storage device wherein writing and error detection and correction are performed by the initial diagnosis unit at startup .
JP22983495A 1995-09-07 1995-09-07 File storage device Expired - Fee Related JP3620110B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP22983495A JP3620110B2 (en) 1995-09-07 1995-09-07 File storage device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP22983495A JP3620110B2 (en) 1995-09-07 1995-09-07 File storage device

Publications (2)

Publication Number Publication Date
JPH0973369A JPH0973369A (en) 1997-03-18
JP3620110B2 true JP3620110B2 (en) 2005-02-16

Family

ID=16898409

Family Applications (1)

Application Number Title Priority Date Filing Date
JP22983495A Expired - Fee Related JP3620110B2 (en) 1995-09-07 1995-09-07 File storage device

Country Status (1)

Country Link
JP (1) JP3620110B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010092239A (en) * 2008-10-07 2010-04-22 Alpine Electronics Inc File system managing apparatus

Also Published As

Publication number Publication date
JPH0973369A (en) 1997-03-18

Similar Documents

Publication Publication Date Title
US5086502A (en) Method of operating a data processing system
US5089958A (en) Fault tolerant computer backup system
JP4268396B2 (en) Non-volatile memory device file management that can be programmed once
JP4037605B2 (en) Nonvolatile memory unit controller, memory system having the controller, and nonvolatile memory unit control method
EP0997900B1 (en) Method and apparatus for recording and reproducing information on and from disk
US6311193B1 (en) Computer system
JP2719464B2 (en) File management system
US5974426A (en) Device and method for data recovery in a file system
JP3682256B2 (en) Disk array device and parity processing method in the same
US6950918B1 (en) File management of one-time-programmable nonvolatile memory devices
US7277997B2 (en) Data consistency for mirroring updatable source data storage
KR20020028624A (en) Method for driving remapping for flash memory and flash memory architecture thereto
JP2007200182A (en) Storage device and storage system
US20030105921A1 (en) Disk array apparatus and data restoring method used therein
AU633775B2 (en) A method of operating a data processing system
US5590298A (en) Method of restoring and updating records in a disk cache system during disk drive idle time using start and end addresses
US20030131163A1 (en) Disk control apparatus, disk control method, remote disk control apparatus, and remote disk control method
JP4825433B2 (en) Computing device with relatively limited storage space and operating system / file system thereof
JP3620110B2 (en) File storage device
JP4248164B2 (en) Disk array error recovery method, disk array control device, and disk array device
JP3898968B2 (en) Information recording method and information recording system
JP2001101087A (en) Memory and memory control method
EP1359500B1 (en) File management of one-time-programmable nonvolatile memory devices
JP3957464B2 (en) Data update device
JP3790756B2 (en) Disk array device, disk controller, and method for recovering data failure in disk array

Legal Events

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20041026

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20041108

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

Free format text: PAYMENT UNTIL: 20071126

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20081126

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20091126

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20091126

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20101126

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20111126

Year of fee payment: 7

LAPS Cancellation because of no payment of annual fees