[Yaffs] Maximum file size

Charles Manning manningc2 at actrix.gen.nz
Sat Apr 22 07:47:26 BST 2006


On Saturday 22 April 2006 08:32, Ross Stutterheim wrote:
> I saw a post on the Linux-MTD mailing list (post from about a month ago)
> that said the maximum file size for YAFFS2 (with a large page NAND) is 2GB.
> The person who wrote this said it was due to YAFFS_MAX_CHUNK_ID *
> chunksize.  YAFFS_MAX_CHUNK_ID = 0xFFFFF.  Can this be increased without
> effecting functionality otherwise?  What is the reason for it being this
> size in particular.  My device is potentially going to need a file size of
> ~ 4GB.  Any feedback would be appreciated.

We've come a long way since the original goal of supporting a 32MB NAND 
chip :-).

There are three things limiting size:

yaffs2 uses ints for chunk Id except for where it is stored in tags, where it 
is shaved down to 28 bits (stealing some bits for extended tags). That means 
that the chunkId space for yaffs2, with 2k chunks, limits file size to approx 
512GB.

The MAX_CHUNK_ID of 0xFFFFF limits the file size to 2G, and that limit is very 
easily extended. A quick look at the code suggests that it is only used as a 
sanity check in adding and finding tnodes and would work fine if you modified 
it to a larger value. Worst case, a bit of fiddling required in tnode 
handling.

Probably the biggest obstacle (and it is not that big) is the use of integer 
file sizes. These could be changed to off_t without too much drama, even less 
if you're willing to live with 4GB files.

-- CHarles



More information about the yaffs mailing list