...
Anchor |
---|
1008731 | 1008731 | How Journaling Works Anchor |
---|
1018502 | 1018502 | In order to understand how the journaling module works, you should first understand how API-level operations relate to the underlying FAT layer operations. As seen in
Figure 10-5 Figure - Relation between API and FAT layer operations, an API level operation is made of one or more top-level FAT operations which, in turn, are made of one or more low-level FAT operations.
anchor...
...
...
title | Figure - Relation between API and FAT layer operations |
---|
|
...
Image Added |
Take a file rename operation, for example. The API-level rename operation involves one top-level FAT rename operation and the following low-level FAT sub-operations:
...
- Create a directory entry that accommodates the new file name.
Anchor |
---|
1009134 | 1009134 - Update the newly created directory entry so that it reflects the original one.
Anchor |
10091141009114 | - Remove the original directory entry.
...
1009267 | Without journaling, a failure occurring during the rename operation can leave the file system in any of the following corrupted states:
...
- The original directory entry is intact but orphaned LFN entries remain due to a partial directory entry creation.
Anchor |
---|
1009269 | 1009269 - The new directory entry now exists (creation has been completed) but orphaned LFN entries remain due to an uncompleted original directory entry deletion.
Anchor |
---|
1009259 | 1009259 - Two directory entries (both pointing to the same data) now exist: one containing the original name and another one containing the new name.
...
1008733 | Using the journaling module, any of the previous corrupted states would be either rolled back or completed upon volume remounting. This is made possible because, prior to performing any low-level FAT operation, the journaling system logs recovery information in a special file called the journal file. By reverting or completing successive underlying low-level FAT operations, the journaling module also allows top-level FAT operations to be reverted or completed, thus making them atomic (see
section 10-6 “Optional Journaling System” on page 127 Optional Journaling System). In our previous example, the journaled rename operation could only have on of the two following outcomes:
...
1005059 | The original directory entry is intact and everything appears as if nothing had happened. Anchor |
---|
1005064 | 1005064- The new directory entry has been created and the original one has been completely deleted, so that the file has been cleanly renamed.