1.  Field of the Invention
The present invention relates to a method for assigning a spare area in a rewritable optical recording medium. 
2.  Background of the Related Art
An optical storage medium is generally divided into a read only memory (ROM), a write once read many (WORM) memory into which data can be written one time, and rewritable memories into which data can be written several times.  Rewritable optical storage medium, i.e. optical discs, include rewritable compact discs (CD-RW) and rewritable digital versatile discs (DVD-RW, DVD-RAM, DVD+RW). 
A repeated recording/playback (R/P) of information to/from rewritable optical disks causes a change in the initial mix ratio of a recording layer formed to record the information on the optical disk.  This change degrades the performance of the optical disk, causing errors in the recording/reproduction of information.  Namely, the errors due to such degradation show up as defective areas during formatting, recording to and playback from the optical disk.  Defective areas of a rewritable optical disk may also be caused by a scratch on its surface, particles of dirt and dust, or errors during manufacture.  Therefore, in order to prevent writing into or reading out of a defective area, management of defective areas is necessary. 
FIG.  1 shows a defect management area (DMA) in a lead-in area and a lead-out area of the optical disc to manage a defect area.  Particularly, the data area is divided into a plurality of zones for the defect area management, where each zone is further divided into a user area and a spare area.  The user area is where data is actually written and the spare area is used when a defect occurs in the user area. 
There are generally four DMAs in one disc, e.g. DVD-RAM, two of which exist in the lead-in area and two exist in the lead-out area.  Because managing defective areas is important, the same contents are repeatedly recorded in all four DMAs to protect the data.  Each DMA comprises two blocks of 32 sectors, where one block comprises 16 sectors.  The first block of the DMA, called a DDS/PDL block, includes a disc definition structure (DDS) and a primary defect list (PDL).  The second block of the DMA, called an SDL block, includes a secondary defect list (SDL).  The PDL corresponds to a primary defect data storage and the SDL corresponds to a secondary defect data storage. 
The PDL generally stores entries of defective sectors caused during the manufacture of the disc or identified when formatting a disc, namely initializing and re-initializing a disc.  As shown in FIG.  2A, each entry includes a sector number corresponding to a defective sector and an entry type.  The sector number is listed in the carry order, and the entry type is listed by the origin of the defective sector.  For example, the entry type is divided into a P-list, a G1-list and a G2-list, as defined by the disc manufacturer.  More particularly, the defective sectors generated during the manufacture of the disc are stored in the P-list.  The defective sectors found by a certification process during a formatting of a disc are stored in the G1-list, and the defective sectors converted from the SDL without a certification process are stored in the G2-list. 
On the other hand, the SDL is arranged in block units and holds entries of either defective areas which may be generated after initialization or defective areas which could not be entered in the PDL during initialization.  As shown in FIG.  2B, each entry of the SDL includes an area storing the sector number of a first sector of the block having a defective sector, and an area holding the sector number of a first sector of a replacement block.  Additionally, 1 bit is assigned for the forced reassignment marking (FRM).  A FRM bit value of 0 indicates that a replacement block is assigned and that the assigned block does not have a defect.  A FRM bit value of 1 indicates that a replacement block has not been assigned or that the assigned replacement block has a defect.  Thus, to record data in a defective block listed as a SDL entry, a new replacement block must be found to record the data.  Accordingly, defective areas, i.e. defective sectors or defective blocks, within the data area are replaced with normal or non-defective sectors or blocks by a slipping replacement algorithm and a linear replacement algorithm. 
The slipping replacement is utilized when a defective area or sector is recorded in the PDL.  As shown in FIG.  3A, if defective sectors in the user area are recorded in the PDL, such defective sectors are skipped to the next available sector.  By replacing the defective sectors by subsequent sectors, data is written to a normal sector.  As a result, the user area into which data is written slips and occupies the spare area in the amount equivalent to the skipped defective sectors.  For example, if there are two defective sectors in the P-list or G1-list of the PDL, the data is written into the spare area by two sectors (m+n). 
The linear replacement is utilized when a defective block is recorded in the SDL or when a defective block is found during playback.  As shown in FIG.  3B, if defective blocks m and n, corresponding to blocks in either the user or spare area, are recorded on the SDL, such defective blocks are replaced by normal blocks in the spare area and the data to be recorded in the defective block are recorded in an assigned spare area.  To achieve the replacement, a physical sector number (PSN) assigned to a defective block remains, while a logical sector number (LSN) is moved to the replacement block along with the data to be recorded. 
As defective areas are compensated utilizing the spare area, methods of assigning the spare area plays an important role in the defective area management.  Typically, the spare area may be allocated in each zone or group of the data area or may be allocated in a designated portion of the data area.  One method is to allocate the spare area at the top of the data area, as shown in FIG.  4.  In such case, the spare area is called a Primary Spare Area (PSA).  Namely, the data area excluding the primary spare area becomes the user area. 
The primary spare area is assigned during an initial formatting process and is not given a LSN.  Thus, the primary spare area may be assigned when a manufacturer produces the optical disc or when a user initially formats an empty disc.  A variety of sizes can be allocated for the primary spare area.  For example, in order to have an initial data recording capacity, i.e. the initial user area, of 4.7 GB (Giga byte) in a disc with a size of 120 mm, 26 MB (Mega Byte) may be allocated as the primary spare area.  Also, to have an initial data recording capacity of 4.5 GB, 145 MB may be assigned as the primary spare area. 
Moreover, if defective sectors are discovered and registered on the PDL during the initial formatting or re-formatting, the recording capacity would be proportionately reduced since data cannot be recorded on the defective sectors.  Therefore, to maintain the initial data recording capacity, a portion of the primary spare area equivalent to the defective sectors registered on the PDL slips into or becomes a part of the user area.  Accordingly, the PSN of the user area to which a value of LSN=0 is assigned varies depending upon the defective sectors registered on the PDL.  Moreover, the primary spare area is slipped into the user area in a reverse order, even when replacement blocks are assigned from the primary spare area for the linear replacement. 
If the primary spare area becomes full by slipping or linear replacement, as shown in FIG.  5A, a new spare area may be assigned near the end of the user area.  Such additional spare area is called a supplementary spare area (SA-sup).  As the assigned supplementary spare area also becomes full, the supplementary spare area may be enlarged as shown in FIG.  5B. As in the primary spare area, the spare blocks in the supplementary spare area are also used in a reverse order during the linear replacement such that the supplementary spare area can easily be enlarged as necessary. 
However, there are cases when additional supplementary spare area cannot be assigned even when an enlargement is necessary.  For example, assume the enlarged supplementary spare area becomes full while data, i.e. Files 1 and 2, are recorded to the end of the user area as shown in FIG.  5B. Under such condition, assume File 1 is erased and re-recorded.  If a new defective block is found in the user area, the supplementary spare area must be further enlarged.  Nevertheless, because File 2 is already recorded in the user area in which the supplementary spare area should be assigned, an enlargement is not possible. 
One way to overcome this problem is by a de-fragmentation.  Namely, data stored in the user area, including the data recorded in area to which the supplementary spare area must be assigned, can be transferred to an upper portion or an empty portion of the user area.  However, de-fragmentation often takes a great amount of time and is complicated.  Since a large volume of data such as 4.7 GB may be rewritten, the time period may be almost equivalent to the time period required for a full formatting. 
Moreover, supplementary spare area is enlarged by fixed increments.  Accordingly, if less than the fixed increment is available in the user area, even after a de-fragmentation, the supplementary spare area cannot be enlarged.  For example, if the fixed increment is 32 MB, but the enlargeable supplementary spare area is 31 MB, the available 31 MB of the user area cannot be allocated as the supplementary spare area.  Finally, a maximum size into which the supplementary spare area may be enlarged is not fixed.  Therefore, an indefinite enlargement of the supplementary spare area would cause problems in the spare area management by the DMA.