JPH064372A - Block use control system - Google Patents

Block use control system

Info

Publication number
JPH064372A
JPH064372A JP4165661A JP16566192A JPH064372A JP H064372 A JPH064372 A JP H064372A JP 4165661 A JP4165661 A JP 4165661A JP 16566192 A JP16566192 A JP 16566192A JP H064372 A JPH064372 A JP H064372A
Authority
JP
Japan
Prior art keywords
block
record
area
unused area
length
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
JP4165661A
Other languages
Japanese (ja)
Inventor
Takayuki Aida
孝之 相田
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.)
NEC Solution Innovators Ltd
Original Assignee
NEC Solution Innovators Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Solution Innovators Ltd filed Critical NEC Solution Innovators Ltd
Priority to JP4165661A priority Critical patent/JPH064372A/en
Publication of JPH064372A publication Critical patent/JPH064372A/en
Withdrawn legal-status Critical Current

Links

Abstract

PURPOSE:To effectively utilize a block by efficiently storing a new record in an unused area or an erased area in the block. CONSTITUTION:This system is provided with low-order block managing tables 21, 22-24 to divide data blocks and to manage them corresponding to the maximum unused area lengths of respective data blocks 31-36 in a file, and a high- order block managing table 1 to store the maximum used area lengths and the addresses of the correspondent low-order block managing tables 21-24. Then, the data block having the unused area of a length corresponding to the desired record to be stored is found from the high-order/low-order block managing tables 1 and 21, 22,... and the record is stored in the unused area of the found block. After the storage, the high-order/low-order block managing tables 1 and 21, 22,... are updated.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明はブロック使用制御方式、
特に複数のレコード格納領域を有する複数のブロックか
ら構成されるランダムアクセス可能な記憶装置に設定さ
れたファイルのブロックにレコードを格納する場合のブ
ロック使用制御方式に関する。
The present invention relates to a block use control system,
In particular, the present invention relates to a block use control method for storing records in a block of a file set in a randomly accessible storage device including a plurality of blocks having a plurality of record storage areas.

【0002】[0002]

【従来の技術】従来、この種のブロック使用制御方式
は、ブロック内のレコード格納領域の全てが未使用であ
るか、レコードの削除によりブロック内の全てのレコー
ド格納領域が再使用可能となった状態、即ちブロックが
空きの状態になった場合に、ブロックを再使用するよう
になっている。また空きの状態のブロックが存在しない
場合には、最後にレコードを格納したブロックに、対象
とするレコードを格納できる大きさの一度も使用されて
いない未使用領域があれば、その領域にレコードを追加
格納し、未使用領域がなければ、新規にブロックを確保
してその未使用領域に対象とするレコードを格納するよ
うになっている。
2. Description of the Related Art Conventionally, in this type of block use control method, all record storage areas in a block are unused, or all record storage areas in a block can be reused by deleting records. When the state, that is, the block becomes empty, the block is reused. If there is no free block, if there is an unused area that is large enough to store the target record and has never been used, the record is stored in that area. If additional storage is performed and there is no unused area, a new block is secured and the target record is stored in the unused area.

【0003】[0003]

【発明が解決しようとする課題】上述した従来のブロッ
ク使用制御方式は、一度でもレコードを格納し使用した
ブロックの再使用を、ブロック内の全てのレコードが削
除され空状態になった時点ではじめて可能としていて、
僅かでも使用していれば空きになるまで使用できない。
従って新規にレコードを格納する時点で最終のブロック
に対象とするレコードを格納するための空きがない場合
に、他に格納対象のレコードを格納するのに充分な大き
さの未使用領域をもったブロックがあっても、そのブロ
ック内の未使用領域を使用しない。その結果、格納対象
のレコードは空状態である新規ブロックに格納されるこ
とになる。特に大容量のレコード格納領域を有するファ
イルに対して、ランダムにレコードの削除・格納を繰返
す更新処理においては、レコードの削除により未使用の
レコード格納領域が増えるにも拘らず、再使用される可
能性が少なく、一方使用ブロックは新規レコードの格納
で増えるばかりで、ブロック内のレコード格納領域を充
分有効に使用することができないという欠点がある。
In the conventional block use control method described above, the records are stored even once and the used blocks are reused only when all the records in the blocks are deleted and become empty. Is possible,
If it is used even a little, it cannot be used until it becomes empty.
Therefore, when there is no free space to store the target record in the last block at the time of newly storing a record, it has an unused area large enough to store another record to be stored. Even if there is a block, the unused area in that block is not used. As a result, the record to be stored is stored in the empty new block. Especially in a file with a large record storage area, it can be reused even though the unused record storage area increases due to the deletion of records in the update process in which records are deleted and stored randomly. However, the number of blocks used increases only when new records are stored, and the record storage area in the blocks cannot be used effectively.

【0004】[0004]

【課題を解決するための手段】本発明のブロック使用制
御方式は、複数のレコード格納領域を有する複数のブロ
ックから構成されるランダムアクセス可能な記憶装置に
設定されたファイルのブロックにレコードを格納するた
めのブロック使用制御方式において、それぞれのブロッ
ク内の連続した未使用領域の内の最大の未使用領域の長
さによってブロックを管理するブロック管理テーブル
と、新規にレコードを格納するときそのレコードを格納
できる大きさの未使用領域の存在するブロックを前記ブ
ロック管理テーブルから選択するブロック選択手段と、
このブロック選択手段によって選択されたブロックを読
出し、前記レコードを格納できる大きさの未使用領域を
探してレコードを格納するレコード格納手段と、このレ
コード格納手段によってレコードを格納することによっ
てブロック内の最大の未使用領域の長さが変化したとき
ブロックの内の新らしい最大の未使用領域の長さに従っ
て前記ブロック管理テーブルを更新するテーブル更新手
段とを有することにより構成される。
According to the block use control method of the present invention, a record is stored in a block of a file set in a randomly accessible storage device composed of a plurality of blocks having a plurality of record storage areas. In the block usage control method for managing blocks, a block management table that manages blocks by the length of the maximum unused area of consecutive unused areas in each block, and that record is stored when a new record is stored. Block selecting means for selecting a block having an unused area of a possible size from the block management table,
The block selected by the block selection means is read, an unused area of a size capable of storing the record is searched, and a record storage means for storing the record, and the record storage means stores the record Table updating means for updating the block management table in accordance with the length of the new largest unused area in the block when the length of the unused area changes.

【0005】[0005]

【実施例】次に、本発明について図面を参照して説明す
る。
DESCRIPTION OF THE PREFERRED EMBODIMENTS Next, the present invention will be described with reference to the drawings.

【0006】図1は本発明の一実施例に用いられるテー
ブルの関連図で、一つのファイルについて使用される管
理テーブルとデータブロックとの関連を示している。図
1の実施例は上位ブロック管理テーブル1と、最大25
5の下位ブロック管理テーブル21,22,〜24と、
同一容量の複数のデータブロック31,32,〜36と
を示している。
FIG. 1 is a relational diagram of a table used in an embodiment of the present invention, showing a relation between a management table and a data block used for one file. In the embodiment of FIG. 1, the upper block management table 1 and the maximum of 25
5 lower block management tables 21, 22, and 24;
A plurality of data blocks 31, 32, to 36 having the same capacity are shown.

【0007】上位ブロック管理テーブル1は4バイト単
位に区切られたエントリ11,12,〜14等の255
個のエントリを有し、各エントリは先頭からの相対位置
によって、ブロック内最大未使用領域長のレコード長係
数に対応づけられ、各エントリにはそれぞれ下位ブロッ
ク管理テーブルのアドレスが格納される。下位ブロック
管理テーブル21,22,〜24のそれぞれは、同一の
ブロック内最大未使用領域長をもつデータブロック3
1,32〜36のブロック番号の集合体である。レコー
ド長係数はデータブロックの全体長に対する割合を示す
係数で、1から255の255種類を1バイトで表現す
る。即ち、例えばデータブロック長が1000バイト,
ブロック内の最大未使用領域の大きさが100バイトと
すると、レコード長係数は100/(1000/25
5)≒25(小数点以下切除)である。図1では、下位
ブロック管理テーブル23は4バイト単位に区切られた
エントリ231,232等を複数個有し、それぞれブロ
ックA,ブロックBのブロック番号が格納されていて、
上位ブロック管理テーブル1の相対位置64のエントリ
の指すアドレスの下位ブロック管理テーブルであるの
で、ブロックA,ブロックBにはブロック内最大未使用
領域長=250バイト(100÷255×64)を有し
ていることを示している。
The upper block management table 1 has 255 entries such as entries 11, 12, ...
Each entry is associated with the record length coefficient of the maximum unused area length in the block by the relative position from the beginning, and each entry stores the address of the lower block management table. Each of the lower block management tables 21, 22 to 24 has a data block 3 having the same maximum unused area length in the block.
It is an aggregate of block numbers 1, 32 to 36. The record length coefficient is a coefficient indicating a ratio of the entire length of the data block, and 255 types of 1 to 255 are represented by 1 byte. That is, for example, the data block length is 1000 bytes,
Assuming that the maximum unused area in a block is 100 bytes, the record length coefficient is 100 / (1000/25
5) ≈ 25 (cut off after the decimal point). In FIG. 1, the lower block management table 23 has a plurality of entries 231, 232 and the like divided into 4-byte units, and stores the block numbers of blocks A and B, respectively.
Since it is the lower block management table of the address pointed to by the entry at the relative position 64 of the upper block management table 1, the blocks A and B have the maximum unused area length in the block = 250 bytes (100 ÷ 255 × 64). It indicates that

【0008】図2は図1に示されたデータブロックの構
造図で、図1のデータブロック33を例に示している。
データブロック33はレコードを格納した使用領域33
1および333、レコードを格納していない未使用領域
332および334、および領域情報テーブル335を
有している。領域情報テーブル335はデータブロック
33内の各使用領域および未使用領域に対応したエント
リを有し、データブロック33の最後尾から順に生成さ
れる。エントリ51,52,53,および54はそれぞ
れ使用領域331,未使用領域332,使用領域33
3,および未使用領域334に対応している。領域情報
テーブル335の各エントリは領域格納情報501と領
域長502とを格納している。領域格納情報は16ビッ
トからなり、先頭第1ビットに対象としている領域が使
用中か空きかを、それぞれ“1”か“0”かで示す使用
情報に、他の15ビットは対象としている領域のブロッ
ク内での先頭からの相対的な位置を示す格納位置に用い
ている。領域長502は対象とした領域の長さで、前述
のレコード係数で表現されている。
FIG. 2 is a structural diagram of the data block shown in FIG. 1, and shows the data block 33 of FIG. 1 as an example.
The data block 33 is a used area 33 in which a record is stored.
1 and 333, unused areas 332 and 334 in which no record is stored, and an area information table 335. The area information table 335 has entries corresponding to each used area and unused area in the data block 33, and is sequentially generated from the end of the data block 33. Entries 51, 52, 53, and 54 are used area 331, unused area 332, and used area 33, respectively.
3 and unused area 334. Each entry of the area information table 335 stores area storage information 501 and area length 502. The area storage information consists of 16 bits. The first 1st bit is used information indicating whether the target area is in use or is empty, and the other 15 bits are the target area. It is used as a storage position indicating a relative position from the beginning in the block. The area length 502 is the length of the target area and is represented by the above-mentioned record coefficient.

【0009】図3および図4は本発明の一実施例のフロ
ーチャートである。以下図1,図2,図3,および図4
を参照して実施例の説明を進める。以下の説明では10
00バイトのデータブロックを複数有するファイルにレ
コード長250バイト(レコード係数64、16進数で
“40”)のレコードの格納を想定する。先ずレコード
長をキーにして上位ブロック管理テーブル1のエントリ
を選択する(ステップ101)。図1の例ではエントリ
13が選択される。このとき上位ブロック管理テーブル
1のエントリが終了していないので(ステップ10
2)、選択したエントリ13の値を参照する(ステップ
103)。参照したエントリに値が格納してあるかを調
べ(ステップ104)値が格納されていれば、その値の
アドレスの下位ブロック管理テーブルのエントリを参照
する(ステップ106)。ステップ104で参照してエ
ントリに値がなければ、上位ブロック管理テーブル1の
次のエントリを選択して(ステップ105)、ステップ
102に戻る。図1の例ではステップ106で下位ブロ
ック管理テーブル23の第1のエントリの値としてブロ
ック番号Aを参照する。次に、このブロック番号のデー
タブロックを読出す(ステップ107)。読出したデー
タブロック内の領域情報テーブル335のエントリの使
用情報の値が“1”で、領域長が格納するレコード長に
等しいか大きいものを抽出する(ステップ108,10
9,110,111)。図2の例ではエントリ52の領
域長が16進数で“40”であり、格納するレコード長
と等しいので、未使用領域332を格納先の未使用領域
に決定する。ここで、このエントリの領域長の値を記憶
領域に記憶しておく(ステップ112)。次にこのエン
トリの使用情報を使用中で意味する“0”に変更し、領
域長の値を格納するレコードの大きさに変更して、更に
残りの未使用領域に対応するエントリを新規に追加作成
する(ステップ113)。その後、格納の対象となる領
域テーブルのエントリの格納位置の未使用領域に、レコ
ードを格納する(ステップ114)。図2の例ではエン
トリ52の格納位置から未使用領域332にレコードを
格納する。次に、上位・下位ブロック管理テーブルを更
新する必要があるかを調べるため、ステップ112での
記憶領域の値とこのデータブロックの未使用最大のレコ
ード長とを比較する(ステップ115)。このレコード
長には上位ブロック管理テーブル1の相対位置から求ま
る値を用いる。そこでこのレコード長が大きければ直ち
に終了するが、レコード長が大きくなれば、対象とする
データブロック内の領域情報テーブル335のエントリ
内で、未使用の最大の領域長の値を選出する(ステップ
116)。図2の例では、ステップ115で記憶してお
いた記憶域の値“40”とレコード長“40”が等し
く、ステップ116で領域情報テーブル335内のエン
トリから未使用領域長の最大であるエントリ54の領域
長“38”が選ばれる。次に、選出された領域長とステ
ップ115で使用したレコード長とを比較し(ステップ
117)、同じであれば直ちに終了し、同じでない、即
ち図2の例のようにレコード長が“40”で領域長が
“38”のように小さければ、下位ブロック管理テーブ
ルの対象のエントリを削除し、上位ブロック管理テーブ
ル1のエントリを更新する(ステップ118)。なおス
テップ102で上位ブロック管理テーブル1を走査した
結果、レコードを格納できる大きさの未使用領域を持っ
たデータブロックを見つけることができなかった場合
は、最大の使用中のブロック番号+1の未使用のブロッ
ク番号を生成して、上位および下位ブロック管理テーブ
ルにこのブロック番号を設定したエントリを新規に追加
する(ステップ119)。次にステップ119で設定し
たデータブロックを読出し(ステップ120)、読出し
たデータブロック内の領域情報テーブルに最初のエント
リを格納して(ステップ121)、ステップ111へ移
る。このエントリ内の領域長502にはデータブロック
長−領域情報テーブルの1エントリ長が設定され、使用
情報には未使用の“1”が、格納位置には“0”が設定
される。
3 and 4 are flow charts of an embodiment of the present invention. FIG. 1, FIG. 2, FIG. 3, and FIG.
With reference to FIG. In the following explanation, 10
It is assumed that a record having a record length of 250 bytes (record coefficient 64, hexadecimal "40") is stored in a file having a plurality of data blocks of 00 bytes. First, using the record length as a key, an entry in the upper block management table 1 is selected (step 101). In the example of FIG. 1, the entry 13 is selected. At this time, the entry in the upper block management table 1 has not been completed (step 10
2) Reference the value of the selected entry 13 (step 103). It is checked whether or not a value is stored in the referred entry (step 104). If the value is stored, the entry in the lower block management table of the address of that value is referred to (step 106). If there is no value in the entry referred to in step 104, the next entry in the upper block management table 1 is selected (step 105) and the process returns to step 102. In the example of FIG. 1, in step 106, the block number A is referred to as the value of the first entry of the lower block management table 23. Next, the data block of this block number is read (step 107). The value of the usage information of the entry of the area information table 335 in the read data block is "1", and the one whose area length is equal to or larger than the record length to be stored is extracted (steps 108 and 10).
9, 110, 111). In the example of FIG. 2, since the area length of the entry 52 is “40” in hexadecimal, which is equal to the record length to be stored, the unused area 332 is determined as the storage destination unused area. Here, the value of the area length of this entry is stored in the storage area (step 112). Next, change the usage information of this entry to "0" meaning that it is in use, change the size of the record that stores the value of the area length, and add a new entry corresponding to the remaining unused area. Create (step 113). Then, the record is stored in the unused area at the storage position of the entry of the area table to be stored (step 114). In the example of FIG. 2, the record is stored in the unused area 332 from the storage position of the entry 52. Next, in order to check whether the upper / lower block management table needs to be updated, the value of the storage area in step 112 is compared with the maximum unused record length of this data block (step 115). The value obtained from the relative position of the upper block management table 1 is used for this record length. Therefore, if the record length is large, the process ends immediately, but if the record length is large, the value of the maximum unused area length is selected from the entry of the area information table 335 in the target data block (step 116). ). In the example of FIG. 2, the storage area value “40” stored in step 115 is equal to the record length “40”, and the entry having the maximum unused area length from the entries in the area information table 335 in step 116. The area length "38" of 54 is selected. Next, the selected area length is compared with the record length used in step 115 (step 117), and if they are the same, the process immediately ends, and if they are not the same, that is, the record length is "40" as in the example of FIG. If the area length is as small as "38", the target entry of the lower block management table is deleted and the entry of the upper block management table 1 is updated (step 118). As a result of scanning the upper block management table 1 in step 102, if a data block having an unused area with a size capable of storing a record cannot be found, the maximum unused block number + 1 unused The block number is generated, and an entry having this block number is newly added to the upper and lower block management tables (step 119). Next, the data block set in step 119 is read (step 120), the first entry is stored in the area information table in the read data block (step 121), and the process proceeds to step 111. The area length 502 in this entry is set to one entry length of the data block length-area information table, unused "1" is set to the usage information, and "0" is set to the storage position.

【0010】[0010]

【発明の効果】以上説明したように本発明は、それぞれ
のブロック内の未使用領域の内の最大の未使用領域の長
さによってブロック分けを行ない管理するブロック管理
テーブルを設け、格納しようとするレコードのレコード
長の未使用領域を持ったブロックをこのブロック管理テ
ーブルにより選択するので、従来のようにデータブロッ
ク内の全てのレコードが削除されたデータブロックを使
用する必要がなくなり、未使用領域が新規レコードに割
当てられる機会が多くなって、未使用領域の使用効率を
向上させ、非能率なデータブロック増やすことがなくな
るという効果がある。
As described above, the present invention intends to provide and store a block management table which manages by dividing into blocks according to the length of the maximum unused area of the unused areas in each block. Since a block having an unused area of the record length of a record is selected by this block management table, it is not necessary to use a data block in which all the records in the data block have been deleted as in the conventional case, and the unused area is There are advantages that the number of opportunities to be assigned to a new record is increased, the efficiency of use of the unused area is improved, and inefficient data blocks are not increased.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明の一実施例に用いられるテーブルの関連
図である。
FIG. 1 is a related diagram of a table used in an embodiment of the present invention.

【図2】図1に示されたデータブロックの構造図であ
る。
FIG. 2 is a structural diagram of a data block shown in FIG.

【図3】本発明の一実施例のフローチャートの一部であ
る。
FIG. 3 is part of a flow chart of one embodiment of the present invention.

【図4】本発明の一実施例のフローチャートの図3のフ
ローチャートに続く部分である。
4 is a part of the flowchart of one embodiment of the present invention, which follows the flowchart of FIG.

【符号の説明】[Explanation of symbols]

1 上位ブロック管理テーブル 11,12,〜14,51,52,〜54,231,2
32 エントリ 21,22,〜24 下位ブロック管理テーブル 31,32,〜36 データブロック 331,333 使用領域 332,334 未使用領域 335 領域情報テーブル 501 領域格納情報 502 領域長
1 Upper block management table 11, 12, ~ 14, 51, 52, ~ 54, 231, 2
32 entries 21,22 to 24 lower block management table 31,32, to 36 data blocks 331,333 used area 332,334 unused area 335 area information table 501 area storage information 502 area length

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 複数のレコード格納領域を有する複数の
ブロックから構成されるランダムアクセス可能な記憶装
置に設定されたファイルのブロックにレコードを格納す
るためのブロック使用制御方式において、それぞれのブ
ロック内の連続した未使用領域の内の最大の未使用領域
の長さによってブロックを管理するブロック管理テーブ
ルと、新規にレコードを格納するときそのレコードを格
納できる大きさの未使用領域の存在するブロックを前記
ブロック管理テーブルから選択するブロック選択手段
と、このブロック選択手段によって選択されたブロック
を読出し、前記レコードを格納できる大きさの未使用領
域を探してレコードを格納するレコード格納手段と、こ
のレコード格納手段によってレコードを格納することに
よってブロック内の最大の未使用領域の長さが変化した
ときブロックの内の新らしい最大の未使用領域の長さに
従って前記ブロック管理テーブルを更新するテーブル更
新手段とを有することを特徴とするブロック使用制御方
式。
1. In a block use control method for storing records in a block of a file set in a randomly accessible storage device composed of a plurality of blocks having a plurality of record storage areas, in each block, The block management table that manages blocks according to the maximum unused area length of continuous unused areas, and the block that has an unused area of a size that can store the record when a new record is stored are described above. A block selecting means for selecting from the block management table, a record storing means for reading the block selected by the block selecting means, searching for an unused area having a size capable of storing the record, and storing the record, and the record storing means. By storing records by A block use control method comprising: a table updating unit that updates the block management table according to a new maximum unused area length of a block when the length of a large unused area changes.
JP4165661A 1992-06-24 1992-06-24 Block use control system Withdrawn JPH064372A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4165661A JPH064372A (en) 1992-06-24 1992-06-24 Block use control system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4165661A JPH064372A (en) 1992-06-24 1992-06-24 Block use control system

Publications (1)

Publication Number Publication Date
JPH064372A true JPH064372A (en) 1994-01-14

Family

ID=15816616

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4165661A Withdrawn JPH064372A (en) 1992-06-24 1992-06-24 Block use control system

Country Status (1)

Country Link
JP (1) JPH064372A (en)

Similar Documents

Publication Publication Date Title
US5579516A (en) Method for storing data files on a multiple volume media set
TW316309B (en)
JP3416502B2 (en) Array maintenance method
JP3250544B2 (en) Transfer destination search method, transfer destination search device, search table recording medium, and search program recording medium
WO2008135412A1 (en) System and method of managing indexation of flash memory
WO2002035358A1 (en) Partition creating method and deleting method
JP2000305839A (en) Storage device, storage system, memory managing method, and recording medium
JPH1131096A (en) Data storage/retrieval system
US6961739B2 (en) Method for managing directories of large-scale file system
KR101072558B1 (en) Method and apparatus for managing data based on hashing
JPH064372A (en) Block use control system
US20050108301A1 (en) Method for balancing wear when writing data in a flash memory
JP3801176B2 (en) Memory control method, storage device, control program, and readable recording medium
JP2000181768A (en) Data storage/retrieval system
JPH05108426A (en) Data file management system
JP2790232B2 (en) File system
JPH0225946A (en) File controller
JPS62287350A (en) Index integrally updating system
JP2689116B2 (en) Optical disk storage management method
JP2002222120A (en) Memory access management device and management method
JPH0573372A (en) Record storage control system
JPH09231110A (en) Ic card
JPH06302194A (en) Information processor
JPS60129852A (en) File managing method
JP2004126945A (en) Storage device and control method

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 19990831