首页 > 代码库 > Software Test HOMEWORK01:

Software Test HOMEWORK01:

Software Test HOMEWORK01:

    In the previous operating system project, we need to enlarge the xv6 file distribution system. In this allocation, it will increase the maximum size of the xv6 file. The current xv6 file is limited to 140 sectors. After changing the xv6 file system code, implement the "double indirect" block that supports each inode. The result of the operation shows that a file will be able to include up to 16523 sectors.

Error handling:

In this experiment encountered a problem, is when I start to start up the virtual machine, the creation of fs.img file is always fail, I began to follow the prompts and deleted the original fs.img file, then tried to make fs.img again but still failed. The teacher said that there some problems in my code.

   And the reported statement showed that mkfs.c file (BSIZE% sizeof (struct dinode)) == 0 ‘. But I have not changed this file. May be the establishment of the file system fs.c has a problem, I re-check the bmap function code, my code format and ideas, but those are same to the bmap function before I modified .

   So I changed the file before they are restored to run big.c file 140 sectors, then one by one to changed the file,tested and ran it. Found in the fs.h file is a problem. According to the structure of the xv6 system (as shown below), there should be 12 direct pointers and an indirect pointer.

                                                            技术分享

   I changed the address statement at first, but there is no real change for the NDIRECT number, so the address has been wrong (wrong as shown in the red box below).

                                                            技术分享

I only noticed to add an indirect pointer, forgot to reduce the number of direct pointers. Later, I reduced the number of NDIRECT 1, the largest file expanded into (NDIRECT + NINDIRECT + NINDIRECT * NINDIRECT) on it. After that, the file system works successfully.

 

 

软件测试HOMEWORK01:

    在之前的操作系统项目中,我们需要改造xv6的文件分配系统。在此分配中将增加xv6文件的最大大小。 目前xv6文件限制为140个扇区。在更改了xv6文件系统代码,实现支持每个inode中的“双重间接”块。运行结果显示一个文件将能够包括多达16523扇区。

出错处理:

在此次实验中遇到了一个问题,就是启动虚拟机的时候建立fs.img文件总是失败,我一开始按照提示上说的删除了原来的fs.img文件,然后make fs.img但还是failed,老师说是代码的问题。报错的语句说mkfs.c文件(BSIZE % sizeof(struct dinode)) == 0‘出问题了。但是我并没有更改过这个文件。可能是建立文件系统时fs.c出了问题,我又重新检查了bmap函数里的代码,我的代码格式和思路和修改前的bmap函数一致。所以我又把之前改过文件都还原到运行big.c文件140个扇区之后的状态,然后再一个个更改文件试运行。发现是在fs.h文件上出了问题。按照xv6系统的结构(如下图所示),应该有12个直接指针和一个间接指针。

                      技术分享

  我一开始只改了地址声明,没有实际改NDIRECT的数,所以出来的地址一直是错的(错误如下图红色框所示)。

                                                             技术分享

   我只注意了要增加一个间接指针,忘了要减少直接指针数量了。后来我将NDIRECT数量减少1,将最大文件扩展成(NDIRECT + NINDIRECT + NINDIRECT * NINDIRECT)就可以了。

Software Test HOMEWORK01: