内容摘要:reiserfs 对于小文件的存取速度非常高,这取决于它所采用的精美的设计:reiserfs 文件系统就是一棵动态的 B+ 树,小文件和大文件的尾部数据都可以通过保存到叶子节点中而加快存取速度。本文将探讨 reiserfs 的设计和实现内幕,并从中探讨恢复删除文件的可能性。
图 4. 格式化叶子节点的布局

从图中可以看出,每个格式化叶子节点都以一个数据块头开始,然后是从两端向中间伸展的条目头和条目数据的数组,空闲空间保留在中间,这种设计是为了扩充方便。
所谓条目(item,或称为项)就是可以存储在单个节点中的一个数据容器,我们可以认为条目是由条目头和条目数据体组成的。
清单5. item_head 结构定义
460 /* Everything in the filesystem is stored as a set of items. The
461 item head contains the key of the item, its free space (for
462 indirect items) and specifies the location of the item itself
463 within the block. */
464
465 struct item_head {
466 /* Everything in the tree is found by searching for it based on
467 * its key.*/
468 struct reiserfs_key ih_key;
469 union {
470 /* The free space in the last unformatted node of an
471 indirect item if this is an indirect item. This
472 equals 0xFFFF iff this is a direct item or stat data
473 item. Note that the key, not this field, is used to
474 determine the item type, and thus which field this
475 union contains. */
476 __le16 ih_free_space_reserved;
477 /* Iff this is a directory item, this field equals the
478 number of directory entries in the directory item. */
479 __le16 ih_entry_count;
480 } __attribute__ ((__packed__)) u;
481 __le16 ih_item_len; /* total size of the item body */
482 __le16 ih_item_location; /* an offset to the item body
483 * within the block */
484 __le16 ih_version; /* 0 for all old items, 2 for new
485 ones. Highest bit is set by fsck
486 temporary, cleaned after all
487 done */
488 } __attribute__ ((__packed__));
来源:ibm 作者:冯锐 丁成 责编:豆豆技术应用
- Linux/Unix新闻
- Linux/Unix入门
- Linux/Unix命令
- Linux/Unix安装
- Linux/Unix编程
- Linux/Unix管理
- Linux/Unix桌面
- Linux/Unix内核
- Linux/Unix软件
- Linux/Unix发行版
- redhat/Fedora
- Ubuntu Linux
- IBM AIX
- FreeBSD
- Solaris
- NetBSD
- SCO Unix
- find基本用法
- ldd命令原理及用法例子
- su和sudo命令的区别与使用技巧
- Linux操作系统下的dd命令技巧
- 关于Top命令的参数详解
- 关于Tar命令的使用
- SSH实用技巧及常用命令使用
- Linux后台执行命令
- VI命令使用技巧集锦
- Vmstat命令列出的属性详解
- 如何查看及修改文件读写权限
- 最大可存储的单文件容量
- ext2/ext3文件系统介绍
- 常用压缩格式的压缩解压方法
- Linux系统的引导过程详细解析
- Configure参数解释说明
- Linux下硬盘和分区的命名方法
- 硬链接与软链接的区别
- 权限和所有权模型
- 存储设备的两种表示方法