1. Field of the Invention
The present invention relates to an information processing apparatus having a file system consistency recovery function, and a control method and a storage medium therefor.
2. Description of the Related Art
At the present time, a disk medium such as a hard disk drive for storing programs, data, etc. is used in a copying machine, a facsimile machine, a printer, or other image processing apparatus (more generally, information processing apparatus).
To improve the speed of accessing programs and data, a cache memory is usually mounted on an image processing apparatus where a disk medium is used. Specifically, data to be written to the disk medium is temporally stored in the cache memory and then written to the disk medium in a writing order having been changed such as to minimize writing time. For example, in the case of a hard disk drive whose head movement waiting time and disk rotation waiting time are extremely long, writing time is shortened by changing the data writing order by means of a cache memory to improve an effective random writing speed (see, Japanese Laid-open Patent Publication No. 2001-117817).
In a Linux or other OS (operating system), at the time of writing information to a disk medium, information is not directly written to the disk medium, but to a buffer region on a memory other than the cache memory. The information written to the buffer region is written to the disk medium by a synchronization daemon activated by a kernel at background at intervals of a predetermined time period.
In an image processing apparatus where a disk medium is used, file management is performed by using software called a file system in order to easily access a file on the disk medium. Generally, for the file system, contents of files and management information of the files (hereinafter, respectively referred to as the entity data and the file management information) are stored on the disk medium. The file management information includes a table indicating storage positions of entity data of files on the disk medium, and includes file volume information and the like. By using the file management information, the entity data can easily be accessed (see, Japanese Laid-open Patent Publication No. 2005-234873).
If there is an inconsistency in the file system (between file entity data and file management information), a problem is faced in accessing the disk medium, resulting in a possibility of a fatal adverse effect on the entire file system. Accordingly, file system consistency is inevitably necessary for normal operation of the file system.
Next, a description will be given of an example file inconsistency in a file configuration where a file B is stored in a directory A.
In the case of this file configuration, file management information on the directory A includes information indicating that the file B is stored in the directory A, information on the position of the file B on the disk medium, and information on the volume of the file B. On the other hand, file management information on the file B includes information indicating that the file B is present in the directory A.
To erase the file B, the file management information on the file B is erased (procedure S1), the file management information on the directory A is updated (procedure S2), and the entity data of the file B is erased (procedure S3).
If it is assumed that power supply is shut off between the procedures S1 and S2 by artificial power off or accidental abnormality in commercial power supply, there is a possibility that the file management information on the file B is lost, but the information indicating that the file B is present in the directory A remains.
In that case, if the file B is accessed, the file management information on the directory A is referred to and it is indicated that the file B is present in the directory A. However, since the file management information on the file B cannot be referred to, the entity data of the file B cannot be accessed.
In another case that power supply is shut off between the procedures S2 and S3, if the disk medium is accessed realtime, the file management information on the directory A is updated before the power supply shutoff, so that it includes correct information indicating that the file B is not present in the directory A.
However, since the disk medium is accessed via the cache memory, even if the information in the cache memory is updated, the corresponding information in the disk medium is not updated in some cases depending on the timing of power supply shutoff.
In that case, as with the case where power supply is shut off between the procedures S1 and S2, there is a possibility that the file management information on the file B is lost from the disk medium, but the information indicating that the file B is present in the directory A remains in the disk medium.
If in this way there is an inconsistency in the file system, a problem is faced in accessing the disk medium, resulting in a possibility that the entire apparatus is brought into a crisis situation. To obviate this, in an apparatus mounted with a disk medium, the presence or absence of inconsistency between file entity data and file management information is generally inspected at start-up of the apparatus.
When an inconsistency between file entity data and file management information is detected, the file system checks the entire region of the disk medium in detail and attempts to recovery the consistency between file entity data and file management information. However, an extremely long time is required to perform the consistency recovery process, preventing a user to use the apparatus for a long time.
USPTO Backgrounds
USPTO Backgrounds