Commit graph

128 commits

Author SHA1 Message Date
nvt-se 62b380b0a6 Fixed a bug with reading to far in get_record index. Thanks to Darren Moore for reporting this. 2009-07-16 11:58:44 +00:00
nvt-se 906717a333 * isolate only pages in the last sector
* set max_pages to 0 when calling remove_by_page to prevent file starvation.
* when allocating files, only update next_free if the allocated file starts at next_free.

Thanks to Darren Moore (CSIRO) for suggesting the first two of the
three changes.
2009-07-09 22:16:22 +00:00
nvt-se c872a86653 undo accidental enabling of debug output. 2009-06-29 13:33:12 +00:00
nvt-se 1e0ca9ceac Made the use of micro logs configurable to make file modifications
more efficient on storage types that support inline updates.

The sky platform uses logs, and the native platform uses no logs.
2009-06-29 13:30:16 +00:00
nvt-se 53a8acc49a cleared debug flag. 2009-06-10 15:13:37 +00:00
nvt-se 349e14abd4 fixed GC bug with big files and unwanted buffer overwrite bug. 2009-06-10 15:03:35 +00:00
nvt-se d9b75b2fda stop the watchdog while merging. 2009-05-26 14:27:06 +00:00
nvt-se 88766d8740 use unsigned for sector count type. 2009-05-25 22:10:04 +00:00
nvt-se 2978270e43 decreased the code size to less than 5000 bytes. (msp430 code)
improved clarity in read and write code.
added negative offset check in cfs_seek().
removed unnecessary multiplication.
2009-05-13 13:27:19 +00:00
nvt-se 995e788d73 Fixed append->modify->append bug.
Approximately doubled the speed of file reservations.

Reduced the compiled code size by about 100 bytes by removing redundant code.
2009-05-11 16:35:49 +00:00
nvt-se 55ec3093ec removed complicated and mostly unused EOF hint code. 2009-05-04 22:30:32 +00:00
nvt-se 8e52b1bcfd made the documentation more clear. 2009-05-04 22:29:48 +00:00
nvt-se 17fa2f1618 make sure that page isolation is called after erasing a sector in reluctant GC.
simplified the GC logic a bit.
2009-04-29 13:15:59 +00:00
nvt-se 3f205a1413 reluctant gc will now wait until the sector has no free pages
before erasing the sector.
2009-04-13 22:26:31 +00:00
nvt-se 4507891ed5 made gc on removal configurable since it decreases wear levelling.
cleaned up some code.
2009-04-02 14:20:04 +00:00
nvt-se 1425537a13 Introduced two garbage collection mode: greedy and reluctant.
The greedy GC mode attempts to erase as many sectors as possible, and
it is therefore a slow operation, since the flash driver must wait
for about a second after erasing one sector. The former behavior was
to always do a greedy GC if file reservations fails due to lack of space.

The new reluctant GC stops after erasing one sector, and therefore
we often do not have to wait if there is no file system operation
in the time while the sector is being erased. We call the garbage collector
using this mode when removing a file that is not a micro log file, since
the remove function is called recursively for micro log files that are
erased because the corresponding ordinary file is erased.

This change increases the coffee test (examples/sky/test-coffee.c) speed
from 9 to 5 seconds.
2009-04-02 11:22:23 +00:00
nvt-se 6a6bb53f2e merged files must always inherit the old file end. 2009-03-26 15:57:52 +00:00
nvt-se 04ccf215e4 dereference gc_wait 2009-03-26 15:45:55 +00:00
nvt-se 8785bee644 avoid repetitive garbage collection if no files have been deleted since
the last try.
2009-03-26 12:36:10 +00:00
nvt-se bffbb06d4a corrected GC page isolation loop.
adjusted cfs_coffee_reserve signature to use cfs_offset_t instead of uint32_t.
made cfs_coffee_format also to clear *next_free.
2009-03-20 15:15:43 +00:00
nvt-se b7bdfe8daf bugfixes:
* set invalid page on all removed files which have cache entries.
* update file cache entries earlier to prevent overwrites.
2009-03-19 20:44:43 +00:00
oliverschmidt 545c0c506e Switched cfs offset type to signed int to allow backward movements with cfs_seek. 2009-03-01 12:28:39 +00:00
nvt-se 47d70f2ae3 Switched name to CFS_CONF_OFFSET_TYPE to emphasize that it is a configurable option. 2009-03-01 12:00:00 +00:00
nvt-se 63b89a67fe * cfs_opendir in Coffee now accepts any name.
* refer to the documentation of each whence parameter. Old documentation didn't   consider negative movements either.
2009-02-28 13:40:25 +00:00
oliverschmidt 938f151a66 Allow to override the whence macros individually - just like the open flags. 2009-02-28 11:39:02 +00:00
nvt-se aaa9d62304 fixed cfs_seek signature. 2009-02-27 14:52:52 +00:00
nvt-se 6615e39e27 switched unsigned int to cfs_offset_t 2009-02-27 14:50:35 +00:00
nvt-se 90e8016906 file end check must be against fdp->offset. 2009-02-27 14:35:12 +00:00
nvt-se 3191a2568c Major API change:
1. Introduced a cfs_offset_t type that designates file offsets. unsigned int
was insufficient on several platforms with non-volatile storage that exceed
the capacity of unsigned int.

2. Switched cfs_seek signature to POSIX style with a "whence" parameter.
2009-02-27 14:25:37 +00:00
nvt-se 5e038640e2 fixed error in last commit: second character must terminate 2009-02-27 13:21:59 +00:00
nvt-se a258be684f permit the current directory name "." to be used in cfs_opendir. 2009-02-27 13:19:04 +00:00
nvt-se 2295df7246 The text suggested that only append operations were supported. 2009-02-27 10:54:08 +00:00
nvt-se 2e12c2408e bug fix: removed possible null pointer dereference. 2009-02-25 23:59:26 +00:00
nvt-se bc7c90bb9f doubled the speed of uncached file openings. 2009-02-22 15:19:31 +00:00
nvt-se 957ae56b13 broke out the essence of the search algorithm to a separate function. 2009-02-19 21:35:38 +00:00
nvt-se 07c50cc200 corrected file cache status checks in previous commit. 2009-02-17 18:50:29 +00:00
nvt-se d029dd8240 cleaned up mostly the GC code.
made EOF hints optional.

default build is now ~500 bytes smaller.
2009-02-17 16:56:32 +00:00
nvt-se 883d10e136 GC fix: isolated pages must always be allocated.
page allocation: increased utilization because the algorithm failed to
count all space before.

style: renamed and simplified some code and names.
2009-02-14 19:09:17 +00:00
nvt-se b8f3dca765 fixed merge_log bug and space allocation error with isolated pages. 2009-02-12 11:24:22 +00:00
nvt-se 98f7f9a06a sizeof on coffee_fd_set is no longer suitable since it has become a
pointer.
2009-02-09 12:02:10 +00:00
fros4943 4f7f3c97b5 * added coffee_files to the protected memory needed during cfs-based checkpointing operations
* renamed cfs_coffee_get_fd_set() to cfs_coffee_get_protected_memory() to highlight that not only fd_set is protected
2009-02-09 10:08:26 +00:00
nvt-se d0a546b049 A long refactoring session yielded the following.
Technical changes:

* Factored out file specific information from the file descriptor
  structure into a new file structure.

  - Useful file metadata can be stored after the file is closed.
  - File descriptors become much smaller.
  - Significantly reduces the need to scan for the file end.

* Use correct types in all function signatures.
* Removed the directory cache.

Results:

* Enormous speed increase when opening cached files (10x-20x.)
* Multiple fd:s pointing to the same file have the correct semantics.
* About 100 bytes smaller ROM size.
* Slightly smaller static RAM size.
2009-02-08 17:08:13 +00:00
nvt-se fda75c4c08 Use the right type for pages in the directory cache. This makes the
cache much smaller on most platforms.
2009-02-03 16:21:53 +00:00
nvt-se 4b56200586 documented the new function that helps sensornet checkpointing to protect
file descriptors while rolling back state.
2009-01-29 18:24:58 +00:00
fros4943 8f462b9a52 zeroed debug flag 2009-01-23 17:28:09 +00:00
fros4943 7e5047012b added function for getting coffee's fd_set address and size 2009-01-23 16:27:49 +00:00
nvt-se 9d7e9fe297 reduced code size by removing some unnecessary statements. 2008-12-18 15:49:43 +00:00
nvt-se f041a2eada fixed compilation error when debug flag was set. 2008-12-12 10:23:49 +00:00
nvt-se 532ebc1e9a reduced the code size by 200 bytes.
fixed an EOF hint bug that occured when files where extended.
2008-12-09 16:01:18 +00:00
nvt-se 8c608efea4 added file removal capability to xmem fs 2008-11-30 22:42:40 +00:00