[YAFFS2文件系统问题]yaffs2文件系统中的文件大小错误

内核编译和嵌入式产品的设计与开发
回复
xukai_92
帖子: 5
注册时间: 2015-03-21 21:06
系统: windows 7

[YAFFS2文件系统问题]yaffs2文件系统中的文件大小错误

#1

帖子 xukai_92 » 2016-04-16 16:02

挂载yaffs2文件系统后 使用ls -lah 命令显示文件详细信息发现一个只有38字节的文件居然有150G。求解原因
附件
P60416-155151_recompress.jpg
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: [YAFFS2文件系统问题]yaffs2文件系统中的文件大小错误

#2

帖子 poloshiao » 2016-04-16 16:41

在 Ubuntu 掛載指令 並不支援 yaffs2

參閱
1. sudo ls -al /lib/modules/$(uname -r)/kernel/fs | grep yaffs2
2. sudo cat /proc/filesystems | grep yaffs2
3. http://manpages.ubuntu.com/manpages/xen ... unt.8.html
mount - mount a filesystem
-t, --types fstype
The argument following the -t is used to indicate the filesystem
type. The filesystem types which are currently supported depend
on the running kernel. See /proc/filesystems and
/lib/modules/$(uname -r)/kernel/fs for a complete list of the
filesystems. The most common are ext2, ext3, ext4, xfs, btrfs,
vfat, sysfs, proc, nfs and cifs.

如果還有疑慮 請提供你參考掛載的網頁網址
xukai_92
帖子: 5
注册时间: 2015-03-21 21:06
系统: windows 7

Re: [YAFFS2文件系统问题]yaffs2文件系统中的文件大小错误

#3

帖子 xukai_92 » 2016-04-16 16:54

您好, 我补充一下我这个问题:我是在嵌入式的系统中挂载yaffs2文件系统的。yaffs2文件系统通过uboot烧录到nand。内核也打了yaffs2的补丁。挂载后文件能够ls出来。文件也能通过编辑器打开。没有乱码的现象。但是通过ls -al查看文件的详细内容发现文件的大小有误。而我新建一个文件,文件的大小是正确的。请问这是什么情况
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: [YAFFS2文件系统问题]yaffs2文件系统中的文件大小错误

#4

帖子 poloshiao » 2016-04-16 17:25

請先提供 作業系統 及 版本
如果能提供你如此掛載的參考文章 讓論壇上的網友 有個背景環境 的認識
比較能夠精確給你 可行性 建議
xukai_92
帖子: 5
注册时间: 2015-03-21 21:06
系统: windows 7

Re: [YAFFS2文件系统问题]yaffs2文件系统中的文件大小错误

#5

帖子 xukai_92 » 2016-04-16 17:40

内核版本号:2.6.35
uboot版本号:2009.03
yaffs2文件系统补丁为官网最新的补丁。
uboot烧录nand的补丁:https://patchwork.ozlabs.org/patch/77660/
nand信息:TC58BVG0S3HTA00 total size 128M pagesize 2048 sparearea 64 pageperblock 64
soft ecc verify
烧录进去的数据再dump出来发现是没有问题的。
mkyaffs2image工具制作文件系统时没有使用convert参数。内核中的yaffs2补丁没有做一点修改
以上,请参考。
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: [YAFFS2文件系统问题]yaffs2文件系统中的文件大小错误

#6

帖子 poloshiao » 2016-04-16 19:24

1. 看看 這幾段敘述 有沒有幫助

1-1. http://www.yaffs.net/documents/how-yaff ... NAND_model
10 Yaffs2 NAND model

1-2. http://www.yaffs.net/documents/how-yaff ... le_objects
12.6 File objects
This is the current length of the file. Note that a file might have holes in it caused by seeking forward past the extents of the file.
12.6.1 Tnode tree
As the file size grows, more tnodes are added and as the levels fill, more levels are added. If the file is truncated or resized downwards, then the tree is pruned. If a chunk in a file is replaced (eg. data is overwritten or copied by garbage collection) then the tnode tree must be updated to reflect the change.

1-3. 意思是 要更新 tnode tree 才能正確顯示出 file size
xukai_92
帖子: 5
注册时间: 2015-03-21 21:06
系统: windows 7

Re: [YAFFS2文件系统问题]yaffs2文件系统中的文件大小错误

#7

帖子 xukai_92 » 2016-04-18 8:58

您好,这个需要怎样更新呢。按道理来说,我把yaffs2烧录到nand就OK了。tnode tree的更新是内部做的一个动作
回复