1. Field of the Invention
This invention relates to journaled file systems in digital computers and more specifically to automatic journaling of objects in a file system.
2. Background of the Related Art
A digital storage device in a computer system stores the operating system software, user applications and data files. One function of the operating system is to administer data storage in the storage device. A sub-system of the operating system, namely the file system, administers data storage in the storage device by allocating data to files and directories in response to appropriate requests by a system user or by an application.
Over time, files and directories are modified in different manners. For example, directories are created and named. Files are generated and deleted and the data in a file or in one of its attributes is modified. A link from a file or a directory to an existing directory or file may be added. To maintain a history of what activity has taken place within a digital storage device, a sub-system of the file system, namely the journal file system, keeps a current record, or journal, of directories and their contents.
A journal file system (JFS) is a file system in which the digital storage device maintains data integrity in the event of an operating system crash or if the operating system is otherwise halted abnormally. The JFS maintains a journal (also known as a journal receiver) of what activity has taken place within the data area of the digital storage device, and if a system crash occurs, any lost data can be reconstructed from the information contained in the journal.
A JFS provides a facility to track detailed information about file system object changes and provides protection against partial changes being made to an object at the point of an abnormal system termination. An object, as used herein, is a named storage space in a file system, that consists of a set of characteristics that describe itself and in some cases data. Some examples of objects are directories, programs, files, libraries and folders.
In general, there are three primary areas of support from a JFS when an object is journaled. These areas of support are: (i) recording changes to objects, (ii) single system recovery, and (iii) recovery of a saved object to a known state. These areas are discussed below.
In a recording of changes to objects, object changes are recorded as journal entries in a journal receiver. The journal receiver is a file object that contains journal entries added by the operating system when files or directories are modified. As an example, directories are created and renamed or files are created and the data in a file or in one of its attributes has been modified. The journal entries may then be used for recovery from an abnormal system termination. Another use for the recorded changes is for replicating entries from the journal receiver to a back-up system so that they can be retrieved to create and maintain a replica of the source file system.
Single system recovery occurs during an initial program load (IPL) following an abnormal system termination. The journal receiver serves as a basis for all changes to objects that are implemented by an IPL. The IPL then processes object changes as if the abnormal system termination had not occurred by using the data contained in the receiver log that was created before the system termination. Damaged objects, caused by system functions that were interrupted during their critical operations, are discarded.
Recovery of a saved object to a known state is typically a system administrator-initiated recovery that provides a mechanism to recover a saved object to a specific state. The object is recovered to a state of its last saved operation occurring sometime prior to the operation that caused the object to become corrupted. A user initiated save command, though it could also be performed automatically by an application when the application is closed, typically performs a last saved operation. When an object is saved, a journal entry of the object is stored in the journal receiver.
Conventionally, when an object is created, an explicit start journaling operation is required to create a journal entry for the object. An explicit start operation is an operation that requires intervention by a system user in the form of a keystroke command or by the selection of an icon on a graphical user interface (GUI). When an explicit start journaling operation is executed immediately after an object is created, there is an indeterminate period of time, or open window, when the newly created object is exposed to changes from other tasks being performed on the system. This means that, in the absence of any additional mechanism in the journaling operation, the new object is exposed to undesirable changes by the operating system that do not have corresponding entries in the journal.
As an illustration of one of the deficiencies in the conventional method, during the open window there could be a system user completing a transaction that results in a new file object being created. The file object contains details of a user transaction generated by an open application. In some cases, the details of the transaction could potentially become lost. This is because, in the open window, the system may have halted without any forewarning. The application processing the transaction may have received confirmation from the operating system that the file was successfully written to the data storage device, though it was actually never written. Since the object was not journaled at a time prior to the system halt and the user had no time to explicitly invoke journaling on the transaction details, the details of the transaction are lost.
Therefore, there is a need for a journal file system that will automatically journal objects in an operating system file system when the objects are created. There is also a need for a journal file system that preserves the state of an object while the object is being journaled.
Systems, methods and articles of manufacture are provided for journaling an object. In one embodiment, a method for journaling objects of a file system on a computer system comprises affecting a first object and, in response to affecting the first object, journaling the first object if the file system is configured with a journaling attribute. In one embodiment, affecting comprises at least one of creating the first object and modifying the first object. In the case of creating the first object, the first object may then be linked to an existing object of the file system. While affecting the object, an operating system of the computer system may take steps to prevent the objects of the file system from being changed.
Another embodiment provides a data structure, comprising a journaling attribute indicative of whether an object, upon being linked to the data structure, is to be journaled automatically by an operation of an operating system. Illustratively, the journaling attribute is a binary value having a first value indicating that the object is to be journaled upon being linked to the data structure and a second value indicating that the object is not to be journaled upon being linked to the data structure.
In yet another embodiment, another embodiment provides a signal bearing medium comprising a program which when executed by a processor, performs a method for journaling objects. The method comprises affecting a first object and, in response to affecting the first object, journaling the first object if the file system is configured with a journaling attribute. In one embodiment, affecting comprises at least one of creating the first object and modifying the first object. In the case of creating the first object, the first object may then be linked to an existing object of the file system. While affecting the object, the program may cause an operating system to take steps to prevent the objects of the file system from being changed.
In still another embodiment, a method of automatically journaling directory objects associated with a root directory is provided. The method comprises creating a new directory object, linking the new directory object to an existing directory object and determining whether the new directory object is to inherit a journaling attribute configured to cause automatic journaling of objects linked to the new directory object. If the new directory object is to inherit the journaling attribute, the method further comprises writing the new directory object to a log.
In still another embodiment, a method of journaling an object in a hierarchical directory tree of a file system is provided. The method comprises journaling a directory object and preventing access to the file system while journaling the directory object. Preventing access to the file system may comprise synchronizing the file system with an operating system.