JP4502689B2 - Data storage device and initialization method thereof - Google Patents
Data storage device and initialization method thereof Download PDFInfo
- Publication number
- JP4502689B2 JP4502689B2 JP2004117016A JP2004117016A JP4502689B2 JP 4502689 B2 JP4502689 B2 JP 4502689B2 JP 2004117016 A JP2004117016 A JP 2004117016A JP 2004117016 A JP2004117016 A JP 2004117016A JP 4502689 B2 JP4502689 B2 JP 4502689B2
- Authority
- JP
- Japan
- Prior art keywords
- block
- data
- area
- empty area
- recorded
- 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
Links
Images
Description
本発明は、ICメモリなど、コンピュータのデータを記憶するデータ記憶装置に関し、詳しくは、データ記憶装置内のデータの記録方式に関するものである。 The present invention relates to a data storage device for storing computer data, such as an IC memory, and more particularly to a data recording method in the data storage device.
従来、この種のデータ記憶装置では、ファイルシステムとしてFATが多く利用されている。FATを利用する場合には、データ記憶装置内の記憶領域は、ファイル管理領域と実データ記憶領域の2つの領域に分割される。ファイル管理領域には、ファイルの形で管理されている実際のデータの所在地を示すディレクトリエントリやFAT(ファイルアロケーションテーブル)情報が記録されており、コンピュータは、これらの情報を参照することによって実データ記憶領域内に記録されたファイルにアクセスすることができる。 Conventionally, in this type of data storage device, FAT is often used as a file system. When using the FAT, the storage area in the data storage device is divided into two areas, a file management area and an actual data storage area. In the file management area, directory entries indicating the location of actual data managed in the form of files and FAT (file allocation table) information are recorded, and the computer refers to these pieces of information to obtain actual data. A file recorded in the storage area can be accessed.
また、下記特許文献1に記載のように、従来のデータ記憶装置では、その記憶領域内に物理的な欠損が生じた場合に備えて、その欠損領域が存在するアドレスを記録するためのテーブルを記憶領域内の特定の位置に用意している。データ記憶装置は、欠損のある記憶領域を見い出すと、このテーブルにその情報を書き込んでおく。データ記憶装置は、コンピュータからの命令によって新たなデータを書き込む際、このテーブルを参照することにより、欠損領域に対するデータの書き込みを防止している。
In addition, as described in
しかし、上述した従来のデータ記憶装置では、コンピュータからファイルの書き込みや消去が行われる度にファイル管理領域内のディレクトリエントリやFAT情報が書き換えられる。そのため、ファイル管理領域という特定の領域にアクセスが集中し、かかる領域に物理的な欠損が生じやすいといった課題があった。また、特許文献1に記載の技術では、欠損領域のアドレスを記録するテーブルを用意する必要があるため、データ記憶装置内の記憶領域を効率よく利用することが困難であった。このような課題は、ICメモリに限らず、ハードディスクなど、他のデータ記憶装置にも共通の課題であった。
However, in the above-described conventional data storage device, the directory entry and FAT information in the file management area are rewritten whenever a file is written or erased from the computer. For this reason, there is a problem that access concentrates on a specific area called a file management area, and physical loss tends to occur in such area. Further, in the technique described in
本発明はこのような課題に鑑みてなされたものであり、データ記憶装置内の特定領域に対するアクセスの集中を抑えるとともに、データ記憶装置内の記憶領域全体を効率的に利用可能とすることを目的とする。 The present invention has been made in view of such problems, and an object thereof is to suppress concentration of access to a specific area in a data storage device and to efficiently use the entire storage area in the data storage device. And
上記目的を達成するため、本発明のデータ記憶装置を次のように構成した。すなわち、コンピュータのデータを記憶するデータ記憶装置であって、前記データを記憶する記憶部と、前記コンピュータからの命令に応じて前記記憶部に対するデータの書き込み、および、読み出しを制御する制御部とを備え、前記記憶部は、データの実体が記録されたデータブロックと、データの実体が記録されていない空領域ブロックとに区画された記憶領域を備え、前記データブロックは、他のデータブロックの所在アドレスを記録するためのデータ管理情報格納領域を当該データブロックと一体的に保持しており、前記空領域ブロックは、他の空領域ブロックの所在アドレスを記録するための空領域管理情報格納領域を当該空領域ブロックと一体的に保持しており、前記空領域ブロックの空領域管理情報格納領域には、該空領域ブロックのサイズを取得可能な情報が記録されており、前記空領域ブロックの空領域管理情報格納領域に記録された所在アドレス、および、該空領域ブロックのサイズを取得可能な情報は、前記記憶部内に存在する欠損領域を回避するように設定されていることを要旨とする。 In order to achieve the above object, the data storage device of the present invention is configured as follows. That is, a data storage device that stores data of a computer, a storage unit that stores the data, and a control unit that controls writing and reading of data to and from the storage unit according to instructions from the computer The storage unit includes a storage area partitioned into a data block in which an entity of data is recorded and an empty area block in which an entity of data is not recorded, and the data block is a location of another data block. A data management information storage area for recording an address is integrally held with the data block, and the empty area block has an empty area management information storage area for recording a location address of another empty area block. the free area blocks are integrally holds and, in free area management information storage area of the air-region block, the spatial region Bed Information that can acquire the size of the empty area block is recorded, and the location address recorded in the empty area management information storage area of the empty area block and the information that can acquire the size of the empty area block are stored in the storage area. The gist is that it is set so as to avoid a missing area in the part.
本発明のデータ記憶装置によれば、記憶部内に記録された各データブロックが、データ管理情報格納領域に記録された所在アドレスによって鎖状にリンクされることになる。そのため、この所在アドレスを辿ることにより、目的のデータにアクセスすることができる。このような構成とすることにより、ディレクトリエントリやFAT情報など、特定の領域に記録された管理情報を用いることなくデータの記録位置を管理することができるため、特定の領域に対するアクセスの集中を抑制することができる。また、本発明では空領域についてもデータブロックと同様の構造によって管理される。従って、複数の空領域が存在する場合にも、各空領域同士がリンクされるため、空領域の存在位置を容易に把握することが可能となる。 According to the data storage device of the present invention, each data block recorded in the storage unit is linked in a chain manner by the location address recorded in the data management information storage area. Therefore, the target data can be accessed by following the location address. By adopting such a configuration, it is possible to manage the recording position of data without using management information recorded in a specific area such as a directory entry or FAT information, thereby suppressing concentration of access to the specific area. can do. In the present invention, the empty area is also managed by the same structure as the data block. Therefore, even when there are a plurality of empty areas, the empty areas are linked to each other, so that the position of the empty area can be easily grasped.
前記空領域ブロックの空領域管理情報格納領域には、更に、該空領域ブロックのサイズを取得可能な情報が記録されるものとしてもよい。こうすることにより、空領域のサイズを容易に把握することができる。空領域ブロックのサイズを取得可能な情報とは、例えば、空領域ブロックのサイズそのものを表す情報や、空領域ブロックの終端アドレスを表す情報である。終端アドレスは、絶対アドレスによって指定するものとしてもよいし、オフセットアドレスのような相対的なアドレスによって指定するものとしてもよい。 In the empty area management information storage area of the empty area block, information capable of acquiring the size of the empty area block may be further recorded. In this way, the size of the empty area can be easily grasped. The information capable of acquiring the size of the empty area block is, for example, information indicating the size of the empty area block itself or information indicating the end address of the empty area block. The end address may be specified by an absolute address, or may be specified by a relative address such as an offset address.
このような構成において、前記空領域ブロックの前記空領域管理情報格納領域内の所在アドレス、および、該空領域ブロックのサイズを取得可能な情報は、前記記憶部内に存在する欠損領域を回避するように設定されているものとしてもよい。こうすることによって、欠損領域のアドレス情報を格納するためのテーブルを別途用意することなく、欠損領域を避けたデータの書き込みや読み込みを行うことが可能となる。従って、データ記憶装置内の記録領域全体を効率よく利用することが可能となる。 In such a configuration, the location address of the empty area block in the empty area management information storage area and the information from which the size of the empty area block can be acquired avoid the missing area existing in the storage unit. It is good also as what is set to. This makes it possible to write and read data avoiding the missing area without preparing a separate table for storing address information of the missing area. Therefore, the entire recording area in the data storage device can be used efficiently.
前記データブロックのデータ管理情報格納領域には、更に、該データブロックの種別を表す種別情報が記録されるものとしてもよい。種別情報としては、例えば、ファイル、ディレクトリ(フォルダ)、ボリュームのいずれかを表すパラメータを記録するものとすることができる。こうすることによって、記憶領域内に記録されたデータの種別を容易に把握することが可能となる。 In the data management information storage area of the data block, type information indicating the type of the data block may be further recorded. As the type information, for example, a parameter indicating any one of a file, a directory (folder), and a volume can be recorded. By doing so, it becomes possible to easily grasp the type of data recorded in the storage area.
前記データブロックのデータ管理情報格納領域に対して前記種別情報としてディレクトリを表すパラメータが記録される場合には、該データブロックのいずれかの領域に、更に、該ディレクトリ内に存在するファイルまたはディレクトリが格納されたデータブロックの所在アドレスが記録されるものとしてもよい。このような構成とすれば、ディレクトリ毎にデータブロックのリンクを構築することが可能となる。 When a parameter representing a directory is recorded as the type information in the data management information storage area of the data block, a file or directory existing in the directory is further stored in any area of the data block. The location address of the stored data block may be recorded. With such a configuration, it is possible to construct a data block link for each directory.
前記制御部は、前記コンピュータからデータの書き込み命令を受けた場合に、前記空領域ブロックが存在するいずれかの領域に、該データを記録した新たなデータブロックを配置し、該データブロックのデータ管理情報格納領域に対して他のデータブロックの所在アドレスを記録するとともに、該他のデータブロックのデータ管理情報格納領域に記録されている所在アドレスに対して、該新たなデータブロックの所在アドレスを記録するものとすることができる。こうすることによって前記記憶部に対するデータの書き込みを行うことができる。 The control unit, when receiving a data write command from the computer, arranges a new data block in which the data is recorded in any area where the empty area block exists, and manages data of the data block Record the location address of another data block in the information storage area, and record the location address of the new data block in relation to the location address recorded in the data management information storage area of the other data block. Can be. In this way, data can be written to the storage unit.
また、前記制御部は、更に、前記新たなデータブロックの配置によって前記空領域ブロックの所在アドレスが変動した場合に、該空領域ブロックの所在アドレスを空領域管理情報格納領域に記録していた他の空領域ブロックの空領域管理情報格納領域に対して前記変動後の所在アドレスを記録するものとしてもよい。こうすることにより、前記記憶部内の空領域のリンク状態を管理することができる。 Further, the control unit further records the location address of the empty area block in the empty area management information storage area when the location address of the empty area block changes due to the arrangement of the new data block. The location address after the change may be recorded in the empty area management information storage area of the empty area block. By doing so, the link state of the empty area in the storage unit can be managed.
また、本発明は、コンピュータのデータを記憶するデータ記憶装置の初期化方法として構成することができる。すなわち、データ記憶装置内の欠損領域を認識する工程と、前記データ記憶装置内の空領域を前記欠損領域に基づき分節する工程と、前記分節された各空領域の所定の領域に対して、当該空領域のサイズを取得可能な情報と他の分節された空領域の所在アドレスとを記録する工程とを備える初期化方法である。 The present invention can also be configured as an initialization method for a data storage device that stores computer data. That is, a step of recognizing a missing area in a data storage device, a step of segmenting an empty area in the data storage device based on the missing area, and a predetermined area of each segmented empty area, This is an initialization method including a step of recording information that can acquire the size of the empty area and the location address of another segmented empty area.
かかる初期化方法によって分節された各空領域が上述した空領域ブロックに相当する。このような初期化方法によれば、データ記憶装置の使用前に予め、欠損領域を回避するように空領域ブロックを配置することができる。データ記憶装置内の欠損領域を認識する方法としては、例えば、データ記憶装置内の全領域に対してデータの書き込みあるいは消去を行い、変化しないビットを検出することにより、欠損領域を認識することができる。また、データ記憶装置に内蔵されたメモリのメモリメーカによって提供された欠損領域に関する情報を参照して認識するものとしてもよい。 Each empty area segmented by the initialization method corresponds to the above-described empty area block. According to such an initialization method, empty area blocks can be arranged in advance so as to avoid missing areas before using the data storage device. As a method for recognizing a missing area in a data storage device, for example, writing or erasing data in the entire area in the data storage device and detecting a bit that does not change can be recognized. it can. Further, it may be recognized by referring to the information regarding the missing area provided by the memory manufacturer of the memory built in the data storage device.
本発明のデータ記憶装置は、例えば、ICメモリやハードディスクといった単体の補助記憶装置に対して適用することができる。また、コンピュータ本体と補助記憶装置とを含むコンピュータシステム全体に対しても適用することもできる。また、本発明は、上述したデータ記憶装置としての構成のみならず、例えば、データ記憶装置におけるデータの記録方法やデータを記憶するためのコンピュータプログラムなどとしても構成することができる。コンピュータプログラムは、コンピュータが読み取り可能な記録媒体に記録するものとしてもよい。記録媒体としては、例えば、フレキシブルディスクやCD−ROM、DVD−ROM、光磁気ディスク、メモリカード、ハードディスク等の種々の媒体を利用することができる。 The data storage device of the present invention can be applied to a single auxiliary storage device such as an IC memory or a hard disk. The present invention can also be applied to the entire computer system including the computer main body and the auxiliary storage device. Further, the present invention can be configured not only as the above-described data storage device but also as, for example, a data recording method in the data storage device or a computer program for storing data. The computer program may be recorded on a computer-readable recording medium. As the recording medium, for example, various media such as a flexible disk, a CD-ROM, a DVD-ROM, a magneto-optical disk, a memory card, and a hard disk can be used.
以下、本発明の実施の形態について実施例に基づき次の順序で説明する。
A.データ記憶装置の構成:
B.データの記録方法:
C.ファイルアクセス処理:
(C1)読み出し処理:
(C2)消去処理:
(C3)書き込み処理:
D.その他の実施例:
Hereinafter, embodiments of the present invention will be described in the following order based on examples.
A. Data storage device configuration:
B. How to record data:
C. File access processing:
(C1) Read processing:
(C2) Erasing process:
(C3) Write processing:
D. Other examples:
A.データ記憶装置の構成:
図1は、本発明の一実施例としてのデータ記憶装置100の構成を示す説明図である。データ記憶装置100は、パーソナルコンピュータ(以下、単に「コンピュータ」と記載する)のデータを記憶するための補助記憶装置であり、コンピュータのUSBポートに接続されるUSBコネクタ110や、USBデバイスコントローラ120、制御部130、データを不揮発的に記憶するフラッシュメモリ140などによって構成される。
A. Data storage device configuration:
FIG. 1 is an explanatory diagram showing a configuration of a
USBデバイスコントローラ120は、コンピュータに備えられたUSBホストコントローラとUSB(ユニバーサルシリアスバス)規格に準拠した通信を行うことで、コンピュータとデータ記憶装置100間におけるデータや命令の送受信を仲介する。本実施例では、このようにUSB規格に基づきコンピュータと通信を行うものとしたが、例えば、ATA規格やIEEE1394規格など、他の規格に基づき通信を行うようにしてもよい。
The
制御部130は、コンピュータからUSBデバイスコントローラ120を介して受信した命令に従い、フラッシュメモリ140に対するデータの書き込みや読み出しを制御する。制御部130は、CPU131とRAM132とROM133によって構成されており、ROM133には、データ記憶装置100の動作を制御するためのプログラムが記録されている。CPU131は、RAM132を作業領域として用いながらこのプログラムを実行することによりデータの書き込みや読み出しの制御を行う。
The
フラッシュメモリ140は、NAND型のフラッシュメモリであり、本実施例では、32Mバイトの記憶容量を有するものとする。フラッシュメモリ140は、書き込みや読み出しを行うデータを一時的に格納する512バイト分のデータレジスタと2048個のブロック領域とからなる。1つのブロック領域は、更に、32ページの領域に分割されており、1ページあたり512バイトの記憶容量を有する。
The
B.データの記録方法:
図2は、フラッシュメモリ140内のアドレス空間のイメージを示す説明図である。本実施例では、図2に示すように、制御部130は、フラッシュメモリ140内のアドレス空間をリング状に扱う。つまり、終端アドレスMXにアドレス数を1つ加算すると、加算後のアドレスが先頭アドレス0となる。
B. How to record data:
FIG. 2 is an explanatory diagram showing an image of the address space in the
図3は、このアドレス空間中に格納されるデータの構造を示す説明図である。本実施例のデータ記憶装置100は、すべてのデータを、図3に示す「データブロック」という形式によりアドレス空間中に格納する。なお、このデータブロックは、図1に示した「ブロック領域」とは異なる語である。
FIG. 3 is an explanatory diagram showing the structure of data stored in this address space. The
データブロックは、固定長の管理情報格納領域MAと可変長のデータ格納領域DAとを一体的に備えている。制御部130は、例えば、コンピュータからファイルの書き込み命令を受けた場合には、そのファイルをデータ格納領域DAに記録するとともに、管理情報格納領域MAに対して後述する所定の情報を記録する。そして、これらの情報からなるデータブロックをアドレス空間中に配置する。
The data block integrally includes a fixed-length management information storage area MA and a variable-length data storage area DA. For example, when receiving a file write command from the computer, the
管理情報格納領域MAには、前方リンクアドレスLfや後方リンクアドレスLb、データブロックの種別を表す種別情報Fa、データブロック全体のサイズSdが記録される。これらの情報は、すべて固定長の情報である。なお、サイズSdに替えて、データブロックの終端アドレスを記録するものとしてもよい。この場合、終端アドレスは、絶対アドレスによって記録してもよいし、データブロックの先頭アドレスからのオフセットアドレスによって記録してもよい。 In the management information storage area MA, the forward link address Lf and the backward link address Lb, the type information Fa indicating the type of the data block, and the size Sd of the entire data block are recorded. These pieces of information are all fixed length information. The end address of the data block may be recorded instead of the size Sd. In this case, the end address may be recorded as an absolute address, or may be recorded as an offset address from the head address of the data block.
前方リンクアドレスLfには、当該データブロックの前に存在するデータブロックの先頭アドレスが記録され、後方リンクアドレスLbには、当該データブロックの後に存在するデータブロックの先頭アドレスが記録される。「前」、「後」とは、アドレス空間上の記録位置の前後をいうわけではなく、これらのリンクアドレスによってデータブロック同士がリンクされる順序のことをいう。 The leading address of the data block existing before the data block is recorded in the forward link address Lf, and the leading address of the data block existing after the data block is recorded in the backward link address Lb. “Before” and “after” do not mean before and after the recording position in the address space, but the order in which the data blocks are linked by these link addresses.
図4は、リンクアドレスLf,Lbによるデータブロックのリンク状態の例を示す説明図である。例えば、図4に示すデータブロック2の前方リンクアドレスLfには、データブロック3の先頭アドレスである「a3」が記録され、後方リンクアドレスLbには、データブロック1の先頭アドレスである「a1」が記録されている。そのため、図4に示した例では、各データブロックが、データブロック1,データブロック2,データブロック3の順にリンクされていることとなる。制御部130は、アドレス空間中のアクセス位置を、このようなリンクアドレスLf,Lbを参照して移動させることにより、所望のデータブロックにアクセスすることができる。
FIG. 4 is an explanatory diagram showing an example of the link state of the data block by the link addresses Lf and Lb. For example, “a3” that is the head address of the data block 3 is recorded in the forward link address Lf of the data block 2 shown in FIG. 4, and “a1” that is the head address of the data block 1 is recorded in the backward link address Lb. Is recorded. Therefore, in the example shown in FIG. 4, each data block is linked in the order of
図4のデータブロック2の先頭アドレスa2は、データブロック1の前方リンクアドレスLfによって参照され、さらにデータブロック3の後方リンクアドレスLbによって参照されている。すなわち、各データブロックは、双方向にリンクされていることとなる。このように個々のデータブロックが双方向にリンクされているものとすれば、データの検索性が向上し、さらに、リンクの正当性の検証を容易に行うことが可能となる。
The head address a2 of the data block 2 in FIG. 4 is referred to by the forward link address Lf of the
図3に示した種別情報Faには、データブロックの種別を表すパラメータが記録される。データブロックの種別には、ボリュームブロックと、ファイルブロックと、ディレクトリブロックと、空領域ブロックとがあり、それぞれを表すパラメータは、「fv」「ff」「fd」「fn」である。 In the type information Fa shown in FIG. 3, a parameter indicating the type of data block is recorded. Types of data blocks include volume blocks, file blocks, directory blocks, and empty area blocks, and parameters representing each are “fv”, “ff”, “fd”, and “fn”.
図5〜8には、データブロックの種別毎のデータ構造を示している。図5は、ボリュームブロックのデータ構造を示す説明図である。ボリュームブロックは、ボリューム情報を格納するためのデータブロックである。種別情報Faには「fv」と記録され、そのデータ格納領域DAには、ボリュームラベルやボリュームシリアル番号などが記録される。 5 to 8 show the data structure for each type of data block. FIG. 5 is an explanatory diagram showing the data structure of the volume block. The volume block is a data block for storing volume information. “Fv” is recorded in the type information Fa, and a volume label, a volume serial number, and the like are recorded in the data storage area DA.
図6は、ファイルブロックのデータ構造を示す説明図である。ファイルブロックは、ファイルを格納するためのデータブロックである。種別情報には、「ff」と記録され、データ格納領域DAには、ファイルの実体や、ファイル名、作成日時などが記録される。 FIG. 6 is an explanatory diagram showing the data structure of the file block. A file block is a data block for storing a file. In the type information, “ff” is recorded, and in the data storage area DA, the file entity, file name, creation date and time, and the like are recorded.
図7は、ディレクトリブロックのデータ構造を示す説明図である。ディレクトリブロックは、ディレクトリの情報を格納するためのデータブロックである。種別情報には「fd」と記録され、データ格納領域DAには、ディレクトリ名や、その作成日時などが記録される。また、データ格納領域DAには、第2前方リンクアドレスLf2と、第2後方リンクアドレスLb2とが記録される。これらのリンクアドレスLf2,Lb2には、そのディレクトリ内に存在するファイルやサブディレクトリの格納されたデータブロックの先頭アドレスが記録される。なお、このディレクトリブロックによって表されるディレクトリ内にファイルやサブディレクトリが存在しない場合には、第2前方リンクアドレスLf2と第2後方リンクアドレスLb2とには、両者とも、当該ディレクトリブロックの先頭アドレスが記録される。 FIG. 7 is an explanatory diagram showing the data structure of the directory block. The directory block is a data block for storing directory information. “Fd” is recorded in the type information, and the directory name and the date and time of creation thereof are recorded in the data storage area DA. In the data storage area DA, a second front link address Lf2 and a second rear link address Lb2 are recorded. In these link addresses Lf2 and Lb2, the head addresses of data blocks storing files and subdirectories existing in the directory are recorded. If no file or subdirectory exists in the directory represented by the directory block, both the second front link address Lf2 and the second rear link address Lb2 have the head address of the directory block. To be recorded.
図8は、空領域ブロックのデータ構造を示す説明図である。空領域ブロックは、そのデータブロックの存在する領域が空領域であることを表すデータブロックである。種別情報には「fn」と記録され、初期状態では、データ格納領域DAに、空であることを示すNilデータ(例えば「00」)が記録される。このように種別情報に「fn」と記録されたデータブロックが、特許請求の範囲に記載した「空領域ブロック」に相当する。 FIG. 8 is an explanatory diagram showing the data structure of the empty area block. The empty area block is a data block indicating that the area where the data block exists is an empty area. In the type information, “fn” is recorded, and in the initial state, Nil data (for example, “00”) indicating that it is empty is recorded in the data storage area DA. Thus, the data block in which “fn” is recorded in the type information corresponds to the “empty area block” described in the claims.
図9は、フラッシュメモリ140内に欠損領域がない場合におけるアドレス空間の初期状態を示す説明図である。フラッシュメモリ140内に欠損領域がない場合は、そのアドレス空間には、初期状態で1つのボリュームブロックと1つの空領域ブロックとが存在する。ボリュームブロックの前方リンクアドレスLfは、空領域ブロックの先頭アドレスa1を参照しており、後方リンクアドレスLbも空領域ブロックの先頭アドレスa1を参照している。これは、前述したようにアドレス空間がリング状に形成されているためである。同様に、空領域ブロックの前方リンクアドレスLfと後方リンクアドレスLbも、共に、ボリュームブロックの先頭アドレスa0を参照している。なお、本実施例では、アドレスa0はフラッシュメモリ140の物理アドレスの先頭を示すものとするが、任意のアドレス値を採るものとしてもよい。
FIG. 9 is an explanatory diagram showing the initial state of the address space when there is no missing area in the
図10は、フラッシュメモリ140内に欠損領域がある場合におけるアドレス空間の初期状態を示す説明図である。欠損領域とは、フラッシュメモリ140を構成するメモリセルに物理的な損傷が生じている領域をいう。図10には、初期状態で欠損領域が2箇所存在している場合を示している。このような場合には、図中に示すように、空領域ブロックは、初期状態で3つ存在することになる(空領域ブロック1〜3)。
FIG. 10 is an explanatory diagram showing the initial state of the address space when there is a missing area in the
空領域ブロック1の前方リンクアドレスLfは空領域ブロック2の先頭アドレスa3を示しており、後方リンクアドレスLbはボリュームブロックの先頭アドレスa0を示している。空領域ブロック2の前方リンクアドレスLfは空領域ブロック3の先頭アドレスa5を示しており、後方リンクアドレスLbは空領域ブロック1の先頭アドレスa1を示している。空領域ブロック3の前方リンクアドレスLfはボリュームブロックの先頭アドレスa0を示しており、後方リンクアドレスLbは空領域ブロック2の先頭アドレスa3を示している。つまり、空領域ブロック1〜3は、それぞれ相互にリンクされており、その先端(空領域ブロック1)と終端(空領域ブロック3)とがボリュームブロックにリンクされるように設定されている。
The forward link address Lf of the
空領域ブロック1および空領域ブロック2のサイズSdは、それぞれ欠損領域を回避するように設定されている。例えば、空領域ブロック1のサイズSdには、アドレスa3の値とアドレスa1の値との差から、さらに、欠損領域1のサイズを差し引いた値が記録される。
The size Sd of the
欠損領域を回避して図10のように空領域ブロックを配置するためには、制御部130は次のような初期化処理を行う。まず、最初に、アドレス空間内に存在する欠損領域を認識する処理を行う。かかる認識処理は、例えば、アドレス空間の全てのビットを「0」から「1」、または「1」から「0」に書き換えて、変化しないビットを検出し、こうして検出されたビットが存在する領域を欠損領域として認識する方法を採ることができる。その他にも、例えば、フラッシュメモリ140を製造するチップメーカによって提供された欠損領域に関する情報を参照する方法により行うこともできる。通常、フラッシュメモリ140には、このような情報が所定の領域に予め書き込まれて出荷されている。そのため、制御部130は、かかる情報をフラッシュメモリ140から読み出すことにより、欠損領域を認識することができる。
In order to avoid the missing area and arrange the empty area block as shown in FIG. 10, the
次に、ボリュームブロックを先頭アドレスに配置し、このボリュームブロックと上述した方法により認識された欠損領域とによって全アドレス空間を分節する。そして、こうして分節された各アドレス空間を空領域ブロックに変換させる処理を行う。かかる処理では、各アドレス空間の先頭アドレスから、属性情報に「fn」と記録した管理情報格納領域MAをそれぞれ配置する。この管理情報格納領域MAには、分節された各アドレス空間のサイズSdを記録し、さらに、それぞれの空領域ブロックが相互にリンクされるように、前方リンクアドレスLfや後方リンクアドレスLbを設定する。以上のような処理により、制御部130は、アドレス空間の初期化を行うことができる。
Next, a volume block is arranged at the head address, and the entire address space is segmented by this volume block and the missing area recognized by the above-described method. Then, a process for converting each segmented address space into an empty area block is performed. In such processing, the management information storage area MA in which “fn” is recorded in the attribute information is arranged from the head address of each address space. In this management information storage area MA, the size Sd of each segmented address space is recorded, and further, the forward link address Lf and the backward link address Lb are set so that the respective empty area blocks are linked to each other. . Through the processing as described above, the
図11は、欠損領域が1つ存在する場合において上述した種々のデータブロックがアドレス空間中に配置された具体例を便宜的にリング状に示す説明図である。最も内周のリングは空領域ブロックの配置を表しており、その外周にはルートディレクトリに存在するデータブロックの配置を表している。更にその外周や、最外周には、サブディレクトリに存在するデータブロックの配置を表している。アドレス空間上、不連続な前方リンクについては矢印によって示し、後方リンクについては省略している。図12には、図11に示した各データブロックのリンク状態によって実現されるディレクトリ構造をツリー状に表している。 FIG. 11 is an explanatory diagram showing a specific example in which the above-described various data blocks are arranged in the address space in a ring shape for the sake of convenience when there is one missing region. The innermost ring represents the arrangement of empty area blocks, and the outer circumference represents the arrangement of data blocks existing in the root directory. Further, the outer circumference and the outermost circumference represent the arrangement of data blocks existing in the subdirectory. In the address space, discontinuous front links are indicated by arrows, and rear links are omitted. FIG. 12 shows a directory structure realized by the link state of each data block shown in FIG. 11 in a tree shape.
図11に示した例では、アドレス空間の先頭アドレスにボリュームブロックfvが存在し、このボリュームブロックfvは、ルートディレクトリに存在するファイルブロックf1にリンクされている。ルートディレクトリには、ファイルブロックf1以外にも,ファイルブロックf2,f8、および、ディレクトリブロックd1,d3が存在する。このうち、ファイルブロックf8は、欠損領域を避けるように2つの領域に跨って格納されている。ディレクトリブロックd1には、ファイルブロックf3,f4,f5,f9およびディレクトリブロックd2がリンクされている。このうち、ディレクトリブロックd2には、更に、ファイルブロックf6,f7がリンクされている。一方、ディレクトリブロックd3には、ファイルやディレクトリがリンクされておらず空ディレクトリであることを表している。ディレクトリブロックd3は、ファイルブロックとディレクトリブロックとによって構成されるリンクの終端に位置している。そのため、ディレクトリブロックd3には、空領域ブロックn1がリンクされている。空領域ブロックn1は、空領域ブロックn2にリンクされ、空領域ブロックn2は、最終的に、ボリュームブロックfvにリンクされている。 In the example shown in FIG. 11, a volume block fv exists at the head address of the address space, and this volume block fv is linked to a file block f1 existing in the root directory. In the root directory, there are file blocks f2 and f8 and directory blocks d1 and d3 in addition to the file block f1. Of these, the file block f8 is stored across two areas so as to avoid a missing area. File block f3, f4, f5, f9 and directory block d2 are linked to the directory block d1. Among these, file blocks f6 and f7 are further linked to the directory block d2. On the other hand, the directory block d3 indicates that the file or directory is not linked and is an empty directory. The directory block d3 is located at the end of a link constituted by a file block and a directory block. Therefore, the empty block n1 is linked to the directory block d3. The empty area block n1 is linked to the empty area block n2, and the empty area block n2 is finally linked to the volume block fv.
以上、本実施例におけるデータの記録方法について説明した。本実施例では、上述したように、全てのデータを図3に示したデータブロックによって記録する。このような記録方法によっても、ディレクトリを用いた階層構造によりファイルの記録を行うことができる(図11および図12参照)。そのため、コンピュータは、ディレクトリ構造を採用する従来のファイルシステムと同様のファイルアクセス方法によって本実施例のデータ記憶装置100を扱うことが可能となる。
The data recording method in the present embodiment has been described above. In this embodiment, as described above, all data is recorded by the data block shown in FIG. Even with such a recording method, files can be recorded in a hierarchical structure using directories (see FIGS. 11 and 12). Therefore, the computer can handle the
C.ファイルアクセス処理:
図13は、コンピュータからの命令に応じて制御部130により実行されるファイルアクセス処理のフローチャートである。制御部130はコンピュータからファイルアクセスに関する命令を受信すると(ステップS100)、その命令の種別を判別する(ステップS110)。
C. File access processing:
FIG. 13 is a flowchart of file access processing executed by the
(C1)読み出し処理:
コンピュータから読み出し命令を受信した場合には(ステップS110:「読出」)、制御部130は、読み出しを行うファイルのファイル名をコンピュータから受信する(ステップS120)。そして、受信したファイル名が記録されており、かつ、種別情報として「ff」と記録されたデータブロックの検索を行う(ステップS130)。この検索は、前方リンクアドレスLfによって参照されたアドレスをボリュームブロックから順に辿ることで行う。例えば、図11において、ファイルブロックf2に目的のファイルが記録されている場合には、ボリュームブロックfv、ファイルブロックf1、ファイルブロックf2の順に検索されることとなる。なお、このとき、前方リンクアドレスLfだけではなく、後方リンクアドレスLbも同時に辿ることで、双方向から検索を行うものとしてもよい。
(C1) Read processing:
When a read command is received from the computer (step S110: “read”), the
上記ステップS120において、コンピュータからファイル名ではなくパス名を受信した場合には、そのパスに含まれるディレクトリを順に検索した上で、目的のファイルを検索する。例えば、「dir1/file1」というパス名を受信した場合には、最初に「dir1」というディレクトリ名の記録されたディレクトリブロックを検索し、次に、そのディレクトリブロックの第2前方リンクアドレスLf2を辿って、file1というファイル名が記録されたファイルブロックを検索する。 In step S120, when a path name instead of a file name is received from the computer, the target file is searched after sequentially searching the directories included in the path. For example, when the path name “dir1 / file1” is received, the directory block in which the directory name “dir1” is recorded is searched first, and then the second forward link address Lf2 of the directory block is traced. The file block in which the file name “file1” is recorded is searched.
こうして目的のファイルが検索されると、制御部130は、検索されたデータブロックのデータ格納領域DAに記録されたファイルを、USBデバイスコントローラ120を介してコンピュータに送信する(ステップS140)。ファイルが検索されなかった場合には、ファイルが存在しない旨のエラーをコンピュータに送信する。
When the target file is searched in this way, the
(C2)消去処理:
上記ステップS100において、コンピュータから消去命令を受信した場合には(ステップS110:「消去」)、制御部130は、消去を行うファイルのファイル名をコンピュータから受信する(ステップS150)。そして、このファイル名の記録されたファイルブロックを検索する(ステップS160)。検索方法は、上述したファイルの読み出しの場合と同様である。
(C2) Erasing process:
If an erasure command is received from the computer in step S100 (step S110: “Erase”), the
目的のファイルブロックが検索されると、まず、制御部130は、検索されたファイルブロックの種別情報を「ff」から「fn」に書き換える(ステップS170)。こうすることで、ファイル属性の付されていたデータブロックが空領域属性に変換されるため、形式的にファイルが消去され、新たな空領域ブロックが生成されることになる。このとき、新たに生成された空領域ブロックのデータ格納領域DA全体を、Nilデータに書き換えるものとすれば、完全にファイル内容を消去することができる。しかし、本実施例では、処理の簡略化のためこのような書き換えは行わない。
When the target file block is searched, first, the
次に、制御部130は、ファイルブロックが消去されたことに伴うリンクアドレスの変更処理を行う(ステップS180)。図14は、かかる変更処理の具体例を示す説明図である。図14には、3つのファイルブロック(ファイルブロック1〜3)と1つの空領域ブロック(空領域ブロック1)とがリンクされている様子を示しており、このうちファイルブロック2を消去する場合について考える。まず、制御部130は、ファイルブロック2の種別情報Faを「ff」から「fn」に書き換えることで、その種別を空領域ブロックに変換する。次に、こうして生成された空領域ブロック2を空領域ブロック1の後にリンクさせるための処理を行う。具体的には、まず、空領域ブロック1の前方リンクアドレスLfを、空領域ブロック2の先頭アドレスa4に書き換える。空領域ブロック1の後方リンクアドレスLbについては、ファイルブロック3の存在位置の変動がないため、そのままアドレス値を維持する。そして、空領域ブロック2の前方リンクアドレスLfを、ボリュームブロックの先頭アドレスa0を参照するように設定し、後方リンクアドレスLbを、空領域ブロック1の先頭アドレスa6を参照するように設定する。
Next, the
次に、制御部130は、ファイルブロック2を参照していたファイルブロック1およびファイルブロック3のリンクアドレスを変更する処理を行う。具体的には、ファイルブロック1の前方リンクアドレスLfをファイルブロック2の先頭アドレスa4からファイルブロック3の先頭アドレスa5に書き換える。そして、更に、ファイルブロック3の後方リンクアドレスLbをファイルブロック2の先頭アドレスからファイルブロック1の先頭アドレスa3に書き換える。以上の処理により、ファイルブロック2の消去に伴う各データブロックのリンクアドレスの変更が終了する。図中には、以上の処理によって変更されたリンクアドレスに「*」マークを付して示している。
Next, the
なお、上述した消去処理では、ファイルを消去する場合について説明したが、ディレクトリを消去する場合にも同様の処理が行われる。ディレクトリを削除する場合には、そのデータ格納領域DAに記録された第2前方リンクアドレスLf2や第2後方リンクアドレスLb2によってリンクされている他のファイルやディレクトリの消去も一括して行うようにしてもよい。また、ディレクトリ内にファイルやサブディレクトリが存在する場合には、それらが全て消去されるまで、そのディレクトリを消去しないものとしてもよい。 In the above-described erasure process, the case of erasing a file has been described, but the same process is performed when a directory is erased. When a directory is deleted, other files and directories linked by the second forward link address Lf2 and the second backward link address Lb2 recorded in the data storage area DA are also erased collectively. Also good. Further, when files and subdirectories exist in the directory, the directory may not be deleted until all of them are deleted.
(C3)書き込み処理:
次に、書き込み処理について説明する。制御部130は、上記ステップS100において、書き込み命令を受信した場合には(ステップS110:「書込」)、書き込みを行うファイルをコンピュータから受信する(ステップS190)。そして、各データブロックの前方リンクアドレスLfを辿ることにより空領域ブロックの検索を行う(ステップS200)。かかる検索は、属性情報Faに「fn」と記録されたデータブロックを検索することにより行う。空領域ブロックが検索されなかった場合には、空領域が存在しない旨のエラーをコンピュータに送信して当該ファイルアクセス処理を終了する。
(C3) Write processing:
Next, the writing process will be described. When the write instruction is received in Step S100 (Step S110: “Write”), the
次に、制御部130は、検索された空領域ブロックに対して、受信したファイルの書き込みを行う(ステップS210)。図15は、かかる書き込み処理の具体例を示す説明図である。図15には、ファイルブロック1と空領域ブロック1とが存在するアドレス空間中に新たなファイルブロック2を書き込む場合を示している。
Next, the
まず、上記ステップS200によって空領域ブロック1が検索されると、制御部130は、この空領域ブロック1に対して、上記ステップS190において受信したファイルの書き込みを行う。具体的には、上記ステップS190において受信したファイルをデータ格納領域DAに格納するとともに、属性情報Faに対して「ff」と記録したファイルブロック2を、図の下部に示すように、空領域ブロック1の先頭アドレスから書き込む。そして、ファイルブロック2の書き込みによって上書きされた空領域ブロック1の管理情報格納領域MAを、残存した空領域の先頭に移動させる。なお、本実施例では、空領域ブロックの先頭アドレスから新たなファイルブロックを書き込むものとしたが、空領域ブロックの終端から書き込むものとしてもよい。
First, when the
次に、制御部130は、ファイルブロック2の書き込みに伴う各データブロックのリンクアドレスを変更する処理を行う。具体的には、まず、ファイルブロック2の前方リンクアドレスLfに対して、空領域ブロック1の先頭アドレスa5を書き込み、後方リンクアドレスLbに対して、ファイルブロック1の先頭アドレスa3を書き込む。次に、空領域ブロック1の前方リンクアドレスLfに対して、ボリュームブロックの先頭アドレスa0を書き込み、後方リンクアドレスLbに対して、新たに書き込まれたファイルブロック2の先頭アドレスa4を書き込む。また、空領域ブロック1のサイズSdに対して、新たなサイズを書き込む。ファイルブロック1については、前方リンクアドレスLfおよび後方リンクアドレスLbとも変動がないため、リンクアドレスの変更は行わない。以上の処理により、新たなファイルブロック2の書き込み処理は終了する。
Next, the
なお、上記ステップS190によって受信したファイルのサイズが、上記ステップS200で検索された空領域ブロックのサイズ(正確には、当該空領域ブロックのデータ格納領域DAのサイズ)よりも大きな場合には、上記ステップS200において、更に、当該ファイルのサイズを超える他の空領域ブロックを検索するものとしてもよい。また、このような検索によっても空領域ブロックが検索されない場合には、複数の空領域ブロックを用いてファイルの書き込みを行うものとしてもよい。かかる場合には、上記ステップS190において受信したファイルを分割し、分割されたファイルの断片を各空領域ブロックに格納する。このとき、各空領域ブロックの種別情報に対しては、そのデータブロックにファイルの断片が格納されていることを示すパラメータ(例えば、「fg」)を記録する。こうすることにより、複数の空領域ブロックに跨るファイルの書き込みを行うことができる。 If the size of the file received in step S190 is larger than the size of the empty area block searched in step S200 (more precisely, the size of the data storage area DA of the empty area block), In step S200, another empty area block exceeding the size of the file may be searched. In addition, when an empty area block is not searched by such a search, a file may be written using a plurality of empty area blocks. In such a case, the file received in step S190 is divided, and the fragment of the divided file is stored in each empty area block. At this time, for the type information of each empty area block, a parameter (for example, “fg”) indicating that a file fragment is stored in the data block is recorded. By doing so, it is possible to write a file across a plurality of empty area blocks.
上述したステップS210におけるファイルの書き込み処理が終了すると、制御部130は、書き込んだファイルと、コンピュータから受信したファイルとをビット単位で比較することによりベリファイを行う(ステップS220)。ベリファイとは、ファイルが正常に書き込まれているか否かを判断するための処理である。このベリファイ処理は、上記ステップS210における書き込み処理と同時に実行するものとしてもよい。ベリファイによってファイルが正常に書き込まれたと判断した場合には(ステップS230:Yes)、制御部130は、ファイルアクセス処理を終了する。ファイルが正常に書き込まれていないと判断した場合には(ステップS230:No)、書き込みを行った領域内に欠損が発生していると判断し、以後のファイルアクセス処理において、この欠損領域が用いられないようにするため、ステップS210による書き込みを元に戻した上で欠損回避処理を行う(ステップS240)。
When the file writing process in step S210 is completed, the
図16は、欠損回避処理の概念を示す説明図である。上記ステップS220におけるベリファイによって、図16の上部に示す空領域ブロック1の中に3バイト分の欠損領域が検出されたとする。すると、制御部130は、図16の下部に示すように、この3バイト分の欠損領域を回避するように、空領域ブロック1を2つの空領域ブロック(空領域ブロック1および空領域ブロック2)に分割する。そして、空領域ブロック1と新たに生成された空領域ブロック2のリンクアドレスを相互に参照するように設定し、空領域ブロック1のサイズSdを、欠損領域を回避するように設定する。図15の場合には、空領域ブロック2の先頭アドレスa5と空領域ブロック1の先頭アドレスa4の差をとり、更に、この差から欠損領域のサイズ(3バイト)を差し引いた値が、空領域ブロック1のサイズSdになる。このような欠損回避処理を行うことにより、空領域ブロックのリンク構造から欠損領域が除外されることとなるため、以降のファイルアクセス処理において、欠損領域が用いられることを防止することが可能になる。
FIG. 16 is an explanatory diagram showing the concept of the loss avoidance process. It is assumed that a defect area of 3 bytes is detected in the
制御部130は、上記ステップS240による欠損回避処理を実行した後、上記ステップS200に処理を戻すことによって他の空領域ブロックを検索する。そして、再度、上述した一連の書き込み処理を実行する。こうすることによって、欠損領域を回避しつつファイルの書き込みを行うことができる。
After executing the loss avoidance process in step S240, the
ところで、本実施例のフラッシュメモリ140は、前述したように、NAND型のフラッシュメモリである。そのため、フラッシュメモリ140に対する実際のファイルアクセスでは、データの消去を図1に示すブロック領域単位で行い、データの読み出し/書き込みをページ単位で行う必要がある。また、周知のように、NAND型のフラッシュメモリでは既に書き込まれたデータを直接上書きすることができない。そのため、制御部130は、図13〜16で説明したリンクアドレスやデータの書き換えを次の順序で行う。
By the way, the
(1)書き換えを行う部分が含まれるブロック領域の内容をRAM132にコピーする。
(2)フラッシュメモリ140から(1)のブロック領域を消去する。
(3)RAM132にコピーしたデータ内の目的の部分を書き換える。
(4)RAM132からフラッシュメモリ140にデータを書き戻す。
(1) The contents of the block area including the part to be rewritten are copied to the
(2) The block area (1) is erased from the
(3) Rewrite the target portion in the data copied to the
(4) Data is written back from the
制御部130は、以上の処理を書き換えを行う部分全てについて行う。こうすることで、フラッシュメモリ140に対するデータの記録を実現することができる。なお、本実施例では、空領域ブロックに対するデータの書き込みについても、このような方法によって行う。これは、ファイルの消去に伴って生成された空領域ブロックのように、データ格納領域DAに、「Nil」データ以外のデータが書き込まれている空領域ブロックに対するデータの書き込みは、実質的にデータを書き換えることになるためである。もちろん、「Nil」データのみによって構成される領域に対しては、上述した方法によらず、ページ単位でデータを直接書き込むものとしてもよい。
The
以上、本発明の一実施例としてのデータ記憶装置100の構成やその処理について説明した。本実施例のデータ記憶装置100によれば、フラッシュメモリ140内に記録された各データブロックが、その管理情報格納領域MAに記録された前方リンクアドレスLfや後方リンクアドレスLbによって鎖状にリンクされることになる。そのため、これらのリンクアドレスを辿ることにより、目的のデータにアクセスすることができる。このような構成とすることにより、ディレクトリエントリやFAT情報など、特定の領域に確保された管理情報を用いることなくデータの記録位置を管理することができる。従って、特定の領域に対するアクセスの集中が抑えられ、フラッシュメモリ140内に欠損が発生する可能性を抑制することができる。
The configuration and processing of the
また、本実施例によれば、各データブロックのリンクアドレスを変更することで、欠損領域に対するアクセスを容易に回避することができる。従って、従来のように欠損領域の存在するアドレスを記録するためのテーブルを用意する必要がないため、フラッシュメモリ140の記憶領域全体を効率的に利用することが可能となる。また、従来は、欠損領域が発生した場合にその領域の代替えを行うための代替領域を予め記憶領域内に確保する必要があったが、本実施例によるデータ記録方式によれば、このような代替領域の確保も不要となる。更に、従来は、例えば、1ビット分の欠損領域が存在している場合には、そのビットを含むブロック領域あるいはセクタ全体が使用不能となっていた。しかし、本実施例においてリンクアドレスの管理をビット単位で行うものとすれば、このような制限が排除され、極めて効率的に記憶領域全体を利用することが可能となる。
Further, according to the present embodiment, by changing the link address of each data block, access to the missing area can be easily avoided. Therefore, it is not necessary to prepare a table for recording addresses where a missing area exists as in the prior art, and the entire storage area of the
D.その他の実施例:
(1)上記実施例では、図2に示したように、アドレス空間をリング状に扱うものとしたが、このような態様に限られない。例えば、ボリュームブロックがフラッシュメモリ140の物理アドレスの先頭以外に配置されないような場合には、先頭アドレスと終端アドレスとが連続しない通常のアドレス空間を採用してもよい。このような場合には、図10を例に説明すると、空領域ブロック3の前方リンクアドレスLfの参照先が終端アドレスmxとなり、ボリュームブロックの後方リンクアドレスLbの参照先がアドレスa0となる。
D. Other examples:
(1) In the above embodiment, as shown in FIG. 2, the address space is handled in a ring shape. However, the present invention is not limited to this mode. For example, when the volume block is not arranged other than the head of the physical address of the
(2)上記実施例では、図9に示したように、アドレス空間の先頭にボリュームブロックを配置するものとした。しかし、例えば、先頭領域に欠損が存在するような場合には、上述した初期化処理において、他の任意のアドレスにボリュームブロックを配置するものとしてもよい。このような場合には、初期化処理時に、ボリュームブロックが存在する物理アドレスのアドレス値をフラッシュメモリ140の終端アドレスなど、予め規定された所定のアドレスに記録しておく。制御部130は、こうして記録されたアドレス値をボリュームブロックへのポインタとして用いることにより、ボリュームブロックに対するアクセスを容易に行うことができる。
(2) In the above embodiment, as shown in FIG. 9, the volume block is arranged at the head of the address space. However, for example, when there is a defect in the head area, the volume block may be arranged at another arbitrary address in the initialization process described above. In such a case, the address value of the physical address where the volume block exists is recorded at a predetermined address such as the end address of the
ボリュームブロックが存在する物理アドレスのアドレス値は、フラッシュメモリ140ではなく、RAM131に記憶させるものとしてもよい。このような場合には、制御部130は、データ記憶装置100の電源投入後の初回のアクセス時に、ボリュームブロックの記録された物理アドレスを属性情報Faの値などに基づき先頭アドレスから順次検索する。そして、検索された物理アドレスをRAM131に記憶させる。制御部130は、こうしてRAM131に記憶されたアドレス値を用いることにより、2回目以降のボリュームブロックへのアクセスを迅速に行うことができる。
The address value of the physical address where the volume block exists may be stored in the
(3)図12において説明したファイルの消去処理では、上記ステップS170以降において、更に、物理的に隣接した空領域ブロック同士を結合する処理を行うものとしてもよい。かかる処理では、まず、上記ステップS170によって生成された空領域ブロックと物理的に隣接する前後のデータブロックが、空領域ブロックであるか否かを判別する。そして、空領域ブロックである場合には、物理的に後に存在する空領域ブロックの管理情報格納領域MAを消去し、物理的に前に存在する空領域ブロックの管理情報格納領域MAに対して、結合後の新たなサイズを記録する。そしてそのリンクアドレスLf,Lbを他の空領域ブロックを参照するように設定する。このように、空領域ブロック同士を結合させる処理を行うことにより、ファイルが断片化して記録されることを抑制することができる。 (3) In the file erasing process described with reference to FIG. 12, it is also possible to perform a process of further joining the physically adjacent empty area blocks after step S170. In such processing, first, it is determined whether or not the data blocks before and after physically adjacent to the empty area block generated in step S170 are empty area blocks. If it is an empty area block, the management information storage area MA of the empty area block that physically exists later is erased, and the management information storage area MA of the empty area block that physically exists earlier is deleted. Record the new size after the merge. The link addresses Lf and Lb are set so as to refer to other empty area blocks. As described above, by performing the process of combining the empty area blocks, it is possible to prevent the file from being fragmented and recorded.
このような空領域ブロックの結合処理は、上述したファイル消去のタイミング以外にも、例えば、一定時間コンピュータからデータ記憶装置100に対するアクセスがない場合など、任意のタイミングで、隣接している空領域ブロックを検索して実行するものとしてもよい。こうすることで、効率的に、ファイルの断片化を抑制することが可能となる。
In addition to the above-described file erasure timing, such a vacant area block combining process is performed at an arbitrary timing such as when there is no access to the
(4)上記実施例では、図11や図14に示したように、空領域ブロックは、ファイルブロックやディレクトリブロックのリンクの終端に配置されている。しかし、空領域ブロックは、ボリュームブロックを除く他のデータブロックと完全に独立したリンクを形成するものとしてもよい。このような場合には、ボリュームブロックのデータ記憶領域DAに、空領域ブロックへのリンクを示すリンクアドレスを記録する。また、ファイルブロックやディレクトリブロックのリンクの終端は、空領域ブロックではなく、ボリュームブロックを参照するものとする。こうすることにより、ファイルブロックやディレクトリブロックを辿ることなく効率的に空領域ブロックを検索することが可能になる。 (4) In the above embodiment, as shown in FIGS. 11 and 14, the empty area block is arranged at the end of the link of the file block or the directory block. However, the empty area block may form a completely independent link with other data blocks except the volume block. In such a case, a link address indicating a link to the empty area block is recorded in the data storage area DA of the volume block. In addition, the end of the link of the file block or directory block refers to a volume block, not an empty area block. By doing so, it is possible to efficiently search for an empty area block without following a file block or a directory block.
以上、本発明の種々の実施形態について説明したが、本発明はこうした形態に限定されず、その趣旨を逸脱しない範囲で種々の構成を採ることができることはいうまでもない。例えば、ソフトウェアによって実現した機能はハードウェアによって実現するものとしてもよい。また、フラッシュメモリは、NAND型に限られず、NOR型やAND型などを採用するものとしてもよい。実施例では、フラッシュメモリを用いた補助記補記装置に本発明を適用する場合を説明したが、磁気ディスクや光磁気ディスクを備えた補助記憶装置に本発明を適用するものとしてもよい。 As mentioned above, although various embodiment of this invention was described, it cannot be overemphasized that this invention is not limited to such a form, and can take a various structure in the range which does not deviate from the meaning. For example, a function realized by software may be realized by hardware. Further, the flash memory is not limited to the NAND type, and may be a NOR type or an AND type. In the embodiment, the case where the present invention is applied to an auxiliary recording / rewriting device using a flash memory has been described. However, the present invention may be applied to an auxiliary storage device including a magnetic disk or a magneto-optical disk.
100...データ記憶装置
110...USBコネクタ
120...USBデバイスコントローラ
130...制御部
131...CPU
132...RAM
133...ROM
140...フラッシュメモリ
MA...管理情報格納領域
DA...データ格納領域
DESCRIPTION OF
132 ... RAM
133 ... ROM
140 ... Flash memory MA ... Management information storage area DA ... Data storage area
Claims (7)
前記データを記憶する記憶部と、
前記コンピュータからの命令に応じて前記記憶部に対するデータの書き込み、および、読み出しを制御する制御部とを備え、
前記記憶部は、データの実体が記録されたデータブロックと、データの実体が記録されていない空領域ブロックとに区画された記憶領域を備え、
前記データブロックは、他のデータブロックの所在アドレスを記録するためのデータ管理情報格納領域を当該データブロックと一体的に保持しており、
前記空領域ブロックは、他の空領域ブロックの所在アドレスを記録するための空領域管理情報格納領域を当該空領域ブロックと一体的に保持しており、
前記空領域ブロックの空領域管理情報格納領域には、該空領域ブロックのサイズを取得可能な情報が記録されており、
前記空領域ブロックの空領域管理情報格納領域に記録された所在アドレス、および、該空領域ブロックのサイズを取得可能な情報は、前記記憶部内に存在する欠損領域を回避するように設定されている
データ記憶装置。 A data storage device for storing computer data,
A storage unit for storing the data;
A control unit for controlling writing and reading of data to and from the storage unit in response to an instruction from the computer;
The storage unit includes a storage area partitioned into data blocks in which data entities are recorded and empty area blocks in which data entities are not recorded,
The data block integrally holds a data management information storage area for recording a location address of another data block with the data block,
The empty area block integrally holds an empty area management information storage area for recording a location address of another empty area block with the empty area block ,
In the empty area management information storage area of the empty area block, information capable of acquiring the size of the empty area block is recorded,
The location address recorded in the empty area management information storage area of the empty area block and the information capable of acquiring the size of the empty area block are set so as to avoid the missing area existing in the storage unit. Data storage device.
前記データブロックのデータ管理情報格納領域には、更に、該データブロックの種別を表す種別情報が記録される
データ記憶装置。 The data storage device according to claim 1,
A data storage device in which type information indicating the type of the data block is further recorded in the data management information storage area of the data block.
前記データ管理情報格納領域には、前記種別情報として、ファイル、ディレクトリ、ボリュームのいずれかを表すパラメータが記録される
データ記憶装置。 A data storage device according to claim 2 , comprising:
A data storage device in which a parameter representing one of a file, a directory, and a volume is recorded as the type information in the data management information storage area.
前記データブロックのデータ管理情報格納領域に対して前記種別情報としてディレクトリを表すパラメータが記録される場合には、該データブロックのいずれかの領域に、更に、該ディレクトリ内に存在するファイルまたはディレクトリが格納されたデータブロックの所在アドレスが記録される
データ記憶装置。 A data storage device according to claim 3 ,
When a parameter representing a directory is recorded as the type information in the data management information storage area of the data block, a file or directory existing in the directory is further stored in any area of the data block. A data storage device in which the location address of a stored data block is recorded.
前記制御部は、前記コンピュータからデータの書き込み命令を受けた場合に、
前記空領域ブロックが存在するいずれかの領域に、該データを記録した新たなデータブロックを配置し、該データブロックのデータ管理情報格納領域に対して他のデータブロックの所在アドレスを記録するとともに、該他のデータブロックのデータ管理情報格納領域に記録されている所在アドレスに対して、該新たなデータブロックの所在アドレスを記録する
データ記憶装置。 A data storage device according to any one of claims 1 to 4 ,
When the control unit receives a data write command from the computer,
A new data block in which the data is recorded is arranged in any area where the empty area block exists, and the location address of another data block is recorded in the data management information storage area of the data block, A data storage device for recording the location address of the new data block with respect to the location address recorded in the data management information storage area of the other data block.
前記制御部は、更に、前記新たなデータブロックの配置によって前記空領域ブロックの所在アドレスが変動した場合に、該空領域ブロックの所在アドレスを空領域管理情報格納領域に記録していた他の空領域ブロックの空領域管理情報格納領域に対して前記変動後の所在アドレスを記録する
データ記憶装置。 The data storage device according to claim 5 ,
In addition, when the location address of the empty area block fluctuates due to the arrangement of the new data block, the control unit further stores another empty space where the location address of the empty area block is recorded in the empty area management information storage area. A data storage device for recording the changed location address in an empty area management information storage area of an area block.
前記記憶部内の欠損領域を検出する欠損領域検出手段と、 A missing area detecting means for detecting a missing area in the storage unit;
前記検出された欠損領域を回避するように前記空領域ブロックを分割する分割手段と、 Dividing means for dividing the empty area block so as to avoid the detected missing area;
前記分割された空領域ブロックのそれぞれの前記空領域管理情報格納領域に対して、該空領域ブロックを相互に参照する所在アドレスと、該空領域ブロックのサイズを取得可能な情報とを記録する欠損回避処理手段と For each of the empty area management information storage areas of the divided empty area blocks, a defect address that records a location address that mutually refers to the empty area block and information that can acquire the size of the empty area block is recorded. Avoidance processing means
を備えるデータ記憶装置。 A data storage device comprising:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004117016A JP4502689B2 (en) | 2004-04-12 | 2004-04-12 | Data storage device and initialization method thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004117016A JP4502689B2 (en) | 2004-04-12 | 2004-04-12 | Data storage device and initialization method thereof |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2005301686A JP2005301686A (en) | 2005-10-27 |
JP4502689B2 true JP4502689B2 (en) | 2010-07-14 |
Family
ID=35333135
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2004117016A Expired - Fee Related JP4502689B2 (en) | 2004-04-12 | 2004-04-12 | Data storage device and initialization method thereof |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4502689B2 (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH02176838A (en) * | 1988-12-27 | 1990-07-10 | Nec Corp | Record control system |
JPH06332761A (en) * | 1993-05-20 | 1994-12-02 | Canon Inc | Storage medium |
JPH11120052A (en) * | 1997-10-15 | 1999-04-30 | Sony Corp | File management device, file managing method, recording medium, and file management system |
JPH11250633A (en) * | 1998-02-27 | 1999-09-17 | Sony Corp | Recording medium and recording apparatus |
JPH11272537A (en) * | 1998-03-20 | 1999-10-08 | Victor Co Of Japan Ltd | Flash type memory and management device for the same |
JP2001075848A (en) * | 1999-09-09 | 2001-03-23 | Nec Corp | Method for file management of file system |
JP2002170335A (en) * | 2000-12-05 | 2002-06-14 | Pioneer Electronic Corp | Information recording and reproducing device |
-
2004
- 2004-04-12 JP JP2004117016A patent/JP4502689B2/en not_active Expired - Fee Related
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH02176838A (en) * | 1988-12-27 | 1990-07-10 | Nec Corp | Record control system |
JPH06332761A (en) * | 1993-05-20 | 1994-12-02 | Canon Inc | Storage medium |
JPH11120052A (en) * | 1997-10-15 | 1999-04-30 | Sony Corp | File management device, file managing method, recording medium, and file management system |
JPH11250633A (en) * | 1998-02-27 | 1999-09-17 | Sony Corp | Recording medium and recording apparatus |
JPH11272537A (en) * | 1998-03-20 | 1999-10-08 | Victor Co Of Japan Ltd | Flash type memory and management device for the same |
JP2001075848A (en) * | 1999-09-09 | 2001-03-23 | Nec Corp | Method for file management of file system |
JP2002170335A (en) * | 2000-12-05 | 2002-06-14 | Pioneer Electronic Corp | Information recording and reproducing device |
Also Published As
Publication number | Publication date |
---|---|
JP2005301686A (en) | 2005-10-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7702846B2 (en) | Memory controller, nonvolatile storage device, nonvolatile storage system, and data writing method | |
US8001315B2 (en) | Memory device and control method thereof | |
US9021212B2 (en) | Semiconductor memory system having a snapshot function | |
JP4700562B2 (en) | Data storage device and data storage method | |
US7472251B2 (en) | Data storage apparatus detachably mounted to a host apparatus | |
US20080320211A1 (en) | Nonvolatile memory control device, nonvolatile memory control method, and storage device | |
US20120036313A1 (en) | Method for controlling memory card and method for controlling nonvolatile semiconductor memory | |
US20140059273A1 (en) | Host apparatus and memory device | |
EP1496437A1 (en) | Data storing apparatus | |
US20080244211A1 (en) | Memory device and controller | |
US20110231597A1 (en) | Data access method, memory controller and memory storage system | |
JP2006040264A (en) | Control method of memory card, and control method of nonvolatile semiconductor memory | |
US20150161039A1 (en) | Data erasing method, memory control circuit unit and memory storage apparatus | |
TWI394041B (en) | Method and device to improve usb flash write performance | |
WO2003056432A1 (en) | Memory device and recording/reproducing apparatus using the same | |
JPH10124384A (en) | Method for controlling non-volatile semiconductor memory | |
JP7208000B2 (en) | Information processing device and information processing device control method | |
JP2008084184A (en) | Memory controller | |
JP4502689B2 (en) | Data storage device and initialization method thereof | |
JP2006133923A (en) | Data recording/reproducing device, recording/reproducing method, program and data recording medium | |
JP2008251063A (en) | Storage device | |
JP7031327B2 (en) | Information processing equipment, information processing methods, and programs | |
US20090319587A1 (en) | Memory controller, nonvolatile memory device, and nonvolatile memory system | |
CN117312246A (en) | Method for preventing data damage caused by power failure when writing data into hard disk | |
JP4935101B2 (en) | Memory access method and apparatus |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20070404 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20091110 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20091117 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20100112 |
|
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: 20100406 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20100420 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130430 Year of fee payment: 3 |
|
LAPS | Cancellation because of no payment of annual fees |