In YAFFS, 'background' is a not real 'background' - it does not happen
in a separate thread but instead happens parasitically. Operations that
write/modify (eg: write, rename, flush...) also cause garbage collection
checking. [Sidenote: It would be trivial to add a background thread to
do GC to do background clean-up]
Background deletion (==soft deletion) is done by the garbage collection
mechanism. That is, when we delete a file instead of immediately
deleting the file chunks (which involves programming of the deletion
markers on each chunk) - which takes time- we just note that these
chunks are free to be collected. Thus if the block containing these
chunks is collected then they are not copied and the space is recovered.
We only delete the file header once all its data chunks have been
deleted in this way. Thus if the system is rebooted/power lost/ other
random ActsOfEvil the file will be rebuilt by the boot scanning
mechanism, though the file will now be sparse since it is missing some
chunks. We remember that the file itself was marked for deletion so we
soft delete the file again, and the data chunks will ready for further
collection. Ie we have recovered the state of these chunks without
"leaking".
Thus, to answer your question. Yes, there is 'half a file', but we
remembered that it was deleted so we do not make it available to the
system and we know to clean up 'the other half'.
Does that explain the situation?
-- Charles
-----Original Message-----
From: Wookey [
mailto:wookey@aleph1.co.uk]
Sent: Tuesday, 2 March 2004 5:08 a.m.
To: YAFFS list
Cc:
trini@mvista.com
Subject: What if background deletions are interrupted?
One question someone asked at FOSDEM that I wasn't sure of the answer
was:
When YAFFS background deletion is enabled, what happens if the power
dies before all the portions of the deletion/write are completed?
What is the state when the power comes back up? Presumably the initial
scan will ensure that we don't get 'half a file', but to get consistency
does the file reappear in full or does the background deletion complete
or effectively complete so that it's no longer there?
Thought I'd post this here, on the assumption that I'm not the only one
who would like to know the answer :-)
Wookey
--
Aleph One Ltd, Bottisham, CAMBRIDGE, CB5 9BA, UK Tel +44 (0) 1223
811679
work: http://www.aleph1.co.uk/ play:
http://www.chaos.org.uk/~wookey/
------------------------------------------------------------------------
---------------
This mailing list is hosted by Toby Churchill open software
(
www.toby-churchill.org). If mailing list membership is no longer wanted
you can remove yourself from the list by
sending an email to
yaffs-request@toby-churchill.org with the text
"unsubscribe"
(without the quotes) as the subject.
---------------------------------------------------------------------------------------
This mailing list is hosted by Toby Churchill open software (
www.toby-churchill.org).
If mailing list membership is no longer wanted you can remove yourself from the list by
sending an email to
yaffs-request@toby-churchill.org with the text "unsubscribe"
(without the quotes) as the subject.