Chinaunix首页 | 论坛 | 博客
  • 博客访问: 534362
  • 博文数量: 64
  • 博客积分: 1591
  • 博客等级: 上尉
  • 技术积分: 736
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-08 14:54
文章分类

全部博文(64)

文章存档

2011年(42)

2010年(22)

分类: LINUX

2010-12-14 19:26:11

dm_time_t dm_acctime(struct dm_disk_if *,
struct dm_mech_state *initial_state,
struct dm_pbn *start,
int len,
int rw,
int immed,
struct dm_mech_state *result_state);
 
Diskmodel的提供的这个API函数是用来计算一个请求在磁盘上的access time的(seek time + rotational time + transfer time)
 
各个参数的意义分别是:
struct dm_disk_if *  指的是diskmodel模型
struct dm_mech_state *initial_state  指的是磁盘的当前状态(未执行这个请求前的状态),dm_mech_state这个结构的定义如下:
// the state of the mechanical elements
struct dm_mech_state {
  int cyl;//柱面
  int head;//磁头
  // divide the circle into 2^32 angles; increments of  pi / 2^31 radians
  dm_angle_t theta;//当前角度
};
struct dm_pbn *start指的是要访问的物理扇区地址,这个结构的定义如下:
// a physical block address
struct dm_pbn {
  int cyl;//柱面
  int head;//磁头
  int sector;//扇区
};
int len 指的是要访问的扇区的个数
int rw  0标明是写操作 1标明是读操作
int immed  0标明是一个“zero-latency“ access
struct dm_mech_state *result_state 指的是请求服务完成后磁盘的状态。
但是在做实验的时后,result_state值并没有更新,这证明,并没有将服务完成后的结果返回。
问题出在diskmodel/mech_g1.c这个文件的dm_acctime_g1这个函数
 
在这个函数的最后,return result之前加上:
result_state->cyl = s2->cyl;
result_state->head = s2->head;
result_state->theta = s2->theta;
 
测试通过。
阅读(2103) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~