HelloOn Fri, Apr 8, 2016 at 7:58 PM, Shuhrat Rahimov <sandrorkmv@gmail.com> wrote: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 = 250When we look at source code at yaffs_guts_initialise() where the tnode size is set we can see: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.
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);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)?The bit you are missing is that each the tnode structure holds multiple tnodes.For level 0 Tnodes that is 16 tnodes. For internal (level 1,2,...) it is 8 tnodes.You can adjust the size of the TNODE structure by adjusting:
#define YAFFS_NTNODES_LEVEL0 16
#define YAFFS_TNODES_LEVEL0_BITS 4
#define YAFFS_TNODES_LEVEL0_MASK 0xf
#define YAFFS_NTNODES_INTERNAL (YAFFS_NTNODES_LEVEL0 / 2)
#define YAFFS_TNODES_INTERNAL_BITS (YAFFS_TNODES_LEVEL0_BITS - 1)
#define YAFFS_TNODES_INTERNAL_MASK 0x7Have you read HowYaffsWorks? That helps to explain some of this better:
http://www.yaffs.net/sites/yaffs.net/files/yaffs.net/HowYaffsWorks.pdfRegardsCharlesRegards,Shuhrat Rahimov
_______________________________________________
yaffs mailing list
yaffs@stoneboat.aleph1.co.uk
http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs