Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement TFAT filesystem #19

Open
piranna opened this issue Jun 14, 2015 · 3 comments
Open

Implement TFAT filesystem #19

piranna opened this issue Jun 14, 2015 · 3 comments

Comments

@piranna
Copy link

piranna commented Jun 14, 2015

Transactional-safe FAT filesystem is a driver-level modification of FAT that implements transactions on a FAT filesystem, increasing stability and reliability of data. The API and the data structures are the same, only diference is the usage of the second FAT as a workbench while there are operations, and copy them on the main FAT when they have finished.

@natevw
Copy link
Owner

natevw commented Jun 15, 2015

Interesting, thanks for the tip! I've created a cross-reference from the issue #5 (right now this library only every writes to the first table at all 😿) as transaction safety would be a great bonus feature for "doing the right thing" with the multiple tables.

@natevw
Copy link
Owner

natevw commented Jun 15, 2015

To summarize/paraphrase the linked article: TFAT works by using the second FAT as the main "workspace" and then directly copying that to the first table at the end of a transaction.

So for this library, we'd basically do what we're doing now except point it at the second FAT instead. Add some logic for tracking "changed" blocks of that second FAT, and copying those to the first FAT at the right time.

@piranna
Copy link
Author

piranna commented Jun 16, 2015

So for this library, we'd basically do what we're doing now except point it at the second FAT instead. Add some logic for tracking "changed" blocks of that second FAT, and copying those to the first FAT at the right time.

Yes. Seems that there are some subtle indicators that could be the reason why desktop Windows doesn't implement support for TFAT, though:

If the number of FATs in the BPB is not set to 2, the second cluster entry in the first FAT (cluster 1) may also reflect the status of a TFAT volume for TFAT-aware operating systems. If the cluster 1 entry in that FAT holds the value 0, this may indicate that the second FAT represents the last known valid transaction state and should be copied over the first FAT, whereas the first FAT should be copied over the second FAT if all bits are set.

(Take a look at BIOS Parameter Block section, too.)

But seems mostly you can use your proposed algorythm. Only thing, if you need to modify the FAT tables I would do it in a copy-on-write fashion to not modify current data and be sure that the final copy of the second FAT to the first one is the only problematic operation, making it totally safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants