[Yaffs] YAFFS2 Tnode size

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: Shuhrat Rahimov
Date:  
To: yaffs
Subject: [Yaffs] YAFFS2 Tnode size
Hello,
I was reading this post (
http://www.yaffs.net/lurker/message/20090812.040040.5e77b55f.en.html )
regarding the tnode size and RAM usage by the tnodes and have been confused.
When we look at source code at yaffs_guts_initialise() where the tnode size
is set we can see:

dev->tnode_size = (dev->tnode_width * YAFFS_NTNODES_LEVEL0) / 8;
    if (dev->tnode_size < sizeof(struct yaffs_tnode))
        dev->tnode_size = sizeof(struct yaffs_tnode);
So, in this case in ARM sizeof pointer would be 4 B (in 64-bit system even
greater) which gives sizeof(struct yaffs_tnode) = 32 B. In
yaffs_allocator.c in function yaffs_create_tnodes() 100 tnodes are
allocated at a time and there the memory allocation size is = n_tnodes *
dev->tnode_size = 100*32 = 3.2K for only 100 tnodes (here, according to the
post above I would expect 100*20 bit = 250 Byte of RAM). In the post above
it was stated that for 524288 chunks it was needed 20 bits to represent
each of them, but in code we can see that it is needed at least 32 B = 26
bits for each tnode irrespective of the bits needed to represent each
tnode. Could you explain it to me, how much memory is needed for a tnode?
Would it be possible to decrease RAM usage by decreasing
YAFFS_NTNODES_LEVEL0 and other relevant constants or is tnode size
irrespective of that always at least sizeof(struct yaffs_tnode)?
Regards,
Shuhrat Rahimov