Wednesday, April 22, 2009

The tasks of UFFS v1.3

The tasks of next UFFS minor version(v1.3) would be:

* New API:

int uffs_SkipObject(uffs_Object *obj, int size);

This function will make the file object skip "size" bytes from head, return bytes have been skipped. It's not a POSIX standard api, but it would be very useful when using the file as FIFO. For example, when recording streaming video to a file, it allows to skip the earliest content and keep recording when flash become full.

* Introduce buffer group

Use grouped buffers to cache data across blocks. This will avoid performance penalty when opening multiple files for write.

* Interface to Linux MTD

This interface allows to use mtd device as low level flash driver on linux. It's not implies that you can use file operation APIs from libc to access UFFS file system. You still use uffs_xxx APIs, UFFS as a library linked to your application, running on user space not kernel space.

One may ask why not just use YAFFS2 or JFFS2 ? Well, the new introduced "uffs_SkipObject" API may be one of the reason, it can't be implemented effetively on top of POSIX api.


  1. Hi Ricky

    I'm the yaffs guy.

    The SkipObject method is an interesting one and something I considered doing in yaffs. As you say there is no POSIX API for doing this (essentially creating a hole), but it can be done via ioctl trickery. If you do this in Linux you will have to be very careful to get the interactions with the VFS right.

  2. The uffs_SkipObject API looks very interesting for some things I can think of.

    How feasible is it to create a slightly different API:
    uffs_SkipObject(uffs_Object *obj, int offset, int size);

    That would allow bytes to be dropped from any arbitrary place in the file and not just the start.As an example, consider a structured file with multiple types of record and I wanted to just drop some of the records to reclaim some space.

    Is that an easy thing to do or would it create a lot of issues?

    Sure, I could rewrite the file (and I guess that is what the reclaim will do anyway), but I wondered whether the expanded API could do if efficiently.

  3. Any limitation on current UFFS implementation? Maximum page size is? Maximum chip size is?

  4. To Charles:
    It's very hard to implement droping bytes in the middle of a file because of the architecture limitation of UFFS 1.x.

    To Jacky:
    Maximum page size: 4KB
    Maximum pages in a block: 32 (can be extended to 1024)
    Maximum eraseable blocks in a chip: 16384