available space reduce sharply in the jffs2 file system

汤磊金 leijint at mobilesoft.com.cn
Fri Nov 11 01:26:40 EST 2005


linux-mtd,您好!

we take some experiments in the jffs2 file system of linux kernel 2.6.12.we caught a big problem. 

we write 4 bytes and we random llseek in the jffs2,the available space continue to reduce sharply.
                fd = fopen(argv[1], "r+");
                char buf[1024]={'a','b','c'};
                for (;;) {
                        offset = rand();
                        fseek(fd, offset % (1024*1024), SEEK_SET);
                        fwrite(buf, 1024, 1, fd);
                }

                fclose(fd);

we caught the slabinfo in the proc every other 10 second.

<active_objs> <num_objs> <objsize>
jffs2_inode_cache   1998   2030     24  145    1 : tunables  120   60    0 : slabdata     14     140
jffs2_node_frag     1936   2032     28  127    1 : tunables  120   60    0 : slabdata     16     160
jffs2_raw_node_ref  11529  11571     16  203    1 : tunables  120   60    0 : slabdata     57     50
jffs2_tmp_dnode        0      0     36  101    1 : tunables  120   60    0 : slabdata      0      00
jffs2_raw_inode        0      0     68   56    1 : tunables  120   60    0 : slabdata      0      00
jffs2_raw_dirent       0      0     40   92    1 : tunables  120   60    0 : slabdata      0      00
jffs2_full_dnode    2116   2233     16  203    1 : tunables  120   60    0 : slabdata     11     110


jffs2_inode_cache   2006   2030     24  145    1 : tunables  120   60    0 : slabdata     14     140
jffs2_node_frag     3870   3937     28  127    1 : tunables  120   60    0 : slabdata     31     310
jffs2_raw_node_ref  12443  12586     16  203    1 : tunables  120   60    0 : slabdata     62     60
jffs2_tmp_dnode        1    101     36  101    1 : tunables  120   60    0 : slabdata      1      10
jffs2_raw_inode        2     56     68   56    1 : tunables  120   60    0 : slabdata      1      10
jffs2_raw_dirent       8     92     40   92    1 : tunables  120   60    0 : slabdata      1      10
jffs2_full_dnode    4037   4060     16  203    1 : tunables  120   60    0 : slabdata     20     200


jffs2_inode_cache   1999   2030     24  145    1 : tunables  120   60    0 : slabdata     14     140
jffs2_node_frag     4811   4826     28  127    1 : tunables  120   60    0 : slabdata     38     380
jffs2_raw_node_ref  13400  13601     16  203    1 : tunables  120   60    0 : slabdata     67     60
jffs2_tmp_dnode        0      0     36  101    1 : tunables  120   60    0 : slabdata      0      00
jffs2_raw_inode        0     56     68   56    1 : tunables  120   60    0 : slabdata      0      10
jffs2_raw_dirent       0      0     40   92    1 : tunables  120   60    0 : slabdata      0      00
jffs2_full_dnode    4943   5075     16  203    1 : tunables  120   60    0 : slabdata     25     250

eadline_drq           8     78     48   78    1 : tunables  120   60    0 : slabdata      1      10
jffs2_inode_cache   1999   2030     24  145    1 : tunables  120   60    0 : slabdata     14     140
jffs2_node_frag     5698   5715     28  127    1 : tunables  120   60    0 : slabdata     45     450
jffs2_raw_node_ref  14337  14413     16  203    1 : tunables  120   60    0 : slabdata     71     70
jffs2_tmp_dnode        0      0     36  101    1 : tunables  120   60    0 : slabdata      0      00
jffs2_raw_inode        2     56     68   56    1 : tunables  120   60    0 : slabdata      1      10
jffs2_raw_dirent       0      0     40   92    1 : tunables  120   60    0 : slabdata      0      00
jffs2_full_dnode    5795   5887     16  203    1 : tunables  120   60    0 : slabdata     29     290

jffs2_inode_cache   1999   2030     24  145    1 : tunables  120   60    0 : slabdata     14     140
jffs2_node_frag     6587   6604     28  127    1 : tunables  120   60    0 : slabdata     52     520
jffs2_raw_node_ref  15269  15428     16  203    1 : tunables  120   60    0 : slabdata     76     70
jffs2_tmp_dnode        0      0     36  101    1 : tunables  120   60    0 : slabdata      0      00
jffs2_raw_inode        4     56     68   56    1 : tunables  120   60    0 : slabdata      1      10
jffs2_raw_dirent       0      0     40   92    1 : tunables  120   60    0 : slabdata      0      00
jffs2_full_dnode    6649   6699     16  203    1 : tunables  120   60    0 : slabdata     33     330

the same testing codes is running in the system of kernel version 2.4.18,but the slabinfo is as follow:

jffs2_inode_cache    502    507     20    3    3    1
jffs2_node_frag      336    606     16    3    3    1
jffs2_raw_node_ref   4525   4646     16   23   23    1
jffs2_tmp_dnode        0    253     12    0    1    1
jffs2_raw_inode        1     56     68    1    1    1
jffs2_raw_dirent       0     92     40    0    1    1
jffs2_full_dnode     356    808     16    4    4    1


jffs2_inode_cache    502    507     20    3    3    1
jffs2_node_frag      355    606     16    3    3    1
jffs2_raw_node_ref   6175   6262     16   31   31    1
jffs2_tmp_dnode        0    253     12    0    1    1
jffs2_raw_inode        1     56     68    1    1    1
jffs2_raw_dirent       0     92     40    0    1    1
jffs2_full_dnode     375    808     16    4    4    1


jffs2_inode_cache    502    507     20    3    3    1
jffs2_node_frag      360    606     16    3    3    1
jffs2_raw_node_ref   6660   6666     16   33   33    1
jffs2_tmp_dnode        0    253     12    0    1    1
jffs2_raw_inode        0     56     68    0    1    1
jffs2_raw_dirent       0     92     40    0    1    1
jffs2_full_dnode     379    808     16    4    4    1


jffs2_inode_cache    502    507     20    3    3    1
jffs2_node_frag      465    606     16    3    3    1
jffs2_raw_node_ref   7744   7878     16   39   39    1
jffs2_tmp_dnode        0    253     12    0    1    1
jffs2_raw_inode        0     56     68    0    1    1
jffs2_raw_dirent       0     92     40    0    1    1
jffs2_full_dnode     632    808     16    4    4    1


jffs2_inode_cache    436    507     20    3    3    1
jffs2_node_frag      566    606     16    3    3    1
jffs2_raw_node_ref   5982   7878     16   31   39    1
jffs2_tmp_dnode        0    253     12    0    1    1
jffs2_raw_inode        0     56     68    0    1    1
jffs2_raw_dirent       0     92     40    0    1    1
jffs2_full_dnode     750    808     16    4    4    1

jffs2_inode_cache    436    507     20    3    3    1
jffs2_node_frag      581    606     16    3    3    1
jffs2_raw_node_ref   5544   7878     16   28   39    1
jffs2_tmp_dnode        0    253     12    0    1    1
jffs2_raw_inode        0     56     68    0    1    1
jffs2_raw_dirent       0     92     40    0    1    1
jffs2_full_dnode     765    808     16    4    4    1

jffs2_inode_cache    436    507     20    3    3    1
jffs2_node_frag      615    808     16    4    4    1
jffs2_raw_node_ref   4863   7878     16   31   39    1
jffs2_tmp_dnode        0    253     12    0    1    1
jffs2_raw_inode        0     56     68    0    1    1
jffs2_raw_dirent       0     92     40    0    1    1
jffs2_full_dnode     799    808     16    4    4    1

we also take anthor testing in the kernel 2.6.12. the codes is as follows:
	            fd = fopen(argv[1], "r+"); 
                for (;;) {
                        fwrite(&offset,sizeof(int), 1, fd);
                        offset += 4;
                        if (offset >= 1024*1024) {
                                offset = 0;
                                fseek(fd, 0, SEEK_SET);
                        }
                }

                fclose(fd);
there is no problem in the jffs2 file system and the system's space is decrease about 100K when we write 1M bytes. 


we felt the reason is mabye the principles of Garbage collection. when we run the test codes in the kernel 2.4.18 or write data orderly,the jffs2_raw_node_ref is keeping quantity. 
	
Any help is much appreciated. 

        致
礼!
 				

        汤磊金
        leijint at mobilesoft.com.cn
          2005-11-11


More information about the linux-mtd mailing list