Date : Fri, 12 Nov 2010 23:56:54 +0100
From : rick@... (Rick Murray)
Subject: RFC: Need two error numbers
On 12/11/2010 21:10, J.G.Harston wrote:
> **ALL** filing systems buffer data in quantities of less than a whole
> sector until a whole sector can be read/written. How else does *ANY*
> filing system manage to read or write a single byte at a time to/from
> an open file?
I didn't want to overly complicate things, but this was hinted at when I
mentioned the change-a-byte would be:
read sector
alter the byte
write sector
The main gist, that I probably could have worded better, was that filing
systems buffer data in memory; for the 8 bitters it can be one or more
sectors (mmm, there'd only be a finite number on a FileStore type
machine..?) while more recent developments could buffer considerably
more. This isn't even accounting for the fact that some harddiscs
optimise with potentially considerable write buffering, plus as touched
upon, altering a little bit of a Flash will require a lot more to be
erased, which will be read into a RAM during the erase, and written back
after. Indeed, unexpected power loss can have the potential to cause
considerable damage.
> If you open a file on DFS, write some data and not flush the buffer,
> then press Ctrl-Break, the data is simply lost, the open channel
> is abandoned.
On the other hand, while it isn't always perfect, some filesystem code
aimed at removable media devices will take the paranoid approach and
effectively *Dismount after each operation, so if the device is simply
yanked out of the USB port, data corruption should be minimal. This
explains, also, why you have to jump through hoops to get an external
drive to run as NTFS. It's because NTFS keeps a lot of crap "in use"
thus is not really suited to media that could be unplugged at any time.
The DFS problem manifests because the Beeb has no concept of a graceful
shutdown handler. Many years ago when I was playing with an early Linux
distro (Slackware?), hitting Ctrl-Alt-Del would invoke a shutdown rather
than just reboot. I tried, to see what would happen. Let's say fsck
(like chkdsk) was in a panic afterwards with numerous inconsistencies. ;-)
Even so - it is foolish to simply shut down or remove media, whether a
BBC micro or an OSD PVR, whether a Master Compact or Ubuntu "Cranky
Cougar" (or whatever daft name the current version has).
Best wishes,
Rick.
--
Rick Murray, eeePC901 & ADSL WiFI'd into it, all ETLAs!
BBC B: DNFS, 2 x 5.25" floppies, EPROM prog, Acorn TTX
E01S FileStore, A3000/A5000/RiscPC/various PCs/blahblah...