从文件系统的一致性角度讲,元数据比普通数据要关键,因此在处理request时最好能给与一定的优先级,因此REQ_META在旧版的内核是自带priority的,但是这有一个问题就是对于想给与优先级,但是又不是metadata的request就有点蛋疼,用了REQ_META会引起歧义,直到这个patch的出现:
commit 65299a3b788bd274bed92f9fa3232082c9f3ea70
Author: Christoph Hellwig
Date: Tue Aug 23 14:50:29 2011 +0200
block: separate priority boosting from REQ_META
Add a new REQ_PRIO to let requests preempt others in the cfq I/O schedule,
and lave REQ_META purely for marking requests as metadata in blktrace.
All existing callers of REQ_META except for XFS are updated to also
set REQ_PRIO for now.
Signed-off-by: Christoph Hellwig
Reviewed-by: Namhyung Kim
Signed-off-by: Jens Axboe
把REQ_PRIO和REQ_META分离,各司其职,REQ_META仅用于描述request是一个元数据请求,而REQ_PRIO用于给CFQ在调度时的优先级hint:
static void cfqq_boost_on_prio(struct cfq_queue *cfqq, int op_flags)
{
/*
* If REQ_PRIO is set, boost class and prio level, if it's below
* BE/NORM. If prio is not set, restore the potentially boosted
* class/prio level.
*/
if (!(op_flags & REQ_PRIO)) {
cfqq->ioprio_class = cfqq->org_ioprio_class;
cfqq->ioprio = cfqq->org_ioprio;
} else {
if (cfq_class_idle(cfqq))
cfqq->ioprio_class = IOPRIO_CLASS_BE;
if (cfqq->ioprio > IOPRIO_NORM)
cfqq->ioprio = IOPRIO_NORM;
}
}
目前来讲REQ_PRIO只作用于cfq,也是因为它有优先级队列的原因,而其他几种调度器比较耿直,想用hint搞特权不太好弄。
阅读(1993) | 评论(0) | 转发(0) |