📄 elevator.c.txt
字号:
any problems,send mails to sindybear@163.com
相关文件
/drivers/block/ll_rw_dev.c
****************************基本函数************************************
(1)void elevator_init(elevator_t * elevator, elevator_t type)
//对电梯合并算法进行设置。目前有两种,一种linux,一种noop
(2)int elevator_noop_merge(request_queue_t *q, struct request **req,
struct list_head * head,
struct buffer_head *bh, int rw,
int max_sectors)
while ((entry = entry->prev) != head) //扫描整个请求处理队列
if (__rq->cmd != rw)
continue;
if (__rq->rq_dev != bh->b_rdev)
continue;
if (__rq->nr_sectors + count > max_sectors)
continue;
if (__rq->waiting)
continue; //找到合适的request
//按照request中的数据看新到的bh放到哪里合适
if (__rq->sector + __rq->nr_sectors == bh->b_rsector) {
*req = __rq;
return ELEVATOR_BACK_MERGE;
} else if (__rq->sector - count == bh->b_rsector) {
*req = __rq;
return ELEVATOR_FRONT_MERGE;
}
(3)int elevator_linus_merge(request_queue_t *q, struct request **req, //默认合并处理函数
struct list_head * head,
struct buffer_head *bh, int rw,
int max_sectors)
************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -