FS#10991 - Rewrite dircache generation to free ram and stack

Attached to Project: Rockbox
Opened by amaury pouly (pamaury) - Tuesday, 09 February 2010, 22:46 GMT
Last edited by amaury pouly (pamaury) - Sunday, 14 February 2010, 23:06 GMT
Task Type Patches
Category Drivers
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This patch is a complete rewrite of dircache generation using some subtle properties of the FAT code. It currently doesn't contain code for the simulator ! It allows to free 30kib of ram and have a 600 bytes binsize reduction.

If you can test it, I'm particulary interested in:
* correctness: do you notice any problem ?
* stack usage: report dircache thread usage if you can

TODO: the current code doesn't add the "." and ".." entries in dircache for now. I don't know if it can cause problems.
This task depends upon

Closed by  amaury pouly (pamaury)
Sunday, 14 February 2010, 23:06 GMT
Reason for closing:  Accepted
Additional comments about closing:  r24657
Comment by amaury pouly (pamaury) - Tuesday, 09 February 2010, 23:12 GMT
New version adding the "." and "..". I've noticed that putting the fat_ structures on the stack at the beginning leads to a big stack usage in the dircache thread. This could lead to a stokv on a very deep directory structure and I'm not sure at which depth.

The binsize reduction is of 200bytes with this version.
Comment by Jonathan Gordon (jdgordon) - Wednesday, 10 February 2010, 05:34 GMT
I've put this on my mini2g and I'll let you know any wierdness that shows up
Comment by Jonathan Gordon (jdgordon) - Wednesday, 10 February 2010, 21:31 GMT
no issus so far. Is there anything which especially shold be tested? Also it doesnt build for the sim.
Comment by amaury pouly (pamaury) - Wednesday, 10 February 2010, 22:50 GMT
It's normal that it doesn't build for the sim (I've not written the code !). You can check not so usual operations such as rename, delete, ... But if everything seems to work, then there shouldn't be any bug because it's really on the generation which changed.
Comment by Steve Bavin (pondlife) - Thursday, 11 February 2010, 07:34 GMT
I've not been able to test this yet as I currenlty only have a sim, no device - but I'd hope that the sim shouldn't need any special code/#ifdefs at the dircache level. Ideally, any differences should be abstracted at the file system (FAT) level....
Comment by amaury pouly (pamaury) - Thursday, 11 February 2010, 16:20 GMT
I disagree, the simulator doesn't use the FAT code in any way (for now) so it makes sense to use a specialized version for the simulator in dircache.
This makes sense because the version I propose bypass the "normal" I/O api to use the FAT code which is an optimization only valid on a real target.
I'll try to upload an up to date version for the simulator quickly.
Comment by amaury pouly (pamaury) - Thursday, 11 February 2010, 17:57 GMT
New version:
-minor code change in dircache generation
-now there is code for the simulator
Comment by Mustapha Senhaji (DrMoos) - Sunday, 14 February 2010, 15:08 GMT
Tested on Gigabeat S:
All is working well here, no noticeable changes.