xv6 big file
来源:互联网 发布:unity3d 旋转 编辑:程序博客网 时间:2024/06/07 15:47
xv6 Big file
实验步骤:
1、修改Makefile文件:将CPUS的值设为1,,并添加如下语句。目的是加快xv6创建大文件时的qemu的运行速度:
2、修改param.h文件,将文件系统的最大数据块数设置为20000:
3、下载big.c文件放入xv6的目录下,并在Makefile文件中的UPROGS列表中增加对big命令的引用:
4、启动xv6,输入big命令,显示“wrote 140 sectors”,说明所有的准备工作已完成:
5、修改fs.c中的bmap()函数如下:
static uintbmap(struct inode *ip, uint bn){ uint addr, *a, *indirect, *double_indirect,indirect_idx, double_indirect_idx; struct buf *bp, *bp2; if(bn < NDIRECT){ if((addr = ip->addrs[bn]) == 0) ip->addrs[bn] = addr =balloc(ip->dev); return addr; } bn -= NDIRECT; if(bn < NINDIRECT){ // Load indirect block, allocating ifnecessary. if((addr = ip->addrs[NDIRECT]) == 0) ip->addrs[NDIRECT] = addr =balloc(ip->dev); bp = bread(ip->dev, addr); a = (uint*)bp->data; if((addr = a[bn]) == 0){ a[bn] = addr = balloc(ip->dev); log_write(bp); } brelse(bp); return addr; } bn -= NINDIRECT; if (bn < NINDIRECT*NINDIRECT) { // Load first indirect block, allocating ifnecessary. if((addr = ip->addrs[NDIRECT + 1]) == 0) ip->addrs[NDIRECT + 1] = addr =balloc(ip->dev); bp = bread(ip->dev, addr); indirect = (uint *) bp->data; indirect_idx = bn / NINDIRECT; if ((addr = indirect[indirect_idx]) == 0) { addr = indirect[indirect_idx] =balloc(ip->dev); log_write(bp); } bp2 = bread(ip->dev, addr); double_indirect = (uint *) bp2->data; double_indirect_idx = bn % NINDIRECT; if((addr = double_indirect[double_indirect_idx]) == 0) { addr =double_indirect[double_indirect_idx] = balloc(ip->dev); log_write(bp2); } brelse(bp2); brelse(bp); return addr; } panic("bmap: out of range");}
6、打开fs.h文件,将NDIRECT的值改为11,对应的架构数据块地址的索引由加1变为加2,最后将MAXFILE修改成如下值:
7、保存后重新启动xv6,输入big命令,得到如下运行结果说明实验成功:
阅读全文
0 0
- xv6 big file
- find big file
- Zip file too big
- Hadoop allocate big file
- yale_OS(7)——xv6中的文件系统(File System)
- SubString match with a big file
- 2GB FILE REASONS TOO BIG
- xv6 shell
- xv6 locking
- xv6 barrier
- xv6 crash
- big
- Big back up file size of BlueStacks Beta
- error: Zip file too big (greater than 4294959102 bytes)
- mini2440 Length of file is too big 解决办法
- xml file too big to import to wordpress website
- Yandex Big Data Essentials Week1 Scaling Distributed File System
- XV6内存布局
- jQuery——获取复选框被选中的值
- 取得目录和取得操作系统盘符以及获取系统盘可用空间
- 产品开发记录[linux嵌入式]
- 操作系统之进程的描述与控制1
- iOS开发加载网页(webview)时的菊花(小圈)
- xv6 big file
- java自学方法论
- 如何让摄像机跟随你的角色,并且按鼠标右键围绕旋转
- Android5.0和6.0之后新增的控件说明
- Kotlin Extension Function
- linux ".XXXX.swp"
- 追梦的心岂会凋零
- 可能需要其他登录信息
- windows下eclipse编译报错:CreateProcess error=206