[PATCH] Embedded bios FTL
Jörn Engel
joern at wohnheim.fh-wedel.de
Thu Jun 16 06:29:05 EDT 2005
On Thu, 16 June 2005 11:15:46 +0200, Sean Young wrote:
> On Wed, Jun 15, 2005 at 11:01:55PM +0200, Joern Engel wrote:
> > On Wed, 15 June 2005 21:27:54 +0200, Sean Young wrote:
>
> > > According to General Software documentation their implementation "snoops"
> > > the fat table in order to see which sectors can be chucked. Hmm...
> >
> > That's a smart thing to do if you can be certain the user is running
> > fat on top. Being certain ain't so easy, though.
>
> Indeed so. Besides, it would be more elegant if the file system driver
> passed this on to the block device, via an ioctl. Would such a thing
> stand up to scrutiny? As far as I can see, only the ftl block devices
> would benefit.
An ioctl() would have a *really* hard time to make it into the kernel.
What you could do, however, might be something similar to this:
o Add an erase() function to stuct block_device_operations
o Have fat call that function whenever a block is know unused.
o Make sure only to call the function, if it's non-NULL. Maybe a
wrapper, maybe just
if (bd_ops->erase)
bd_ops->erase(block);
inside fs/fat/.
o Implement erase() for your ftl driver to do something smart.
Be careful, though. I haven't worked on block devices for a very long
time and could be talking out of my arse. If you send such a patch to
akpm and get flamed into a pile of ashes - don't blame me. ;)
Seriously, the erase() function should be considered an optimization
only, at least for now. If it doesn't exist - fine. If it exists but
doesn't do anything - fine. If it does something - great.
Jörn
--
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.
-- Brian W. Kernighan
More information about the linux-mtd
mailing list