JP3818130B2 - Data management method and apparatus, data management program, and storage medium storing data management program - Google Patents

Data management method and apparatus, data management program, and storage medium storing data management program Download PDF

Info

Publication number
JP3818130B2
JP3818130B2 JP2001349184A JP2001349184A JP3818130B2 JP 3818130 B2 JP3818130 B2 JP 3818130B2 JP 2001349184 A JP2001349184 A JP 2001349184A JP 2001349184 A JP2001349184 A JP 2001349184A JP 3818130 B2 JP3818130 B2 JP 3818130B2
Authority
JP
Japan
Prior art keywords
area
flag
data
read
completed
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 - Lifetime
Application number
JP2001349184A
Other languages
Japanese (ja)
Other versions
JP2003150441A (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.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
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 Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2001349184A priority Critical patent/JP3818130B2/en
Publication of JP2003150441A publication Critical patent/JP2003150441A/en
Application granted granted Critical
Publication of JP3818130B2 publication Critical patent/JP3818130B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、データ管理方法及び装置及びデータ管理プログラム及びデータ管理プログラムを格納した記憶媒体に係り、特に、データ更新による状態遷移に方向性の制限がある逆方向に遷移するために、一旦、消去という処理によって状態を初期状態へ戻すことが必要であるという特性を持った記憶装置におけるデータ管理方法及び装置及びデータ管理プログラム及びデータ管理プログラムを格納した記憶媒体に関する。
【0002】
【従来の技術】
第1の従来の技術として、カベージコレクションのために、専用領域を1つ以上用意しておき、現在使用している領域に、使用できる領域が全くなくなったときに、現在使用している領域から必要なデータのみをコピーし、現在使用している領域を消去し、初期化済領域とした後、専用領域上のデータを再度、初期化済領域へ書き戻す方法がある。
【0003】
第2の従来の技術として、ガベージコレクションのために、常に1つ以上の未使用ブロックを用意しておき、現在使用しているブロックに、使用できる領域が全くなくなったときに、現在使用しているブロックから必要なデータのみを、未使用ブロックへコピーし、最後に現在使用しているブロックを消去し、新たな未使用ブロックとする方法がある。
【0004】
【発明が解決しようとする課題】
しかしながら、上記第1の従来の技術では、現在使用している領域のデータを、一旦、専用領域へコピーし、再度、初期化済の領域へ書き戻す必要がある。さらに、専用領域も、その都度消去する必要があるため、ガベージコレクションが必要になった場合、専用領域上のデータを書き戻す前に、新たにカベージコレクションの領域のデータを破壊してしまう可能性がある。
【0005】
また、上記第2の従来の技術で、データを格納する領域と管理情報を管理する領域を、別々の領域に分けている。さらに、コピーの際には、単に対象となるデータのみをコピーするのではなく、そのデータの参照先を管理する別の領域のデータも同時に更新する必要がある。このとき、ガベージコレクションのめにデータを移動後、参照先を管理する別の領域のデータを更新中に電源断などにより障害が発生した場合、復帰後、データの参照先が必ずしも正しいデータではない可能性がある。
【0006】
データ更新による状態遷移に方向性の制限がある記憶装置、例えば、初期状態が、“1”の状態の記憶装置では、“0”から“0”、“1”から“0”及び、“1”から“1”へは遷移できるが、“0”から“1”には変化できないという特性を持つ。逆方向に遷移するために、一旦、消去という処理によって、記憶装置の状態を初期状態へ戻すことが必要である。このようなデータの更新の方向性に対処するために、データ更新は、元のデータ領域を更新するのではなく、新しいデータを書き込む、追記と呼ばれる操作によって行なわれる。
【0007】
そのような追記操作を繰り返すことにより、その領域にさらにデータを追記するための領域が確保できなくなる状態に陥るが、その場合はカベージコレクションと呼ばれる処理を行なうことにより、領域内の空き領域が確保される。
【0008】
ガベージコレクションでは、
1)領域内の必要なデータのみを領域へコピーする;
2)もとの領域に対して消去操作を行う;
3)コピーしていたデータを書き戻す;
という3つの操作が必要になる。しかし、もとの領域に対して行なわれる消去操作では、消去対象となる領域は消去ブロックと呼ばれ、数KBから数10KBの単位で行なわれるため、1秒程度の時間を要する。このため、ガベージコレクションは非常に時間的コストのかかる処理となる。
【0009】
さらに、別のガベージコレクションの方法として、ガベージコレクションのために、常に1つ以上の未使用領域を用意しておき、
1)元の領域内の必要なデータのみを、未使用領域へのコピー;
2)消去ブロックに対して消去を行なう;
という操作を行なうものがある。
【0010】
しかし、この方法では、ガベージコレクション実行前後で、データが格納される物理的位置が変化するため、データの参照先を管理する領域が必要である。従って、電源断等によりこの管理領域のデータ更新が成功しなかった場合、ガベージコレクションによってデータの参照先が変化したにもかかわらず、参照先を管理する領域が更新されていないため、正しいデータの参照ができなくなる危険がある。
【0011】
本発明は、上記の点に鑑みなされたもので、ガベージコレクションを高速に行なうことを可能とし、ガベージコレクション処理中の如何なるじてにおける勝利障害からでも復帰可能なデータ管理方法及び装置及びデータ管理プログラム及びデータ管理プログラムを格納した記憶媒体を提供することを目的とする。
【0012】
【課題を解決するための手段】
図1は、本発明の原理を説明するための図である。
【0014】
本発明(請求項)は、データ更新による状態遷移に方向性の制限がある逆方向に遷移するために、一旦、消去という処理によって状態を初期状態へ戻すことが必要であるという特性を持った記憶装置におけるデータ更新中に、任意の時点で処理が中断されてもデータの保護を可能とするデータ管理方法であって
上位装置からデータの読み出し要求を受信するステップ(ステップ1)と、
記憶装置の領域Aのフラグ及び領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、読み出し先の領域を決定するステップ(ステップ2)と、
決定した領域からデータを読み出して、上位装置に転送するステップ(ステップ3)と
上位装置からデータの書き込み要求を受信するステップ(ステップ4)と
記憶装置の領域A、領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、書き込み先の領域を決定するステップ(ステップ5)と、
決定した領域にデータを書き込むステップ(ステップ6)と、を行う方法において、
読み出し先の領域を決定するステップ(ステップ2)では、
記憶領域の領域Aのフラグが、A1,A2,A3,領域BのフラグがB1,B2,B3の状態をとり、該領域Aのフラグ及び該領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、読み出し先の領域を決定する際に、
領域Aのフラグが“A2”かつ、領域Bのフラグが“B1”ならば、該領域Aよりデータを読み出し、
領域Aのフラグが“A3”かつ、領域Bのフラグが“B1”ならば、該領域Aから必要なデータのみを該領域Bへコピーし、コピー完了後、該領域Bのフラグを“B2”へ変更し、該領域Aを消去し、消去完了後、該領域Bからデータを読み出し、
領域Aのフラグが“A3”かつ、領域Bのフラグが“B2”ならば、該領域Aを消去し、消去完了後、該領域Bからデータを読み出し、
領域Aのフラグが“A1”かつ、領域Bのフラグが“B2”ならば、該領域Bよりデータを読み出し、
領域Aのフラグが“A1”かつ、領域Bのフラグが“B3”ならば、該領域Bから必要なデータのみを該領域Aへコピーし、コピー完了後、該領域Aのフラグを“A2”へ変更し、該領域Bを消去し、消去完了後、該領域Aからデータを読み出し、
領域Aのフラグが“A2”かつ、領域Bのフラグが“B3”ならば、領域Bを消去し、消去完了後、該領域Aからデータを読み出す
【0016】
本発明(請求項)は、データ更新による状態遷移に方向性の制限がある逆方向に遷移するために、一旦、消去という処理によって状態を初期状態へ戻すことが必要であるという特性を持った記憶装置におけるデータ更新中に、任意の時点で処理が中断されてもデータの保護を可能とするデータ管理方法であって、
上位装置からデータの読み出し要求を受信するステップ(ステップ1)と、
記憶装置の領域Aのフラグ及び領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、読み出し先の領域を決定するステップ(ステップ2)と、
決定した領域からデータを読み出して、上位装置に転送するステップ(ステップ3)と
上位装置からデータの書き込み要求を受信するステップ(ステップ4)と
記憶装置の領域A、領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、書き込み先の領域を決定するステップ(ステップ5)と、
決定した領域にデータを書き込むステップ(ステップ6)と、を行う方法において、
書き込み先の領域を決定するステップ(ステップ5)では、
記憶装置の領域Aのフラグが、A1,A2,A3、領域BのフラグがB1,B2,B3の状態をとり、該領域Aのフラグ及び該領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、書き込み先の領域を決定する際に、
領域Aのフラグが“A2”かつ、領域Bのフラグが“B1”ならば、該領域Aにデータを書き込み、一方、該領域Aに新たにデータを書き込む領域が存在しない場合は、該領域Aのフラグを“A3”へ更新し、該領域Aから必要なデータのみを該領域Bへコピーし、コピー完了後、該領域Bのフラグを“B2”へ変更し、該領域Aを消去し、消去完了後、該領域Bに書き込み、
領域Aのフラグが“A3”かつ、領域Bのフラグが“B1”ならば、該領域Aから必要なデータのみを該領域Bへコピーし、コピー完了後、該領域Bのフラグを“B2”へ変更し、該領域Aを消去し、消去完了後、該領域Bにデータを書き込み、
領域Aのフラグが“A3”かつ、領域Bのフラグが“B2”ならば、該領域Aを消去し、消去完了後、領域Bにデータを書き込み、
領域Aのフラグが“A1”かつ、領域Bのフラグが“B2”ならば、該領域Bにデータを書き込み、一方、該領域Bに新たにデータを書き込む領域が存在しない場合は、該領域Bのフラグを“B3”へ更新し、該領域Bから必要なデータのみを該領域Aへコピーし、コピー完了後、該領域Aのフラグを“A2”へ変更し、該領域Bを消去し、消去完了後、該領域Aにデータを書き込み、
領域Aのフラグが“A1”かつ、領域Bのフラグが“B3”ならば、該領域Bから必要なデータのみを該領域Aへコピーし、コピー完了後、該領域Aのフラグを“A2”へ変更し、該領域Bを消去し、消去完了後、該領域Aにデータを書き込み、
領域Aのフラグが“A2”かつ、領域Bのフラグが“B3”ならば、該領域Bを消去し、消去完了後、該領域Aにデータを書き込む。
【0017】
図2は、本発明の原理構成図である。
【0019】
本発明(請求項)は、データ更新による状態遷移に方向性の制限がある逆方向に遷移するために、一旦、消去という処理によって状態を初期状態へ戻すことが必要であるという特性を持った記憶装置におけるデータ更新中に、任意の時点で処理が中断されてもデータの保護を可能とするデータ管理装置であって、
記憶装置内に、領域が使用中であるか待機中であるかの状態を示すフラグを持つデータ領域A、データ領域Bを有し、
上位装置からデータの読み出し要求及びデータの書き込み要求を受信する要求受信手段160と、
読み出し要求を受信すると、記憶装置の領域Aのフラグ及び領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、読み出し先の領域を決定する読み出し先領域制御手段135と、
読み出し先制御手段で決定した領域からデータを読み出して、上位装置に転送する読み出し手段130と、
書き込み要求を受信すると、記憶装置の領域A、領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、書き込み先の領域を決定する書き込み先領域制御手段145と、
書き込み先領域制御手段145で決定した領域にデータを書き込む書き込み手段140と、
を有し、
読み出し先領域制御手段135は、
記憶装置の領域Aのフラグが、A1,A2,A3、領域BのフラグがB1,B2,B3の状態をとるとき、
領域Aのフラグが“A2”かつ、領域Bのフラグが“B1”ならば、領域Aから読み出すよう制御する手段と、
領域Aのフラグが“A3”かつ、領域Bのフラグが“B1”ならば、該領域Aから必要なデータのみを該領域Bへコピーし、コピー完了後、該領域Bのフラグを“B2”へ変更し、該領域Aを消去し、消去完了後、該領域Bからデータを読み出すよう制御する手段と、
領域Aのフラグが“A3”かつ、領域Bのフラグが“B2”ならば、該領域Aを消去し、消去完了後、該領域Bからデータを読み出すよう制御する手段と、
領域Aのフラグが“A1”かつ、領域Bのフラグが“B2”ならば、該領域Bよりデータを読み出すよう制御する手段と、
領域Aのフラグが“A1”かつ、領域Bのフラグが“B3”ならば、該領域Bから必要なデータのみを該領域Aへコピーし、コピー完了後、該領域Aのフラグを“A2”へ変更し、該領域Bを消去し、消去完了後、該領域Aからデータを読み出すよう制御する手段と、
領域Aのフラグが“A2”かつ、領域Bのフラグが“B3”ならば、領域Bを消去し、消去完了後、該領域Aからデータを読み出すよう制御する手段と、を有する。
【0021】
本発明(請求項)は、データ更新による状態遷移に方向性の制限がある逆方向に遷移するために、一旦、消去という処理によって状態を初期状態へ戻すことが必要であるという特性を持った記憶装置におけるデータ更新中に、任意の時点で処理が中断されてもデータの保護を可能とするデータ管理装置であって、
記憶装置内に、領域が使用中であるか待機中であるかの状態を示すフラグを持つデータ領域A、データ領域Bを有し、
上位装置からデータの読み出し要求及びデータの書き込み要求を受信する要求受信手段160と、
読み出し要求を受信すると、記憶装置の領域Aのフラグ及び領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、読み出し先の領域を決定する読み出し先領域制御手段135と、
読み出し先制御手段135で決定した領域からデータを読み出して、上位装置に転送する読み出し手段130と、
書き込み要求を受信すると、記憶装置の領域A、領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、書き込み先の領域を決定する書き込み先領域制御手段145と、
書き込み先領域制御手段145で決定した領域にデータを書き込む書き込み手段140と、
を有し、
書き込み先領域制御手段145は、
記憶装置の領域Aのフラグが、A1,A2,A3、領域BのフラグがB1,B2,B3の状態をとるとき、
領域Aのフラグが“A2”かつ、領域Bのフラグが“B1”ならば、該領域Aにデータを書き込み、一方、該領域Aに新たにデータを書き込む領域が存在しない場合は、該領域Aのフラグを“A3”へ更新し、該領域Aから必要なデータのみを該領域Bへコピーし、コピー完了後、該領域Bのフラグを“B2”へ変更し、該領域Aを消去し、消去完了後、該領域Bに書き込むよう制御する手段と、
領域Aのフラグが“A3”かつ、領域Bのフラグが“B1”ならば、該領域Aから必要なデータのみを該領域Bへコピーし、コピー完了後、該領域Bのフラグを“B2”へ変更し、該領域Aを消去し、消去完了後、該領域Bにデータを書き込むよう制御する手段と、
領域Aのフラグが“A3”かつ、領域Bのフラグが“B2”ならば、該領域Aを消去し、消去完了後、該領域Bにデータを書き込むよう制御する手段と、
領域Aのフラグが“A1”かつ、領域Bのフラグが“B2”ならば、該領域Bにデータを書き込み、一方、該領域Bに新たにデータを書き込む領域が存在しない場合は、該領域Bのフラグを“B3”へ更新し、該領域Bから必要なデータのみを該領域Aへコピーし、コピー完了後、該領域Aのフラグを“A2”へ変更し、該領域Bを消去し、消去完了後、該領域Aにデータを書き込むよう制御する手段と、
領域Aのフラグが“A1”かつ、領域Bのフラグが“B3”ならば、該領域Bから必要なデータのみを該領域Aへコピーし、コピー完了後、該領域Aのフラグを“A2”へ変更し、該領域Bを消去し、消去完了後、該領域Aにデータを書き込むよう制御する手段と、
領域Aのフラグが“A2”かつ、領域Bのフラグが“B3”ならば、該領域Bを消去し、消去完了後、該領域Aにデータを書き込むよう制御する手段と有する。
【0022】
本発明(請求項)は、コンピュータに、請求項3または4記載のデータ管理装置の各手段を実行させるデータ管理プログラムである。
【0026】
本発明(請求項)は、コンピュータに、請求項3または4記載のデータ管理装置の各手段を実行させるデータ管理プログラムを格納した記憶媒体である
【0030】
上記のように、本発明では、前述の第1の従来の技術のように、専用領域の共有を行なわないため、データの書き戻しの必要性がない。従って、第1の従来の技術に比べて、高速にガベージコレクションの実行が可能となる。また、他の領域のガベージコレクションの影響を受けないめ、ガベージコレクション処理により復帰不可能に陥ることがない。
【0031】
また、本発明では、前述の第2の従来の技術のように、データを格納する領域と管理情報を格納する領域を、別々の領域に分けることなく、同一の領域内で管理する。さらに、管理情報の更新には原子性を持たせることができるため、障害が起こっても、復帰時に矛盾が生じることがない。
【0032】
【発明の実施の形態】
以下、図面と共に本発明の実施の形態について説明する。
【0033】
[第1の実施の形態]
本実施の形態では、データ更新による状態遷移に方向性の制限があり、逆方向に遷移するために、一旦、消去という処理によって、状態を初期状態に戻すことが必要である、という特性をもった記憶装置におけるデータ管理装置について説明する。
【0034】
図3は、本発明の第1の実施の形態におけるデータ管理装置の構成を示す。
【0035】
同図に示すデータ管理装置100は、データ領域110A,B、消去装置120、読み出し装置130、書き込み装置140を有する。
【0036】
データ領域110A、110Bは、各々の領域内に、それぞれの領域の状態を示すフラグを有する。フラグは、その領域中が「使用中」であるか、「待機中」であるかの状態を持つ。
【0037】
読み出し装置130は、上位装置からの読み出し要求を受信し、データ領域A、及びデータ領域110Bのフラグを参照し、「使用中」の状態を持つフラグの領域からデータを読み出して、読み出し結果を上位装置に渡す。
【0038】
書き込み装置140は、上位装置がデータを書き込もうとする書き込み要求を受信すると、領域110A、領域Bのフラグを参照し、「使用中」の状態を持つフラグの領域にデータを書込む。「使用中」の状態をもつフラグの領域に新たにデータを書き込む領域が存在しない場合には、「待機中」の状態を持つフラグの領域へデータを書き込み、フラグの状態を「使用中」にし、消去装置へ領域消去の指示を出す。
【0039】
消去装置120は、以前フラグが「使用中」の状態であった領域を消去する。
図4は、本発明の第1の実施の形態における動作のフローチャートである。
【0040】
データ管理装置が受信した要求が読み出し要求の場合には(ステップ101、Yes)、読み出し装置130が、当該上位装置からの読み出し要求を受信し(ステップ102)、データ領域110A、及びデータ領域110Bのフラグを参照し(ステップ103)、「使用中」の状態を持つフラグの領域からデータを読み出して(ステップ104)、読み出し結果を上位装置に渡す(ステップ105)。 データ管理装置が受信した要求が書き込み要求の場合には(ステップ101、No)、書き込み装置140が、上位装置がデータを書き込もうとする書き込み要求を受信し(ステップ106)、領域110A、領域110Bのフラグを参照し(ステップ107)、「使用中」の状態を持つフラグがある場合には(ステップ108,Yes)、当該領域にデータを書込む(ステップ)。「使用中」の状態をもつフラグの領域に新たにデータを書き込む領域が存在しない場合には(ステップ109,No)、「待機中」の状態を持つフラグの領域へデータを書き込み(ステップ111)、フラグの状態を「使用中」にし(ステップ112)、消去装置へ領域消去の指示を出す(ステップ113)。
【0041】
消去装置120は、以前フラグが「使用中」の状態であった領域を消去する。
[第2の実施の形態]
本実施の形態では、データ更新による状態遷移に方向性の制限があり、逆方向に遷移するために、一旦、消去という処理によって、状態を初期状態に戻すことが必要である、という特性をもった記憶装置における、データ更新中に任意の時点で処理が中断されてもデータの保護が可能なデータ管理装置について説明する。
【0042】
図5は、本発明の第2の実施の形態におけるデータ管理装置の構成を示す。
【0043】
同図に示すデータ管理装置100は、図3に示す構成に、状態管理装置150を付加した構成であり、読み出し先の領域を決定する機能(読み出し先領域制御手段)と書き込み先の領域を決定する機能(書き込み先領域制御手段)とを有する。
【0044】
データ領域110A、Bは、各々の領域内に、A1からAn(nは任意の整数)の状態をとるフラグAと、B1〜Bn(nは任意の整数)の状態をとるフラグBを持つ。
【0045】
読み出し装置130は、上位装置がデータを読み出そうとするとき、読み出し要求を受信し、状態管理装置150に渡す。また、状態管理装置150から指示された領域からデータを読み出し、上位装置へデータを渡す。
【0046】
状態管理装置150は、読み出し装置130からデータが渡されると、領域110Aのフラグ及び領域110Bのフラグを参照し、フラグの状態の組み合わせから、読み出し先の領域を決定し、決定した領域からデータを読み出すように読み出し装置130へ指示する。
【0047】
また、状態管理装置150は、書き込み装置140から書き込み要求が渡されると、領域110Aのフラグ及び領域110Bのフラグの状態の組み合わせから、書き込み先の領域を決定し、決定した領域にデータを書き込むように、書き込み装置140に指示する。
【0048】
書き込み装置140は、上位装置がデータを更新しようとするとき、書き込み要求を受信し、状態管理装置150へ渡す。
【0049】
また、書き込み装置140は、状態管理装置150からの指示により、決定された領域にデータを書き込む。
【0050】
図6は、本発明の第2の実施の形態における動作のフローチャートである。
【0051】
データ管理装置が上位装置から受信したデータが、読み出し要求である場合には(ステップ201)、読み出し装置130が、当該読み出し要求を受信し、状態管理装置150に渡す(ステップ202)。状態管理装置150は、読み出し装置130からデータが渡されると、領域110Aのフラグ及び領域110Bのフラグを参照し、フラグの状態の組み合わせから、読み出し先の領域を決定し、決定した領域からデータを読み出すように読み出し装置130へ指示する(ステップ203)。
【0052】
読み出し装置130は、状態蟹装置150から指示された領域からデータを読み出す(ステップ204)。
【0053】
また、データ管理装置で受信したデータが書き込み要求である場合には(ステップ201)、書き込み装置140で当該要求を受信し、状態管理装置150に転送する(ステップ205)。
【0054】
状態管理装置150は、書き込み装置140から書き込み要求が渡されると、領域110Aのフラグ及び領域110Bのフラグの状態の組み合わせから、書き込み先の領域を決定し、決定した領域にデータを書き込むように、書き込み装置140に指示する(ステップ206)。
【0055】
書き込み装置140は、状態管理装置150からの指示により、決定された領域にデータを書き込む(ステップ207)。
【0056】
次に、状態管理装置150の動作について説明する。
【0057】
状態管理装置150において、データ領域110A、データ領域110Bのフラグが、それぞれ“A1”〜“A3”、“B1”〜“B3”の状態を取り、領域110Aのフラグ及び、領域110Bのフラグを参照し、フラグの状態の組み合わせから、読み出し先の領域を決定する場合には、それぞれ以下のような動作を行なう。
【0058】
▲1▼ 領域110Aのフラグが“A2”かつ、領域110Bのフラグが“B1”ならば、領域110Aよりデータを読み出すように読み出し装置130に指示する。
【0059】
▲2▼ 領域110Bのフラグが“A3”かつ、領域110Bのフラグが“B1”ならば、領域110Aから必要なデータのみを領域110Bへコピーし、コピー完了後、領域110Bのフラグを“B2”へ変更し、領域110Aを消去するように消去装置120に指示し、消去完了後、領域110Bからデータを読み出すように読み出し装置130へ指示を出す。
【0060】
▲3▼ 領域110Aのフラグが“A3”かつ、領域110Bのフラグが“B2”ならば、領域110Aを消去するように消去装置120へ指示し、消去完了後、領域110Bからデータを読み出すように読み出し装置130に指示を出す。
【0061】
▲4▼ 領域110Aのフラグが“A1”かつ、領域110Bのフラグが“B2”ならば、領域110Bよりデータを読み出すように読み出し装置130へ指示を出す。
【0062】
▲5▼ 領域110Aのフラグが“A1”かつ、領域110Bのフラグが“B3”ならば、領域110Bから必要なデータのみを領域110Aへコピー、コピー完了後、領域110Aのフラグを“A2”へ変更し、領域110Bを消去するように消去装置120へ指示し、消去完了後、領域110Aからデータを読み出すように読み出し装置130に指示する。
【0063】
▲6▼ 領域110Aのフラグが“A2”かつ、領域110Bのフラグが“B3”ならば、領域110Bを消去するように消去装置150へ指示し、消去完了後、領域110Aからデータを読み出すように読み出し装置130に指示する。
【0064】
次に、状態管理装置150において、領域110Aのフラグ及び領域110Bのフラグを参照し、フラグの状態の組み合わせから、書き込み先の領域を決定する場合の動作を説明する。
【0065】
▲1▼ 領域110Aのフラグが“A2”かつ、領域110Bのフラグが“B1”ならば、領域110Aにデータを書き込むように書き込み装置140に指示し、さらに、領域110Aが新たにデータを書き込む領域が存在しない場合は、領域110Aのフラグを“A3”へ更新し、領域110Aから必要なデータのみを領域110Bへコピーし、コピー完了後、領域110Bのフラグを“B2”へ変更し、領域110Aを消去するように消去装置120へ指示し、消去完了後、領域110Bに書き込むように書き込み装置140に指示する。
【0066】
▲2▼ 領域110Aのフラグが“A3”かつ、領域110Bのフラグが“B1”ならば、領域110Aから必要なデータのみを領域110Bへコピーし、コピー完了後、領域110Bのフラグを“B2”へ変更し、領域110Aを消去するように消去装置120へ指示し、消去完了後、領域110Bにデータを書き込むように書き込み装置140に指示する。
【0067】
▲3▼ 領域110Aのフラグが“A3”かつ、領域110Bのフラグが“B2”ならば、領域110Aを消去するように、消去装置120へ指示し、消去完了後、領域110Bにデータを書き込むように書き込み装置140に指示する。
【0068】
▲4▼ 領域110Aのフラグが“A1”かつ、領域110Bのフラグが“B2”ならば、領域110Bにデータを書き込むように書き込み装置140に指示し、さらに、領域110Bに新たにデータを書き込む領域が存在しない場合は、領域110Bのフラグを“B3”へ更新し、領域110Bから必要なデータのみを領域110Aへコピーし、コピー完了後、領域110Aのフラグを“A2”へ変更し、領域110Bを消去するように消去装置120へ指示し、消去完了後、領域110Aにデータを書き込むように書き込み装置140に指示する。
【0069】
▲5▼ 領域110Aのフラグが“A1”かつ、領域110Bのフラグが“B3”ならば、領域110Bから必要なデータのみを領域110Aへコピーし、コピー完了後、領域110Aのフラグを“A2”へ変更し、領域110Bを消去するように、消去装置120へ指示し、消去完了後、領域110Aにデータを書き込むように書き込み装置140に指示する。
【0070】
▲6▼ 領域110Aのフラグが“A2”かつ、領域110Bのフラグが“B3”ならば、領域110Bを消去するように消去装置120へ指示し、消去完了後、領域110Aにデータを書き込むように書き込み装置140に指示する。
【0071】
【実施例】
以下、図面と共に本発明の実施例を説明する。
【0072】
図7は、本発明の一実施例の本発明が適用されるICカードの構成例である。同図に示すICカード200は、当該ICカード200と接続されるカードリーダ・ライタ(R/W)との間のデータ入出力制御を行なう入出力制御部(I/O)210、マイクロプロセッサ(CPU)220、ROM230、RAM240、及びフラッシュメモリ250から構成される。
【0073】
RAM240は、CPU220がプログラムを実行するために使用する揮発性の記憶領域であり、ROM230は、CPU220が実行するプログラムを格納するメモリである。フラッシュメモリ250は、プログラムがデータを格納するために使用する不揮発性の記憶領域である。
【0074】
同図に示すICカードにより、本発明のデータ管理装置を構成するものとして説明する。
【0075】
図8は、本発明の一実施例のICカードのフラッシュメモリを説明するための図である。同図に示すフラッシュメモリ250は、前述の領域110A,110Bに相当する。
【0076】
本実施例では、フラッシュメモリ250に、管理対象のデータが必要とするブロックをN(N≧1)とすると、N×2ブロックがフラッシュメモリ250に用意される。Nブロックからなる領域をそれぞれ、領域110A,領域110Bと呼ぶことにすると、領域110Aと領域110Bのそれぞれの先頭nビットがその領域の状態を示すフラグとして確保される。
【0077】
図9は、本発明の一実施例のROMに格納された制御プログラムに従ってCPUによって実現される機能ブロックを示す。同図において、データ管理装置231は、フラッシュメモリ250上の領域110A251,領域110B252によって管理されるデータの更新、参照を行なうものであり、上位装置232は、データ管理装置231を使ってフラッシュメモリ250上のデータを管理する実体であり、データの参照時に参照要求を、データの更新時にデータ更新要求をデータ管理装置231に対して行なう。
【0078】
データ管理装置231は、参照要求を受けると、領域110A251と領域110B252のフラグを参照し、図10のマトリクスに従って動作し、領域110A251または、領域110B252上のデータを参照し、更新要求を受けると、同様に領域110A251と領域110B252を参照し、図11のマトリクスに従って、領域110A251,領域110B252のデータを更新する。例えば、参照要求時に、領域110A251のフラグが“10”であり、領域110B252のフラグが“11”であるときは、「状態D」となり、「領域110A上のデータを参照する」という動作を行なう。
【0079】
また、更新要求時に、領域110A251のフラグが“11”であり、領域110B252のフラグが“00”であるときには、「領域110Aが未消去であるとき、領域110Aを消去し、領域110BのGC対象外のデータを領域110Aにコピーし、領域110Aのフラグを“11100”にセットする」という動作を行なう。
【0080】
図12は、本発明の一実施例における状態遷移図である。
【0081】
同図に示す状態遷移図において、
状態A→状態D:領域110Aを初期化する;
状態Dは、領域110Aにデータを追記、または、領域110Aのデータを参照;
状態D→状態F:領域110Aが満杯;
状態F→状態G:領域110AのGC対象外データを領域110Bにコピー;
状態G→状態B:領域110Aを消去;
状態B→状態C:領域110Bが満杯;
状態C:領域110Bにデータを追記、または、領域110Bのデータ参照;
状態C→状態E:領域110BのGC対象外データを領域110Aにコピー;
状態E→状態D:領域110Bを消去;
を示している。
【0082】
同図の状態遷移図によれば、データ管理装置231に参照・更新要求が送られた際には、データ管理装置231は、必ずいずれかの状態にあり、図12に示したマトリクスに従って動作すれば、その状態を起点として必ず、参照もしくは、更新が行なわれることになる。
【0083】
なお、上記の動作は、図10、図11に示すマトリクスに基づいてCPUで実行されるが、同図に示す各フラグの組み合わせからなる動作をプログラムとして構築し、CPUにインストールすることも可能である。
【0084】
また、構築されたプログラムをICカード、データ管理装置として利用されるコンピュータのハードディスクや、フロッピーディスク、CD−ROM等の可搬記憶媒体に格納しておき、本発明を実施する際にインストールすることにより、容易に本発明を実現できる。
【0085】
なお、本発明は、上記の実施例に限定されることなく、特許請求の範囲内において、種々変更・応用が可能である。
【0086】
【発明の効果】
上述のように、本発明によれば、いずれかの領域に、それ以上データを書き込む領域がなくなった際の処理(ガベージコレクション)が高速に行なうことができる。つまり、第1の従来の技術のように、『ブロックのコピー→ブロック消去→ブロックの書き戻し→ブロック消去』という処理に比べて、『必要なデータのコピー→ブロック消去』という処理手順で行なえるため、ガベージコレクションを高速に行なうことができる。
【0087】
また、本発明によれば、ガベージコレクション処理中のいかなる時点で処理障害がおきても復帰できる。第2の従来の技術では、ガベージコレクション中に移動したデータの管理情報が別の領域で管理されていたため、管理情報の更新中に処理障害が発生した場合、復帰できなくなる危険性があったが、本発明では、状態管理をブロック単位で行い、状態を表すフラグの更新(遷移)に原子性を持たせることができるため、いかなる時点における処理障害からでも復帰できる。
【図面の簡単な説明】
【図1】本発明の原理を説明するための図である。
【図2】本発明の原理構成図である。
【図3】本発明の第1の実施の形態におけるデータ管理装置の構成図である。
【図4】本発明の第1の実施の形態における動作のフローチャートである。
【図5】本発明の第2の実施の形態におけるデータ管理装置の構成図である。
【図6】本発明の第2の実施の形態における動作のフローチャートである。
【図7】本発明の一実施例の本発明が適用されるICカードの構成例である。
【図8】本発明の一実施例のICカードのフラッシュメモリを説明するための図である。
【図9】本発明の一実施例のROMに格納された制御プログラムに従ってCPUによって実現される機能ブロック図である。
【図10】本発明の一実施例の参照要求時における領域A、領域Bのフラグの組み合わせ例である。
【図11】本発明の一実施例の更新要求時における領域A、領域Bのフラグの組み合わせ例である。
【図12】本発明の一実施例における状態遷移図である。
【符号の説明】
100 データ管理装置
110 領域
120 消去手段、消去装置
130 読み出し手段、読み出し装置
135 読み出し先領域制御手段
140 書き込み手段、書き込み装置
145 書き込み先領域制御手段
150 状態管理装置
160 要求受信手段
170 状態書き替え手段
200 ICカード
210 I/O
220 CPU
230 ROM
231 データ管理装置
232 上位装置
240 RAM
250 フラッシュメモリ
251 領域A
252 領域B
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a data management method and apparatus, a data management program, and a storage medium storing the data management program, and in particular, temporarily erases data in order to make a transition in the reverse direction where there is a directionality limitation in the state transition caused by data update. The present invention relates to a data management method and apparatus, a data management program, and a storage medium storing the data management program in a storage device having a characteristic that it is necessary to return the state to an initial state by the process.
[0002]
[Prior art]
As a first conventional technique, one or more dedicated areas are prepared for garbage collection, and an area that is currently used when there is no area that can be used in the currently used area. There is a method in which only necessary data is copied, the currently used area is erased to make it an initialized area, and then the data on the dedicated area is written back to the initialized area again.
[0003]
As a second conventional technique, one or more unused blocks are always prepared for garbage collection, and when there is no usable area at all in the currently used block, it is currently used. There is a method in which only necessary data is copied from an existing block to an unused block, and finally a currently used block is erased to make a new unused block.
[0004]
[Problems to be solved by the invention]
However, in the first conventional technique, it is necessary to copy the data of the currently used area once to the dedicated area and write it back to the initialized area again. In addition, the dedicated area must be deleted each time, so if garbage collection becomes necessary, the data in the garbage collection area may be newly destroyed before the data in the dedicated area is written back. There is sex.
[0005]
In the second conventional technique, the area for storing data and the area for managing management information are divided into separate areas. Furthermore, when copying, it is necessary not only to copy only the target data, but also to update data in another area that manages the reference destination of the data at the same time. At this time, if a failure occurs due to a power failure while updating data in another area that manages the reference destination after moving the data for garbage collection, the reference destination of the data is not necessarily correct after restoration. there is a possibility.
[0006]
In a storage device in which the state transition due to data update is restricted in direction, for example, a storage device in which the initial state is “1”, “0” to “0”, “1” to “0”, and “1” “1” can be changed, but “0” cannot be changed to “1”. In order to make a transition in the reverse direction, it is necessary to return the state of the storage device to the initial state once by a process of erasure. In order to cope with such direction of data update, the data update is performed by an operation called appending in which new data is written instead of updating the original data area.
[0007]
By repeating such an appending operation, an area for further appending data cannot be secured in that area, but in that case, by performing a process called garbage collection, the free area in the area is reduced. Secured.
[0008]
In garbage collection,
1) Copy only the necessary data in the area to the area;
2) Perform an erase operation on the original area;
3) Write back the copied data;
Three operations are required. However, in the erase operation performed on the original area, the area to be erased is called an erase block, and is performed in units of several KB to several tens of KB, so it takes about one second. For this reason, garbage collection is a very time-consuming process.
[0009]
Furthermore, as another garbage collection method, one or more unused areas are always prepared for garbage collection.
1) Copy only necessary data in the original area to the unused area;
2) Erasing the erase block;
There is something that performs the operation.
[0010]
However, this method requires an area for managing the data reference destination because the physical location where the data is stored changes before and after execution of garbage collection. Therefore, if the data update in this management area is not successful due to a power failure or the like, the reference management area has not been updated even though the data reference destination has changed due to garbage collection. There is a danger that you will not be able to refer.
[0011]
The present invention has been made in view of the above points. A data management method, apparatus, and data management program capable of performing garbage collection at a high speed and capable of returning from any winning failure during garbage collection processing. And a storage medium storing a data management program.
[0012]
[Means for Solving the Problems]
FIG. 1 is a diagram for explaining the principle of the present invention.
[0014]
  The present invention (claims)1) Is a data update in a storage device having a characteristic that it is necessary to return the state to the initial state once by a process of erasure in order to make a transition in the reverse direction in which there is a directionality restriction in the state transition by the data update. Data management method that enables data protection even if processing is interrupted at any timeBecause,
  Receive data read request from host deviceStep (step 1) to perform,
  Referring to the flag of area A and the flag of area B of the storage device, the read destination area is determined based on the combination of the flag statesStep (step 2) to perform,
  Data is read from the determined area and transferred to the host deviceStep (step 3) and,
  Receive data write request from host deviceStep (step 4),
  Referring to the flags of area A and area B of the storage device, the write destination area is determined based on the combination of the flag statesPerforming step (step 5);
  Write data to the determined areaIn the method of performing step (step 6)
  In the step (step 2) of determining the read destination area,
  The area A flag of the storage area is in the state of A1, A2, A3, the area B is in the state of B1, B2, B3, and the flag of the area A and the flag of the area B are referred to. Based on the combination, when determining the area to read out,
  If the flag of the area A is “A2” and the flag of the area B is “B1”, the data is read from the area A,
  If the flag of the area A is “A3” and the flag of the area B is “B1”, only necessary data from the area A is copied to the area B. After the copying is completed, the flag of the area B is set to “B2”. To the area A, erase the area A, read the data from the area B after completion of the erase,
  If the flag of the area A is “A3” and the flag of the area B is “B2”, the area A is erased, and after the erase is completed, data is read from the area B,
  If the flag of the area A is “A1” and the flag of the area B is “B2”, the data is read from the area B,
  If the flag of the area A is “A1” and the flag of the area B is “B3”, only necessary data is copied from the area B to the area A, and after the copying is completed, the flag of the area A is set to “A2”. To the area B, erase the area B, and after erasure is completed, read the data from the area A,
  If the flag for area A is “A2” and the flag for area B is “B3”, area B is erased, and data is read from area A after the completion of erasure..
[0016]
  The present invention (claims)2)During the data update in the storage device having the characteristic that it is necessary to return the state to the initial state by the process of erasure in order to make a transition in the reverse direction where there is a directionality limitation in the state transition by the data update, A data management method that enables data protection even if processing is interrupted at an arbitrary time,
  Receiving a data read request from the host device (step 1);
  A step (step 2) of referring to the flag of the area A and the flag of the area B of the storage device and determining a read destination area based on a combination of the states of the flags;
  A step of reading data from the determined area and transferring it to the host device (step 3);,
  Receiving a data write request from the host device (step 4);,
  A step (step 5) of referring to the flags of the area A and area B of the storage device and determining a write destination area based on a combination of the states of the flags;
  A step of writing data in the determined area (step 6),
  In the step of determining the write destination area (step 5),
  The storage area A flag is in the state of A1, A2, A3, and the area B flag is in B1, B2, B3. Refer to the area A flag and the area B flag, When determining the write destination area based on the combination,
  If the flag of the area A is “A2” and the flag of the area B is “B1”, data is written to the area A. On the other hand, if there is no area in which data is newly written, the area A Update the flag to “A3”, copy only necessary data from the area A to the area B, change the flag of the area B to “B2” after the copying is completed, delete the area A, After erasing is completed, write to the area B,
  If the flag of the area A is “A3” and the flag of the area B is “B1”, only necessary data from the area A is copied to the area B. After the copying is completed, the flag of the area B is set to “B2”. , Erase the area A, and after erasing is completed, write data to the area B,
  If the flag of the area A is “A3” and the flag of the area B is “B2”, the area A is erased.
  If the flag of the area A is “A1” and the flag of the area B is “B2”, the data is written to the area B. On the other hand, if there is no area in which data is newly written, the area B Update the flag to “B3”, copy only necessary data from the area B to the area A, change the flag of the area A to “A2” after the copying is completed, delete the area B, After completion of erasure, write data to the area A,
  If the flag of the area A is “A1” and the flag of the area B is “B3”, only necessary data is copied from the area B to the area A, and after the copying is completed, the flag of the area A is set to “A2”. To the area B, erase the area B, and after completing the erase, write data to the area A,
  If the flag of the area A is “A2” and the flag of the area B is “B3”, the area B is erased, and data is written to the area A after the completion of the erase.
[0017]
FIG. 2 is a principle configuration diagram of the present invention.
[0019]
  The present invention (claims)3) Is a data update in a storage device having a characteristic that it is necessary to return the state to the initial state once by a process of erasure in order to make a transition in the reverse direction in which there is a directionality restriction in the state transition by the data update. A data management device that enables data protection even if processing is interrupted at an arbitrary time,
  In the storage device, there are a data area A and a data area B having a flag indicating whether the area is in use or waiting,
  Request receiving means for receiving data read request and data write request from host device160When,
  When a read request is received, a read destination area control unit that refers to the flag of the area A and the flag of the area B of the storage device and determines a read destination area based on a combination of the states of the flags135When,
  Read means for reading data from the area determined by the read destination control means and transferring it to the host device130When,
  When a write request is received, a write destination area control unit that refers to the flags of the areas A and B of the storage device and determines a write destination area based on a combination of the states of the flags145When,
  Write destination area control means145Writing means to write data to the area determined in step140When,
Have
  The read destination area control means 135 is
  When the flag of the area A of the storage device is A1, A2, A3, and the flag of the area B is B1, B2, B3,
  Means for controlling to read from area A if the flag for area A is "A2" and the flag for area B is "B1";
  If the flag of the area A is “A3” and the flag of the area B is “B1”, only necessary data from the area A is copied to the area B. After the copying is completed, the flag of the area B is set to “B2”. Means for controlling to read the data from the area B after erasing is completed,
  Means for erasing the area A if the flag for the area A is “A3” and the flag for the area B is “B2”, and reading data from the area B after the completion of erasure;
  Means for controlling to read data from the area B if the flag of the area A is “A1” and the flag of the area B is “B2”;
  If the flag of the area A is “A1” and the flag of the area B is “B3”, only necessary data is copied from the area B to the area A, and after the copying is completed, the flag of the area A is set to “A2”. Means for controlling to read the data from the area A after erasing is completed,
  If the flag of area A is “A2” and the flag of area B is “B3”, means for erasing area B, and controlling to read data from area A after completion of erasure;Have
[0021]
  The present invention (claims)4)During the data update in the storage device having the characteristic that it is necessary to return the state to the initial state by the process of erasure in order to make a transition in the reverse direction where there is a directionality limitation in the state transition by the data update, A data management device that enables data protection even if processing is interrupted at an arbitrary time,
  In the storage device, there are a data area A and a data area B having a flag indicating whether the area is in use or waiting,
  Request receiving means 160 for receiving a data read request and a data write request from the host device;
  When a read request is received, a read destination area control unit 135 that refers to a flag of the area A and a flag of the area B of the storage device and determines a read destination area based on a combination of the flag states;
  Read means 130 for reading data from the area determined by the read destination control means 135 and transferring it to the host device;
  When a write request is received, a write destination area control unit 145 that refers to the flags of the areas A and B of the storage device and determines a write destination area based on a combination of the states of the flags;
  Writing means 140 for writing data in the area determined by the write destination area control means 145;
Have
  The write destination area control means 145
  When the flag of the area A of the storage device is A1, A2, A3, and the flag of the area B is B1, B2, B3The
  If the flag of the area A is “A2” and the flag of the area B is “B1”, data is written to the area A. On the other hand, if there is no area in which data is newly written, the area A Update the flag to “A3”, copy only necessary data from the area A to the area B, change the flag of the area B to “B2” after the copying is completed, delete the area A, Means for controlling writing to the area B after completion of erasure;
  If the flag of the area A is “A3” and the flag of the area B is “B1”, only necessary data from the area A is copied to the area B. After the copying is completed, the flag of the area B is set to “B2”. Means for controlling to write the data in the area B after erasing is completed,
  Means for erasing the region A if the flag for the region A is “A3” and the flag for the region B is “B2”, and writing data to the region B after completion of erasure;
  If the flag of the area A is “A1” and the flag of the area B is “B2”, the data is written to the area B. On the other hand, if there is no area in which data is newly written, the area B Update the flag to “B3”, copy only the necessary data from the area B to the area A, change the flag of the area A to “A2” after the copying is completed, delete the area B, Means for controlling to write data in the area A after completion of erasure;
  If the flag of the area A is “A1” and the flag of the area B is “B3”, only necessary data is copied from the area B to the area A, and after the copying is completed, the flag of the area A is set to “A2”. Means for controlling to write the data in the area A after erasing is completed.
  Means for erasing the area B if the area A flag is “A2” and the area B flag “B3”, and writing data to the area A after the completion of erasure;,TheHave.
[0022]
  The present invention (claims)5)A data management program for causing a computer to execute each means of the data management device according to claim 3.
[0026]
  The present invention (claims)6)A storage medium storing a data management program for causing a computer to execute each means of the data management device according to claim 3 or 4..
[0030]
As described above, in the present invention, unlike the first prior art described above, the dedicated area is not shared, so there is no need to write back data. Therefore, garbage collection can be executed at a higher speed than in the first conventional technique. In addition, since it is not affected by garbage collection in other areas, it cannot be recovered by garbage collection processing.
[0031]
In the present invention, as in the second prior art described above, the area for storing data and the area for storing management information are managed in the same area without being divided into separate areas. Furthermore, since the management information can be updated in atomicity, even if a failure occurs, there is no contradiction when returning.
[0032]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[0033]
[First Embodiment]
In the present embodiment, there is a characteristic that the state transition due to data update has a limitation of directionality, and it is necessary to return the state to the initial state by erasing once in order to make a transition in the reverse direction. A data management device in the storage device will be described.
[0034]
FIG. 3 shows the configuration of the data management apparatus according to the first embodiment of the present invention.
[0035]
The data management apparatus 100 shown in the figure includes data areas 110A and 110B, an erasing device 120, a reading device 130, and a writing device 140.
[0036]
Each of the data areas 110A and 110B has a flag indicating the state of each area in each area. The flag has a status of whether the area is “in use” or “standby”.
[0037]
The reading device 130 receives the read request from the host device, refers to the flags of the data area A and the data area 110B, reads the data from the flag area having the “in use” state, and displays the read result as the upper rank. Pass to device.
[0038]
When the upper device receives a write request to write data, the writing device 140 refers to the flags of the areas 110A and B, and writes the data to the flag area having the “in use” state. If there is no new area to write data to in the flag area with the “in use” status, write data to the flag area with the “waiting” status and set the flag status to “in use”. Instruct the eraser to erase the area.
[0039]
The erasing device 120 erases the area where the flag was in the “in use” state before.
FIG. 4 is a flowchart of the operation in the first embodiment of the present invention.
[0040]
If the request received by the data management device is a read request (Yes in step 101), the read device 130 receives a read request from the host device (step 102), and the data area 110A and the data area 110B The flag is referred to (step 103), data is read from the flag area having the “in use” state (step 104), and the read result is passed to the host device (step 105). If the request received by the data management device is a write request (step 101, No), the writing device 140 receives a write request for the host device to write data (step 106), and the area 110A and the area 110B With reference to the flag (step 107), if there is a flag having a status of “in use” (step 108, Yes), data is written in the area (step). If there is no new area for writing data in the flag area having the “in use” state (step 109, No), the data is written to the flag area having the “standby” state (step 111). The flag is set to “in use” (step 112), and an instruction to erase the area is issued to the eraser (step 113).
[0041]
The erasing device 120 erases the area where the flag was in the “in use” state before.
[Second Embodiment]
In the present embodiment, there is a characteristic that the state transition due to data update has a limitation of directionality, and it is necessary to return the state to the initial state by erasing once in order to make a transition in the reverse direction. A data management device capable of protecting data even when processing is interrupted at an arbitrary time during data update in a storage device will be described.
[0042]
FIG. 5 shows the configuration of the data management apparatus according to the second embodiment of the present invention.
[0043]
The data management apparatus 100 shown in the figure has a configuration in which a state management apparatus 150 is added to the configuration shown in FIG. 3, and has a function for determining a read destination area (read destination area control means) and a write destination area. Function (write destination area control means).
[0044]
Each of the data areas 110A, B has a flag A that takes a state of A1 to An (n is an arbitrary integer) and a flag B that takes a state of B1 to Bn (n is an arbitrary integer).
[0045]
The reading device 130 receives a read request and passes it to the state management device 150 when the host device tries to read data. Also, data is read from the area instructed by the state management device 150, and the data is transferred to the host device.
[0046]
When the data is transferred from the reading device 130, the state management device 150 refers to the flag of the region 110A and the flag of the region 110B, determines the read destination region from the combination of the flag states, and stores the data from the determined region. The reading device 130 is instructed to read.
[0047]
Further, when a write request is passed from the writing device 140, the state management device 150 determines the write destination region from the combination of the flag state of the region 110A and the flag state of the region 110B, and writes the data in the determined region. Then, the writing device 140 is instructed.
[0048]
The writing device 140 receives a write request and passes it to the state management device 150 when the host device attempts to update data.
[0049]
Further, the writing device 140 writes data in the determined area according to an instruction from the state management device 150.
[0050]
FIG. 6 is a flowchart of the operation in the second embodiment of the present invention.
[0051]
If the data received by the data management device from the host device is a read request (step 201), the read device 130 receives the read request and passes it to the state management device 150 (step 202). When the data is transferred from the reading device 130, the state management device 150 refers to the flag of the region 110A and the flag of the region 110B, determines the read destination region from the combination of the flag states, and stores the data from the determined region. The reading device 130 is instructed to read (step 203).
[0052]
The reading device 130 reads data from the area instructed by the state selection device 150 (step 204).
[0053]
If the data received by the data management device is a write request (step 201), the write device 140 receives the request and transfers it to the state management device 150 (step 205).
[0054]
When the write request is passed from the writing device 140, the state management device 150 determines the write destination region from the combination of the flag of the region 110A and the flag state of the region 110B, and writes the data to the determined region. The writing device 140 is instructed (step 206).
[0055]
The writing device 140 writes data in the determined area in accordance with an instruction from the state management device 150 (step 207).
[0056]
Next, the operation of the state management device 150 will be described.
[0057]
In the state management device 150, the flags of the data area 110A and the data area 110B take the states “A1” to “A3” and “B1” to “B3”, respectively, and refer to the flags of the area 110A and the flags of the area 110B. When determining the read destination area from the combination of flag states, the following operations are performed.
[0058]
(1) If the flag of the area 110A is “A2” and the flag of the area 110B is “B1,” the reading device 130 is instructed to read data from the area 110A.
[0059]
(2) If the flag of the area 110B is “A3” and the flag of the area 110B is “B1”, only necessary data is copied from the area 110A to the area 110B, and after the copying is completed, the flag of the area 110B is set to “B2”. And the erase device 120 is instructed to erase the area 110A, and after the erase is completed, the readout device 130 is instructed to read data from the area 110B.
[0060]
(3) If the flag of the area 110A is “A3” and the flag of the area 110B is “B2,” the erasing device 120 is instructed to erase the area 110A, and the data is read from the area 110B after the completion of the erasure. An instruction is issued to the reading device 130.
[0061]
(4) If the flag of the area 110A is “A1” and the flag of the area 110B is “B2”, an instruction is issued to the reading device 130 to read data from the area 110B.
[0062]
(5) If the flag of the area 110A is “A1” and the flag of the area 110B is “B3”, only necessary data is copied from the area 110B to the area 110A, and after the copying is completed, the flag of the area 110A is set to “A2”. Change, instruct the erasing device 120 to erase the area 110B, and instruct the reading device 130 to read data from the area 110A after the erasure is completed.
[0063]
(6) If the flag of the area 110A is “A2” and the flag of the area 110B is “B3”, the erasing device 150 is instructed to erase the area 110B, and data is read from the area 110A after the erasure is completed. The reading device 130 is instructed.
[0064]
Next, the operation when the state management device 150 determines the write destination region from the combination of the flag states with reference to the flag of the region 110A and the flag of the region 110B will be described.
[0065]
(1) If the flag of the area 110A is “A2” and the flag of the area 110B is “B1,” the writing device 140 is instructed to write data to the area 110A, and the area 110A newly writes data. Is not present, the flag of the area 110A is updated to “A3”, only necessary data from the area 110A is copied to the area 110B, and after the copying is completed, the flag of the area 110B is changed to “B2”. Is erased, and the erasing device 120 is instructed to erase, and after the erasure is completed, the erasing device 120 is instructed to write to the area 110B.
[0066]
(2) If the flag of the area 110A is “A3” and the flag of the area 110B is “B1”, only necessary data is copied from the area 110A to the area 110B, and after the copying is completed, the flag of the area 110B is set to “B2”. And the erase device 120 is instructed to erase the area 110A, and the erase device 120 is instructed to write data to the area 110B after the erase is completed.
[0067]
(3) If the flag of the area 110A is “A3” and the flag of the area 110B is “B2”, the erase device 120 is instructed to erase the area 110A, and data is written to the area 110B after the completion of the erase. To the writing device 140.
[0068]
(4) If the flag of the area 110A is “A1” and the flag of the area 110B is “B2”, the writing device 140 is instructed to write data to the area 110B, and further, the data is newly written to the area 110B. Is not present, the flag of the area 110B is updated to “B3”, only necessary data is copied from the area 110B to the area 110A, and after the copying is completed, the flag of the area 110A is changed to “A2”. Is erased, and the erasing device 120 is instructed to erase data. After the erasing is completed, the erasing device 120 is instructed to write data in the area 110A.
[0069]
(5) If the flag of the area 110A is “A1” and the flag of the area 110B is “B3”, only necessary data is copied from the area 110B to the area 110A, and after the copying is completed, the flag of the area 110A is set to “A2”. And the erase device 120 is instructed to erase the area 110B, and the erase device 120 is instructed to write data to the area 110A after the erase is completed.
[0070]
(6) If the flag of the area 110A is “A2” and the flag of the area 110B is “B3”, the erasing device 120 is instructed to erase the area 110B, and data is written to the area 110A after the erasure is completed. Instruct the writing device 140.
[0071]
【Example】
Embodiments of the present invention will be described below with reference to the drawings.
[0072]
FIG. 7 is a configuration example of an IC card to which the present invention of one embodiment of the present invention is applied. The IC card 200 shown in the figure includes an input / output control unit (I / O) 210 that performs data input / output control with a card reader / writer (R / W) connected to the IC card 200, a microprocessor ( CPU) 220, ROM 230, RAM 240, and flash memory 250.
[0073]
The RAM 240 is a volatile storage area that is used by the CPU 220 to execute a program, and the ROM 230 is a memory that stores a program executed by the CPU 220. The flash memory 250 is a non-volatile storage area that is used by a program to store data.
[0074]
The IC card shown in the figure will be described as constituting the data management apparatus of the present invention.
[0075]
FIG. 8 is a diagram for explaining a flash memory of an IC card according to an embodiment of the present invention. The flash memory 250 shown in the figure corresponds to the above-described areas 110A and 110B.
[0076]
In this embodiment, assuming that the block required for the data to be managed is N (N ≧ 1) in the flash memory 250, N × 2 blocks are prepared in the flash memory 250. If the areas composed of N blocks are referred to as areas 110A and 110B, respectively, the first n bits of the areas 110A and 110B are secured as flags indicating the state of the areas.
[0077]
FIG. 9 shows functional blocks implemented by the CPU according to the control program stored in the ROM according to the embodiment of the present invention. In the figure, a data management device 231 updates and references data managed by the areas 110A251 and 110B252 on the flash memory 250. The host device 232 uses the data management device 231 to update the flash memory 250. It is an entity that manages the above data, and makes a reference request to the data management device 231 when referring to data and a data update request when updating data.
[0078]
When the data management device 231 receives the reference request, the data management device 231 refers to the flags of the area 110A251 and the area 110B252, operates according to the matrix of FIG. 10, refers to the data on the area 110A251 or the area 110B252, and receives the update request. Similarly, the area 110A251 and the area 110B252 are referred to, and the data of the area 110A251 and the area 110B252 are updated according to the matrix of FIG. For example, at the time of a reference request, when the flag of the area 110A251 is “10” and the flag of the area 110B252 is “11”, the state becomes “state D”, and the operation “refers to data on the area 110A” is performed. .
[0079]
When the update request is made, the flag of the area 110A251 is “11” and the flag of the area 110B252 is “00”. When the area 110A is not erased, the area 110A is erased, and the GC object of the area 110B The operation of copying the outside data to the area 110A and setting the flag of the area 110A to “11100” is performed.
[0080]
FIG. 12 is a state transition diagram in one embodiment of the present invention.
[0081]
In the state transition diagram shown in the figure,
State A → State D: Initialize area 110A;
For state D, data is added to area 110A or data in area 110A is referred to;
State D → State F: Area 110A is full;
State F → State G: Copy non-GC target data in area 110A to area 110B;
State G → State B: Erase region 110A;
State B → State C: Area 110B is full;
State C: Add data to area 110B or refer to data in area 110B;
State C → State E: Copy non-GC target data in area 110B to area 110A;
State E → State D: Erase region 110B;
Is shown.
[0082]
According to the state transition diagram of FIG. 6, when a reference / update request is sent to the data management device 231, the data management device 231 is always in one of the states and operates according to the matrix shown in FIG. For example, the reference or update is always performed from that state.
[0083]
The above operation is executed by the CPU based on the matrix shown in FIGS. 10 and 11. However, it is also possible to construct an operation composed of a combination of the flags shown in the figure as a program and install it in the CPU. is there.
[0084]
Further, the constructed program is stored in a portable storage medium such as an IC card, a computer hard disk used as a data management device, a floppy disk, or a CD-ROM, and installed when the present invention is carried out. Thus, the present invention can be easily realized.
[0085]
The present invention is not limited to the above-described embodiments, and various modifications and applications are possible within the scope of the claims.
[0086]
【The invention's effect】
As described above, according to the present invention, processing (garbage collection) can be performed at high speed when there is no more area for writing data in any area. That is, as in the first conventional technique, it can be performed by a processing procedure of “copying necessary data → block erasing” as compared with processing of “block copying → block erasing → block writing back → block erasing”. Therefore, garbage collection can be performed at high speed.
[0087]
Further, according to the present invention, it is possible to recover from a processing failure at any point during the garbage collection process. In the second conventional technique, the management information of the data moved during the garbage collection is managed in another area. Therefore, if a processing failure occurs during the management information update, there is a risk that it cannot be recovered. In the present invention, state management is performed in units of blocks, and updating (transition) of a flag representing a state can be made atomic, so that it is possible to recover from a processing failure at any point in time.
[Brief description of the drawings]
FIG. 1 is a diagram for explaining the principle of the present invention.
FIG. 2 is a principle configuration diagram of the present invention.
FIG. 3 is a configuration diagram of a data management apparatus according to the first embodiment of the present invention.
FIG. 4 is a flowchart of the operation in the first embodiment of the present invention.
FIG. 5 is a configuration diagram of a data management apparatus according to a second embodiment of the present invention.
FIG. 6 is a flowchart of the operation in the second embodiment of the present invention.
FIG. 7 is a configuration example of an IC card to which the present invention of one embodiment of the present invention is applied.
FIG. 8 is a diagram for explaining a flash memory of an IC card according to an embodiment of the present invention.
FIG. 9 is a functional block diagram realized by a CPU according to a control program stored in a ROM according to an embodiment of the present invention.
FIG. 10 is a combination example of region A and region B flags at the time of a reference request according to an embodiment of the present invention.
FIG. 11 is a combination example of flags of area A and area B at the time of an update request according to an embodiment of the present invention.
FIG. 12 is a state transition diagram in one embodiment of the present invention.
[Explanation of symbols]
100 Data management device
110 areas
120 Erasing means, erasing device
130 Reading means, reading device
135  Read destination area control means
140 Writing means, writing device
145  Write destination area control means
150 State management device
160 Request receiving means
170 State rewriting means
200 IC card
210 I / O
220 CPU
230 ROM
231 Data management device
232 Host device
240 RAM
250 flash memory
251 Region A
252 Region B

Claims (6)

データ更新による状態遷移に方向性の制限がある逆方向に遷移するために、一旦、消去という処理によって状態を初期状態へ戻すことが必要であるという特性を持った記憶装置におけるデータ更新中に、任意の時点で処理が中断されてもデータの保護を可能とするデータ管理方法であって
上位装置からデータの読み出し要求を受信するステップと、
前記記憶装置の領域Aのフラグ及び領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、読み出し先の領域を決定するステップと、
決定した領域からデータを読み出して、前記上位装置に転送するステップと
前記上位装置からデータの書き込み要求を受信するステップと
前記記憶装置の前記領域A、前記領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、書き込み先の領域を決定するステップと、
決定した領域にデータを書き込むステップと、を行う方法において、
前記読み出し先の領域を決定するステップでは、
前記記憶領域の前記領域Aのフラグが、A1,A2,A3、前記領域BのフラグがB1,B2,B3の状態をとり、該領域Aのフラグ及び該領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、読み出し先の領域を決定する際に、
前記領域Aのフラグが“A2”かつ、前記領域Bのフラグが“B1”ならば、該領域Aよりデータを読み出し、
前記領域Aのフラグが“A3”かつ、前記領域Bのフラグが“B1”ならば、該領域Aから必要なデータのみを該領域Bへコピーし、コピー完了後、該領域Bのフラグを“B2”へ変更し、該領域Aを消去し、消去完了後、該領域Bからデータを読み出し、
前記領域Aのフラグが“A3”かつ、前記領域Bのフラグが“B2”ならば、該領域Aを消去し、消去完了後、該領域Bからデータを読み出し、
前記領域Aのフラグが“A1”かつ、前記領域Bのフラグが“B2”ならば、該領域Bよりデータを読み出し、
前記領域Aのフラグが“A1”かつ、前記領域Bのフラグが“B3”ならば、該領域Bから必要なデータのみを該領域Aへコピーし、コピー完了後、該領域Aのフラグを“A2”へ変更し、該領域Bを消去し、消去完了後、該領域Aからデータを読み出し、
前記領域Aのフラグが“A2”かつ、前記領域Bのフラグが“B3”ならば、領域Bを消去し、消去完了後、該領域Aからデータを読み出す、
ことを特徴とするデータ管理方法。
During the data update in the storage device having the characteristic that it is necessary to return the state to the initial state by the process of erasure in order to make a transition in the reverse direction where there is a directionality limitation in the state transition by the data update, be treated at any time is interrupted by a data management method that can protect data,
Receiving a data read request from the host device ;
Referring to the flag of area A and the flag of area B of the storage device, and determining a read destination area based on a combination of the states of the flags ;
Reading data from the determined area and transferring it to the host device;
Receiving a data write request from the host device;
Referring to the flags of the area A and the area B of the storage device and determining a write destination area based on a combination of the states of the flags ;
And write no steps to write data to the determined area, a method of performing,
In the step of determining the readout area,
The flag of the area A of the storage area is A1, A2, A3, the flag of the area B is B1, B2, B3, and the flag of the area A and the flag of the area B are referred to. When determining the readout area based on the combination of states,
If the flag of the area A is “A2” and the flag of the area B is “B1”, data is read from the area A,
If the flag of the area A is “A3” and the flag of the area B is “B1”, only necessary data from the area A is copied to the area B, and after the copying is completed, the flag of the area B is set to “ Change to B2 ", erase the area A, read the data from the area B after erasure is completed,
If the flag of the area A is “A3” and the flag of the area B is “B2”, the area A is erased, and after the erase is completed, data is read from the area B,
If the flag of the area A is “A1” and the flag of the area B is “B2”, data is read from the area B,
If the flag of the area A is “A1” and the flag of the area B is “B3”, only necessary data from the area B is copied to the area A, and after the copying is completed, the flag of the area A is set to “ Change to A2 ", erase the area B, and after erasing is complete, read the data from the area A,
If the flag of the area A is “A2” and the flag of the area B is “B3”, the area B is erased, and data is read from the area A after the erasure is completed.
A data management method characterized by the above.
データ更新による状態遷移に方向性の制限がある逆方向に遷移するために、一旦、消去という処理によって状態を初期状態へ戻すことが必要であるという特性を持った記憶装置におけるデータ更新中に、任意の時点で処理が中断されてもデータの保護を可能とするデータ管理方法であって、
上位装置からデータの読み出し要求を受信するステップと、
前記記憶装置の領域Aのフラグ及び領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、読み出し先の領域を決定するステップと、
決定した領域からデータを読み出して、前記上位装置に転送するステップと
前記上位装置からデータの書き込み要求を受信するステップと
前記記憶装置の前記領域A、前記領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、書き込み先の領域を決定するステップと、
決定した領域にデータを書き込むステップと、を行う方法において、
前記書き込み先の領域を決定するステップでは、
前記記憶装置の前記領域Aのフラグが、A1,A2,A3、前記領域BのフラグがB1,B2,B3の状態をとり、該領域Aのフラグ及び該領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、書き込み先の領域を決定する際に、
前記領域Aのフラグが“A2”かつ、前記領域Bのフラグが“B1”ならば、該領域Aにデータを書き込み、一方、該領域Aに新たにデータを書き込む領域が存在しない場合は、該領域Aのフラグを“A3”へ更新し、該領域Aから必要なデータのみを該領域Bへコピーし、コピー完了後、該領域Bのフラグを“B2”へ変更し、該領域Aを消去し、消去完了後、該領域Bに書き込み、
前記領域Aのフラグが“A3”かつ、前記領域Bのフラグが“B1”ならば、該領域Aから必要なデータのみを該領域Bへコピーし、コピー完了後、該領域Bのフラグを“B2”へ変更し、該領域Aを消去し、消去完了後、該領域Bにデータを書き込み、
前記領域Aのフラグが“A3”かつ、前記領域Bのフラグが“B2”ならば、該領域Aを消去し、消去完了後、領域Bにデータを書き込み、
前記領域Aのフラグが“A1”かつ、前記領域Bのフラグが“B2”ならば、該領域Bにデータを書き込み、一方、該領域Bに新たにデータを書き込む領域が存在しない場合は、該領域Bのフラグを“B3”へ更新し、該領域Bから必要なデータのみを該領域Aへコピーし、コピー完了後、該領域Aのフラグを“A2”へ変更し、該領域Bを消去し、消去完了後、該領域Aにデータを書き込み、
前記領域Aのフラグが“A1”かつ、前記領域Bのフラグが“B3”ならば、該領域Bから必要なデータのみを該領域Aへコピーし、コピー完了後、該領域Aのフラグを“A2”へ変更し、該領域Bを消去し、消去完了後、該領域Aにデータを書き込み、
前記領域Aのフラグが“A2”かつ、前記領域Bのフラグが“B3”ならば、該領域Bを消去し、消去完了後、該領域Aにデータを書き込む、
ことを特徴とするデータ管理方法。
During the data update in the storage device having the characteristic that it is necessary to return the state to the initial state by the process of erasure in order to make a transition in the reverse direction where there is a directionality limitation in the state transition by the data update, A data management method that enables data protection even if processing is interrupted at an arbitrary time,
Receiving a data read request from the host device;
Referring to the flag of area A and the flag of area B of the storage device, and determining a read destination area based on a combination of the states of the flags;
Reading data from the determined area and transferring it to the host device ;
Receiving a data write request from the host device ;
Referring to the flags of the area A and the area B of the storage device and determining a write destination area based on a combination of the states of the flags;
A step of writing data to the determined area;
In the step of determining the write destination area,
The flag of the area A of the storage device is A1, A2, A3, the flag of the area B is B1, B2, B3, and the flag of the area A and the flag of the area B are referred to. When determining the write destination area based on the combination of states,
If the flag of the area A is “A2” and the flag of the area B is “B1”, data is written to the area A. On the other hand , if there is no area in which data is newly written, Update the flag of area A to “A3”, copy only necessary data from the area A to the area B, change the flag of the area B to “B2” after the copying is completed, and erase the area A Then, after erasing is completed, the area B is written,
If the flag of the area A is “A3” and the flag of the area B is “B1”, only necessary data from the area A is copied to the area B, and after the copying is completed, the flag of the area B is set to “ Change to B2 ", erase the area A, and after erasing is completed, write data to the area B,
If the flag of the area A is “A3” and the flag of the area B is “B2”, the area A is erased, and after erasing is completed, data is written to the area B,
If the flag of the area A is “A1” and the flag of the area B is “B2”, the data is written to the area B. On the other hand , if there is no area in which the data is newly written, Update the flag of area B to “B3”, copy only necessary data from the area B to the area A, change the flag of the area A to “A2” after the copying is completed, and erase the area B Then, after erasing is completed, data is written to the area A,
If the flag of the area A is “A1” and the flag of the area B is “B3”, only necessary data from the area B is copied to the area A, and after the copying is completed, the flag of the area A is set to “ Change to A2 ", erase the area B, and after erasing is complete, write data to the area A,
If the flag of the area A is “A2” and the flag of the area B is “B3”, the area B is erased, and data is written to the area A after the erasure is completed.
A data management method characterized by the above .
データ更新による状態遷移に方向性の制限がある逆方向に遷移するために、一旦、消去という処理によって状態を初期状態へ戻すことが必要であるという特性を持った記憶装置におけるデータ更新中に、任意の時点で処理が中断されてもデータの保護を可能とするデータ管理装置であって、
前記記憶装置内に、領域が使用中であるか待機中であるかの状態を示すフラグを持つデータ領域A、データ領域Bを有し、
上位装置からデータの読み出し要求及びデータの書き込み要求を受信する要求受信手段と、
前記読み出し要求を受信すると、前記記憶装置の領域Aのフラグ及び領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、読み出し先の領域を決定する読み出し先領域制御手段と、
前記読み出し先制御手段で決定した領域からデータを読み出して、前記上位装置に転送する読み出し手段と、
前記書き込み要求を受信すると、前記記憶装置の前記領域A、前記領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、書き込み先の領域を決定する書き込み先領域制御手段と、
前記書き込み先領域制御手段で決定した領域にデータを書き込む書き込み手段と、
を有し、
前記読み出し先領域制御手段は、
前記記憶装置の前記領域Aのフラグが、A1,A2,A3、前記領域BのフラグがB1,B2,B3の状態をとるとき、
前記領域Aのフラグが“A2”かつ、前記領域Bのフラグが“B1”ならば、領域Aから読み出すよう制御する手段と、
前記領域Aのフラグが“A3”かつ、前記領域Bのフラグが“B1”ならば、該領域Aから必要なデータのみを該領域Bへコピーし、コピー完了後、該領域Bのフラグを“B2”へ変更し、該領域Aを消去し、消去完了後、該領域Bからデータを読み出すよう制御する手段と、
前記領域Aのフラグが“A3”かつ、前記領域Bのフラグが“B2”ならば、該領域A を消去し、消去完了後、該領域Bからデータを読み出すよう制御する手段と、
前記領域Aのフラグが“A1”かつ、前記領域Bのフラグが“B2”ならば、該領域Bよりデータを読み出すよう制御する手段と、
前記領域Aのフラグが“A1”かつ、前記領域Bのフラグが“B3”ならば、該領域Bから必要なデータのみを該領域Aへコピーし、コピー完了後、該領域Aのフラグを“A2”へ変更し、該領域Bを消去し、消去完了後、該領域Aからデータを読み出すよう制御する手段と、
前記領域Aのフラグが“A2”かつ、前記領域Bのフラグが“B3”ならば、領域Bを消去し、消去完了後、該領域Aからデータを読み出すよう制御する手段と、
を有することを特徴とするデータ管理装置。
During the data update in the storage device having the characteristic that it is necessary to return the state to the initial state by the process of erasure in order to make a transition in the reverse direction where there is a directionality limitation in the state transition by the data update, A data management device that enables data protection even if processing is interrupted at an arbitrary time,
In the storage device, there are a data area A and a data area B having a flag indicating whether the area is in use or waiting,
Request receiving means for receiving a data read request and a data write request from the host device;
When the read request is received, a read destination area control unit that refers to a flag of the area A and a flag of the area B of the storage device and determines a read destination area based on a combination of the states of the flags;
Read means for reading data from the area determined by the read destination control means and transferring it to the host device;
When receiving the write request, referring to the flags of the area A and the area B of the storage device, a write destination area control means for determining a write destination area based on a combination of the states of the flags;
Writing means for writing data to the area determined by the writing destination area control means;
Have
The read destination area control means includes:
When the flag of the area A of the storage device is in the state of A1, A2, A3, and the flag of the area B is in the state of B1, B2, B3,
Means for controlling reading from the area A if the flag of the area A is “A2” and the flag of the area B is “B1”;
If the flag of the area A is “A3” and the flag of the area B is “B1”, only necessary data from the area A is copied to the area B, and after the copying is completed, the flag of the area B is set to “ Changing to B2 ″, erasing the area A, and controlling to read data from the area B after erasure is completed,
Means for erasing the area A if the flag of the area A is “A3” and the flag of the area B is “B2”, and reading data from the area B after completion of erasure;
Means for controlling to read data from the area B if the flag of the area A is “A1” and the flag of the area B is “B2”;
If the flag of the area A is “A1” and the flag of the area B is “B3”, only necessary data from the area B is copied to the area A, and after the copying is completed, the flag of the area A is set to “ Change to A2 ″, erase the area B, and control to read data from the area A after erasure is completed;
Means for erasing the area B if the flag of the area A is “A2” and the flag of the area B is “B3”, and reading data from the area A after the completion of erasure;
A data management apparatus comprising:
データ更新による状態遷移に方向性の制限がある逆方向に遷移するために、一旦、消去という処理によって状態を初期状態へ戻すことが必要であるという特性を持った記憶装置におけるデータ更新中に、任意の時点で処理が中断されてもデータの保護を可能とするデータ管理装置であって、
前記記憶装置内に、領域が使用中であるか待機中であるかの状態を示すフラグを持つデータ領域A、データ領域Bを有し、
上位装置からデータの読み出し要求及びデータの書き込み要求を受信する要求受信手段と、
前記読み出し要求を受信すると、前記記憶装置の領域Aのフラグ及び領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、読み出し先の領域を決定する読み出し先領域制御手段と、
前記読み出し先制御手段で決定した領域からデータを読み出して、前記上位装置に転送する読み出し手段と、
前記書き込み要求を受信すると、前記記憶装置の前記領域A、前記領域Bのフラグを参照し、該フラグの状態の組み合わせに基づいて、書き込み先の領域を決定する書き込み先領域制御手段と、
前記書き込み先領域制御手段で決定した領域にデータを書き込む書き込み手段と、
を有し、
前記書き込み先領域制御手段は、
前記記憶装置の前記領域Aのフラグが、A1,A2,A3、前記領域BのフラグがB1,B2,B3の状態をとるとき、
記領域Aのフラグが“A2”かつ、前記領域Bのフラグが“B1”ならば、該領域Aにデータを書き込み、一方、該領域Aに新たにデータを書き込む領域が存在しない場合は、該領域Aのフラグを“A3”へ更新し、該領域Aから必要なデータのみを該領域Bへコピーし、コピー完了後、該領域Bのフラグを“B2”へ変更し、該領域Aを消去し、消去完了後、該領域Bに書き込むよう制御する手段と、
前記領域Aのフラグが“A3”かつ、前記領域Bのフラグが“B1”ならば、該領域Aから必要なデータのみを該領域Bへコピーし、コピー完了後、該領域Bのフラグを“B2”へ変更し、該領域Aを消去し、消去完了後、該領域Bにデータを書き込むよう制御する手段と、
前記領域Aのフラグが“A3”かつ、前記領域Bのフラグが“B2”ならば、該領域Aを消去し、消去完了後、該領域Bにデータを書き込むよう制御する手段と、
前記領域Aのフラグが“A1”かつ、前記領域Bのフラグが“B2”ならば、該領域Bにデータを書き込み、一方、該領域Bに新たにデータを書き込む領域が存在しない場合は、該領域Bのフラグを“B3”へ更新し、該領域Bから必要なデータのみを該領域Aへコピーし、コピー完了後、該領域Aのフラグを“A2”へ変更し、該領域Bを消去し、消去完了後、該領域Aにデータを書き込むよう制御する手段と、
前記領域Aのフラグが“A1”かつ、前記領域Bのフラグが“B3”ならば、該領域Bから必要なデータのみを該領域Aへコピーし、コピー完了後、該領域Aのフラグを“A2”へ変更し、該領域Bを消去し、消去完了後、該領域Aにデータを書き込むよう制御する手段と、
前記領域Aのフラグが“A2”かつ、前記領域Bのフラグが“B3”ならば、該領域Bを消去し、消去完了後、該領域Aにデータを書き込むよう制御する手段と
有することを特徴とするデータ管理装置。
During the data update in the storage device having the characteristic that it is necessary to return the state to the initial state by the process of erasure in order to make a transition in the reverse direction where there is a directionality limitation in the state transition by the data update, A data management device that enables data protection even if processing is interrupted at an arbitrary time,
In the storage device, there are a data area A and a data area B having a flag indicating whether the area is in use or waiting,
Request receiving means for receiving a data read request and a data write request from the host device;
When the read request is received, a read destination area control unit that refers to a flag of the area A and a flag of the area B of the storage device and determines a read destination area based on a combination of the states of the flags;
Read means for reading data from the area determined by the read destination control means and transferring it to the host device;
When receiving the write request, referring to the flags of the area A and the area B of the storage device, a write destination area control means for determining a write destination area based on a combination of the states of the flags;
Writing means for writing data to the area determined by the writing destination area control means;
Have
The write destination area control means includes
Flag of the area A of the storage device, can the A1, A2, A3, flag of the area B takes the state of B1, B2, B3,
Flag and "A2" of the previous SL area A, if the flag is "B1" of the region B, the write data to the region A, on the other hand, if the area for writing new data to the region A does not exist, The flag of the area A is updated to “A3”, only necessary data from the area A is copied to the area B, and after the copy is completed, the flag of the area B is changed to “B2”. Means for erasing and controlling to write to the region B after completion of erasure;
If the flag of the area A is “A3” and the flag of the area B is “B1”, only necessary data from the area A is copied to the area B, and after the copying is completed, the flag of the area B is set to “ Changing to B2 ″, erasing the area A, and controlling to write data to the area B after erasure is completed,
Means for erasing the area A if the flag of the area A is “A3” and the flag of the area B is “B2”, and writing data into the area B after completion of erasure;
If the flag of the area A is “A1” and the flag of the area B is “B2”, the data is written to the area B. On the other hand , if there is no area in which the data is newly written, Update the flag of area B to “B3”, copy only necessary data from the area B to the area A, change the flag of the area A to “A2” after the copying is completed, and erase the area B And means for controlling to write data in the area A after completion of erasure;
If the flag of the area A is “A1” and the flag of the area B is “B3”, only necessary data from the area B is copied to the area A, and after the copying is completed, the flag of the area A is set to “ Change to A2 ″, erase the area B, and control to write data to the area A after the erase is completed;
Flag and "A2" of the area A, if the flag is "B3" of the region B, a means for controlling to write to erase the region B, after the completion of the erasing, the data in the region A,
A data management apparatus comprising:
コンピュータに、
請求項3または4記載のデータ管理装置の各手段を実行させることを特徴とするデータ管理プログラム。
On the computer,
5. A data management program that causes each means of the data management device according to claim 3 to be executed .
コンピュータに、
請求項3または4記載のデータ管理装置の各手段を実行させるデータ管理プログラムを格納したことを特徴とするデータ管理プログラムを格納した記憶媒体。
On the computer,
5. A storage medium storing a data management program, wherein a data management program for executing each means of the data management apparatus according to claim 3 is stored.
JP2001349184A 2001-11-14 2001-11-14 Data management method and apparatus, data management program, and storage medium storing data management program Expired - Lifetime JP3818130B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001349184A JP3818130B2 (en) 2001-11-14 2001-11-14 Data management method and apparatus, data management program, and storage medium storing data management program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001349184A JP3818130B2 (en) 2001-11-14 2001-11-14 Data management method and apparatus, data management program, and storage medium storing data management program

Publications (2)

Publication Number Publication Date
JP2003150441A JP2003150441A (en) 2003-05-23
JP3818130B2 true JP3818130B2 (en) 2006-09-06

Family

ID=19161892

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001349184A Expired - Lifetime JP3818130B2 (en) 2001-11-14 2001-11-14 Data management method and apparatus, data management program, and storage medium storing data management program

Country Status (1)

Country Link
JP (1) JP3818130B2 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100608602B1 (en) 2003-12-10 2006-08-03 삼성전자주식회사 Flash memory, Mapping controlling apparatus and method for the same
KR101097245B1 (en) * 2009-09-28 2011-12-21 삼성에스디아이 주식회사 Battery pack, and method for controlling an operation of data flash
JP2013003655A (en) * 2011-06-13 2013-01-07 Denso Corp Control device for writing data in flash memory
JP5660521B2 (en) * 2011-06-17 2015-01-28 株式会社デンソー Nonvolatile semiconductor memory device and memory management method
CN108984116B (en) * 2018-06-14 2021-07-20 浙江大华存储科技有限公司 Flow control method and device for garbage recovery bandwidth of solid state disk

Also Published As

Publication number Publication date
JP2003150441A (en) 2003-05-23

Similar Documents

Publication Publication Date Title
JP3797649B2 (en) Nonvolatile semiconductor memory device
US6154808A (en) Method and apparatus for controlling data erase operations of a non-volatile memory device
JP3534585B2 (en) Data storage control method and apparatus for external storage device using a plurality of flash memories
JP3526452B2 (en) Disk array device and data backup method
US7849253B2 (en) Method for fast access to flash-memory media
JP2008033788A (en) Nonvolatile storage device, data storage system, and data storage method
JPH117505A (en) Card type storage medium
JP2006018839A (en) Incremental merge method and memory systems using the same
WO1999032977A1 (en) Flash memory system
TW200915327A (en) Method of protecting data for power failure and controller using the same
WO2007000862A1 (en) Memory controller, nonvolatile storage device, nonvolatile storage system, and data writing method
KR100746198B1 (en) Apparatus and method for storing data, and readable recording medium thereof
JPH04312141A (en) File updating method for electronic printing system
JP3793868B2 (en) Flash memory management device and recording medium
CN109690465B (en) Storage device management method and user terminal
JP3818130B2 (en) Data management method and apparatus, data management program, and storage medium storing data management program
JP2003280979A (en) Information storage device
JP4308780B2 (en) Semiconductor memory device, memory controller, and data recording method
KR100932801B1 (en) Memory management methods, memory devices, and computer readable storage media
JPH113287A (en) Storage device and storage area management method used for the device
JP2007128448A (en) File system and file information processing method
KR100654344B1 (en) Memory device using flash memory and error correction method the same
KR100654343B1 (en) Memory device and error correction method using flash memory
JPH06309527A (en) Ic card
JP2004295759A (en) Recording system

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20060223

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060322

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060427

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: 20060523

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20060605

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

Ref document number: 3818130

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20090623

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20100623

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20100623

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20110623

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20120623

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20130623

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20140623

Year of fee payment: 8

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

EXPY Cancellation because of completion of term