Re: [Yaffs] YAFFS2 Tnode size

Páxina inicial
Anexos:
Mensaxe orixinal
+ (text/plain)
+ (text/html)
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Shuhrat Rahimov
Data:  
Para: Charles Manning
CC: yaffs
Asunto: Re: [Yaffs] YAFFS2 Tnode size
Hi,
thanks for your reply. I have figured out now how the things work. For
those who could be interested in it, these are some calculations about
tnodes:
max nr of chunks represented by tnodes: =
2^(log_2(NTNODES_INTERNAL)*MAX_LEVEL+log_2(NTNODES_LEVEL0))
ram usage for a file with the tnode level of LEVEL =
(2^(LEVEL+log_2(NTNODES_LEVEL0) - 1) - 1)*16 bit (this is for tnodes of
width 16 bits)

Regards,

Shuhrat

2016-04-12 0:23 GMT+02:00 Charles Manning <>:

> Hello
>
> On Fri, Apr 8, 2016 at 7:58 PM, Shuhrat Rahimov <>
> wrote:
>
>> 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)?
>>
>
> 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      0x7

>
> Have you read HowYaffsWorks? That helps to explain some of this better:
> http://www.yaffs.net/sites/yaffs.net/files/yaffs.net/HowYaffsWorks.pdf
>
> Regards
>
> Charles
>
>
>
>> Regards,
>> Shuhrat Rahimov
>>
>> _______________________________________________
>> yaffs mailing list
>>
>> http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs
>>
>>
>