| emFile Journaling is an additional component which sits on top of the file system and
makes the file system layer fail-safe. File systems without journaling support (for example, FAT) are not fail-safe.
Journaling means that a file system logs all changes to a journal before committing them to the main file system.
Driver fail-safety
Data can be lost in case of unexpected Reset in either the file system Layer (FAT or EFS) or in the driver layer.
Your entire system is fail-safe only if BOTH layers are failsafe. The journaling add-on makes the file system layer fail-safe.
Your entire system is only fail-safe if the driver layer is fail-safe as well. For fail-safety of the driver please refer to the specific drivers. |
Main Features
- Non fail-safe file systems will be fail-safe.
- Fully compatible to standard file system implementations (e.g. FAT).
- Every storage solution can be used. No reformat required.
- Multiple write accesses to the storage medium can be combined in user application.
|
Backgrounds |
 |
emFile is typically used with non fail-safe file systems like FAT. Loss of data can occur in either the driver layer or
the file system layer. The driver layer is typically fail-safe so the only place for typical data loss is the file system layer.
The file system can be corrupted through an interrupted write access for example in the event of power failure or system crash.
This is by design of FAT and true for all implementations from any vendor. The emFile Journaling add-on adds journaling to the file system layer.
The goal of this additional layer is to guarantee a file system that is always in a consistent state. Operations on File System Layer are mostly
not atomar. For example, a single call of FS_FWrite() to write data into a new file causes the execution of the following three Storage Layer operations:
- Allocate cluster and update FAT
- Write user data
- Update directory entry
An unexpected interrupt (such as a power failure) in this process can corrupt the file system. To prevent such corruptions the
Journaling Layer caches every write access to achieve an always consistent state of the file system. All changes to the file system
are stored in a journal. The data stored in the journal is copied into the file system only if the File System Layer operation has
been finished without interruption.
This procedure guarantees an always consistent state of the file system, because an interruption of the copy process leads not to data loss.
The interrupted copy process will be restarted after a restart of the target. |
File System Layer error scenarios
| 1. |
Journal empty. |
Consistent |
--- |
| 2. |
While writing into journal. |
Consistent |
Lost |
| 3. |
While finalizing of the journal. |
Consistent |
Lost |
| 4. |
After finalization. |
Consistent |
Obtained |
| 5. |
While copying from journal into file system. |
Consistent |
Obtained |
| 6. |
After copy process, before invalidating of the journal. |
Consistent |
Obtained |
| 7. |
While invalidating of the journal. |
Consistent |
Obtained |
How to use emFile Journaling
Using journaling is very simple from a user perspective.
- Enable journaling in the emFile configuration.
- Call FS_JOURNAL_Create() after formatting the volume.
That’s it. Everything else is done by the emFile Journaling extension.

Copyright SEGGER Microcontroller GmbH & Co.KG. All
rights reserved.
For more information, please visit our web site
www.segger.com or contact us at info@segger.com
Last update:
June 11, 2008
|