* FAT32 superiority over ext2 :-)
@ 2001-06-24 22:54 Albert D. Cahalan
2001-06-24 23:22 ` Daniel Phillips
0 siblings, 1 reply; 5+ messages in thread
From: Albert D. Cahalan @ 2001-06-24 22:54 UTC (permalink / raw)
To: linux-kernel; +Cc: viro, phillips, chaffee, storner, mnalis-umsdos
By dumb luck (?), FAT32 is compatible with the phase-tree algorithm
as seen in Tux2. This means it offers full data integrity.
Yep, it whips your typical journalling filesystem. Look at what
we have in the superblock (boot sector):
__u32 fat32_length; /* sectors/FAT */
__u16 flags; /* bit 8: fat mirroring, low 4: active fat */
__u8 version[2]; /* major, minor filesystem version */
__u32 root_cluster; /* first cluster in root directory */
__u16 info_sector; /* filesystem info sector */
All in one atomic write, one can...
1. change the active FAT
2. change the root directory
3. change the free space count
That's enough to atomically move from one phase to the next.
You create new directories in the free space, and make FAT
changes to an inactive FAT copy. Then you write the superblock
to atomically transition to the next phase.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: FAT32 superiority over ext2 :-) 2001-06-24 22:54 FAT32 superiority over ext2 :-) Albert D. Cahalan @ 2001-06-24 23:22 ` Daniel Phillips 2001-06-24 23:49 ` Albert D. Cahalan 0 siblings, 1 reply; 5+ messages in thread From: Daniel Phillips @ 2001-06-24 23:22 UTC (permalink / raw) To: Albert D. Cahalan, linux-kernel Cc: viro, phillips, chaffee, storner, mnalis-umsdos On Monday 25 June 2001 00:54, Albert D. Cahalan wrote: > By dumb luck (?), FAT32 is compatible with the phase-tree algorithm > as seen in Tux2. This means it offers full data integrity. > Yep, it whips your typical journalling filesystem. Look at what > we have in the superblock (boot sector): > > __u32 fat32_length; /* sectors/FAT */ > __u16 flags; /* bit 8: fat mirroring, low 4: active fat */ > __u8 version[2]; /* major, minor filesystem version */ > __u32 root_cluster; /* first cluster in root directory */ > __u16 info_sector; /* filesystem info sector */ > > All in one atomic write, one can... > > 1. change the active FAT > 2. change the root directory > 3. change the free space count > > That's enough to atomically move from one phase to the next. > You create new directories in the free space, and make FAT > changes to an inactive FAT copy. Then you write the superblock > to atomically transition to the next phase. Yes, FAT is what inspired me to go develop the algorithm. However, two words: 'lost clusters'. Now that may just be an implemenation detail ;-) -- Daniel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: FAT32 superiority over ext2 :-) 2001-06-24 23:22 ` Daniel Phillips @ 2001-06-24 23:49 ` Albert D. Cahalan 2001-06-25 0:03 ` Daniel Phillips 0 siblings, 1 reply; 5+ messages in thread From: Albert D. Cahalan @ 2001-06-24 23:49 UTC (permalink / raw) To: Daniel Phillips Cc: Albert D. Cahalan, linux-kernel, viro, phillips, chaffee, storner, mnalis-umsdos Daniel Phillips writes: > On Monday 25 June 2001 00:54, Albert D. Cahalan wrote: >> By dumb luck (?), FAT32 is compatible with the phase-tree algorithm >> as seen in Tux2. This means it offers full data integrity. >> Yep, it whips your typical journalling filesystem. Look at what >> we have in the superblock (boot sector): >> >> __u32 fat32_length; /* sectors/FAT */ >> __u16 flags; /* bit 8: fat mirroring, low 4: active fat */ >> __u8 version[2]; /* major, minor filesystem version */ >> __u32 root_cluster; /* first cluster in root directory */ >> __u16 info_sector; /* filesystem info sector */ >> >> All in one atomic write, one can... >> >> 1. change the active FAT >> 2. change the root directory >> 3. change the free space count >> >> That's enough to atomically move from one phase to the next. >> You create new directories in the free space, and make FAT >> changes to an inactive FAT copy. Then you write the superblock >> to atomically transition to the next phase. > > Yes, FAT is what inspired me to go develop the algorithm. However, two > words: 'lost clusters'. Now that may just be an implemenation detail ;-) What lost clusters? Set bit 8 of "flags" (A_BF_BPBExtFlags to Microsoft) to disable FAT mirroring. Then the low 4 bits are a 0-based value that indicates which copy of the FAT should be used. Assume we have 2 copies of the FAT, as is (was?) common. I'll call them X and Y. When we mount the filesystem, we disable FAT mirroring and mark FAT X active. Now we can make changes to FAT Y without affecting filesystem integrity. Windows will not use FAT Y. As is usual with the phase-tree algorithm, we use free space to create a new structure beside the old one. Time for a phase change: We have FAT Y, currently inactive, updated on disk. FAT X is active; it describes the current on-disk state. We have a new root directory on disk, sitting in free space. We have a new filesystem info sector on disk, sitting in free space. We write one single sector, then: FAT X becomes inactive, and will not be used by Windows. FAT Y becomes active; it describes the new on-disk state. The old root directory is marked free in FAT Y. Good! The old filesystem info sector is marked free in FAT Y. Good! Once the superblock goes to disk, FAT X may be written to. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: FAT32 superiority over ext2 :-) 2001-06-24 23:49 ` Albert D. Cahalan @ 2001-06-25 0:03 ` Daniel Phillips 2001-06-25 15:04 ` Juri Haberland 0 siblings, 1 reply; 5+ messages in thread From: Daniel Phillips @ 2001-06-25 0:03 UTC (permalink / raw) To: Albert D. Cahalan, Daniel Phillips Cc: Albert D. Cahalan, linux-kernel, viro, phillips, chaffee, storner, mnalis-umsdos On Monday 25 June 2001 01:49, Albert D. Cahalan wrote: > Daniel Phillips writes: > > On Monday 25 June 2001 00:54, Albert D. Cahalan wrote: > >> By dumb luck (?), FAT32 is compatible with the phase-tree algorithm > >> as seen in Tux2. This means it offers full data integrity. > >> Yep, it whips your typical journalling filesystem. Look at what > >> we have in the superblock (boot sector): > >> > >> __u32 fat32_length; /* sectors/FAT */ > >> __u16 flags; /* bit 8: fat mirroring, low 4: active fat */ > >> __u8 version[2]; /* major, minor filesystem version */ > >> __u32 root_cluster; /* first cluster in root directory */ > >> __u16 info_sector; /* filesystem info sector */ > >> > >> All in one atomic write, one can... > >> > >> 1. change the active FAT > >> 2. change the root directory > >> 3. change the free space count > >> > >> That's enough to atomically move from one phase to the next. > >> You create new directories in the free space, and make FAT > >> changes to an inactive FAT copy. Then you write the superblock > >> to atomically transition to the next phase. > > > > Yes, FAT is what inspired me to go develop the algorithm. However, two > > words: 'lost clusters'. Now that may just be an implemenation detail ;-) > > What lost clusters? > > Set bit 8 of "flags" (A_BF_BPBExtFlags to Microsoft) to disable > FAT mirroring. Then the low 4 bits are a 0-based value that > indicates which copy of the FAT should be used. > > Assume we have 2 copies of the FAT, as is (was?) common. I'll call > them X and Y. When we mount the filesystem, we disable FAT mirroring > and mark FAT X active. > > Now we can make changes to FAT Y without affecting filesystem > integrity. Windows will not use FAT Y. As is usual with the > phase-tree algorithm, we use free space to create a new structure > beside the old one. > > Time for a phase change: > > We have FAT Y, currently inactive, updated on disk. > FAT X is active; it describes the current on-disk state. > We have a new root directory on disk, sitting in free space. > We have a new filesystem info sector on disk, sitting in free space. > > We write one single sector, then: > > FAT X becomes inactive, and will not be used by Windows. > FAT Y becomes active; it describes the new on-disk state. > The old root directory is marked free in FAT Y. Good! > The old filesystem info sector is marked free in FAT Y. Good! > > Once the superblock goes to disk, FAT X may be written to. When can we expect the patch? -- Daniel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: FAT32 superiority over ext2 :-) 2001-06-25 0:03 ` Daniel Phillips @ 2001-06-25 15:04 ` Juri Haberland 0 siblings, 0 replies; 5+ messages in thread From: Juri Haberland @ 2001-06-25 15:04 UTC (permalink / raw) To: Daniel Phillips; +Cc: linux-kernel In article <0106250203070J.00430@starship> you wrote: > On Monday 25 June 2001 01:49, Albert D. Cahalan wrote: >> Daniel Phillips writes: >> > On Monday 25 June 2001 00:54, Albert D. Cahalan wrote: >> >> By dumb luck (?), FAT32 is compatible with the phase-tree algorithm >> >> as seen in Tux2. This means it offers full data integrity. >> >> Yep, it whips your typical journalling filesystem. Look at what >> >> we have in the superblock (boot sector): >> >> >> >> __u32 fat32_length; /* sectors/FAT */ >> >> __u16 flags; /* bit 8: fat mirroring, low 4: active fat */ >> >> __u8 version[2]; /* major, minor filesystem version */ >> >> __u32 root_cluster; /* first cluster in root directory */ >> >> __u16 info_sector; /* filesystem info sector */ >> >> >> >> All in one atomic write, one can... >> >> >> >> 1. change the active FAT >> >> 2. change the root directory >> >> 3. change the free space count >> >> >> >> That's enough to atomically move from one phase to the next. >> >> You create new directories in the free space, and make FAT >> >> changes to an inactive FAT copy. Then you write the superblock >> >> to atomically transition to the next phase. [--snip--] > When can we expect the patch? Don't! Blasphemy!!! Juri ;-) -- Juri Haberland <juri@koschikode.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-06-25 15:05 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2001-06-24 22:54 FAT32 superiority over ext2 :-) Albert D. Cahalan 2001-06-24 23:22 ` Daniel Phillips 2001-06-24 23:49 ` Albert D. Cahalan 2001-06-25 0:03 ` Daniel Phillips 2001-06-25 15:04 ` Juri Haberland
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox