- 论坛徽章:
- 0
|
我通过打印debug信息,发现错误是从/fs/fat/misc.c 打出的
int fat_add_cluster(struct inode *inode)
{
[。。。。]
/* We must locate the last cluster of the file to add this
new one (nr) to the end of the link list (the FAT).
Here file_cluster will be the number of the last cluster of the
file (before we add nr).
last is the corresponding cluster number on the disk. We will
use last to plug the nr cluster. We will use file_cluster to
update the cache.
*/
last = file_cluster = 0;
if ((curr = MSDOS_I(inode)->i_start) != 0) {
fat_cache_lookup(inode, INT_MAX, &last, &curr);
file_cluster = last;
while (curr && curr != -1){
file_cluster++;
if (!(curr = fat_access(sb, last = curr,-1))) {
fat_fs_panic(sb, "File without EOF");//这里打印出出错信息
return res;
}
}
}
if (last) {
fat_access(sb, last, nr);
fat_cache_add(inode, file_cluster, nr);
} else {
MSDOS_I(inode)->i_start = nr;
MSDOS_I(inode)->i_logstart = nr;
mark_inode_dirty(inode);
}
if (file_cluster
!= inode->i_blocks / cluster_size / (sb->s_blocksize / 512)) {
printk ("file_cluster badly computed!!! %d <> %ld\n", //有时候也在这里出错
file_cluster,
inode->i_blocks / cluster_size / (sb->s_blocksize / 512));
fat_cache_inval_inode(inode);
}
inode->i_blocks += (1 << MSDOS_SB(sb)->cluster_bits) / 512;
return nr;
} |
|