如何恢复Linux上删除的文件 (6)
http://tech.ddvip.com 2008年04月15日 社区交流
内容摘要:reiserfs 对于小文件的存取速度非常高,这取决于它所采用的精美的设计:reiserfs 文件系统就是一棵动态的 B+ 树,小文件和大文件的尾部数据都可以通过保存到叶子节点中而加快存取速度。本文将探讨 reiserfs 的设计和实现内幕,并从中探讨恢复删除文件的可能性。
清单2. reiserfs 中与关键字有关的定义
363 struct offset_v1 {
364 __le32 k_offset;
365 __le32 k_uniqueness;
366 } __attribute__ ((__packed__));
367
368 struct offset_v2 {
369 __le64 v;
370 } __attribute__ ((__packed__));
371
372 static inline __u16 offset_v2_k_type(const struct offset_v2 *v2)
373 {
374 __u8 type = le64_to_cpu(v2->v) >> 60;
375 return (type <= TYPE_MAXTYPE) ? type : TYPE_ANY;
376 }
377
378 static inline void set_offset_v2_k_type(struct offset_v2 *v2, int type)
379 {
380 v2->v =
381 (v2->v & cpu_to_le64(~0ULL >> 4)) | cpu_to_le64((__u64) type << 60);
382 }
383
384 static inline loff_t offset_v2_k_offset(const struct offset_v2 *v2)
385 {
386 return le64_to_cpu(v2->v) & (~0ULL >> 4);
387 }
388
389 static inline void set_offset_v2_k_offset(struct offset_v2 *v2, loff_t offset)
390 {
391 offset &= (~0ULL >> 4);
392 v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset);
393 }
394
395 /* Key of an item determines its location in the S+tree, and
396 is composed of 4 components */
397 struct reiserfs_key {
398 __le32 k_dir_id; /* packing locality: by default parent
399 directory object id */
400 __le32 k_objectid; /* object identifier */
401 union {
402 struct offset_v1 k_offset_v1;
403 struct offset_v2 k_offset_v2;
404 } __attribute__ ((__packed__)) u;
405 } __attribute__ ((__packed__));
406
来源:ibm 作者:冯锐 丁成 责编:豆豆技术应用
- Linux/Unix 新闻
- Linux/Unix 入门
- Linux/Unix 命令
- Linux/Unix 安装
- Linux 嵌入式系统
- Linux/Unix 编程
- Linux/Unix 管理
- Linux/Unix 桌面
- Linux/Unix 内核
- Linux/Unix 软件
- SCO Unix
- NetBSD
- OpenBSD
- Redhat/Fedora Linux
- 手机
- Linux/Unix find 搜索命令
- Linux/Unix vi 命令
- Linux/Unix kde 桌面环境
- Linux/Unix GNOME 桌面环境
- Linux/Unix Make 命令
- Linux/Unix crontab 命令
- Linux/Unix ext3 文件系统
- Linux/Unix 文件系统详解
- Linux/Unix ADSL 拨号设置
- Linux/Unix GRUB 配置及应用
- Linux/Unix nfs配置
- Linux/Unix 硬件信息查看及管理
- Linux/Unix 优化
- Linux/Unix 交换分区Swap管理及应用
- Linux/Unix 用户管理
- Linux/Unix Ramdisk
- Linux/Unix 密码恢复管理
- Linux/Unix 文件删除恢复
- Linux/Unix fdisk分区
- Linux/Unix lvs负载均衡管理
- Linux/Unix root用户
- Linux/Unix 集群
- Linux/Unix 日志
- 更多Linux/Unix专题……