Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
4eb166d9
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
4eb166d9
编写于
2月 01, 2008
作者:
J
Jens Axboe
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
block: make elevator lib checkpatch compliant
Signed-off-by:
N
Jens Axboe
<
jens.axboe@oracle.com
>
上级
fe094d98
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
27 deletion
+30
-27
block/elevator.c
block/elevator.c
+30
-27
未找到文件。
block/elevator.c
浏览文件 @
4eb166d9
...
@@ -45,7 +45,8 @@ static LIST_HEAD(elv_list);
...
@@ -45,7 +45,8 @@ static LIST_HEAD(elv_list);
*/
*/
static
const
int
elv_hash_shift
=
6
;
static
const
int
elv_hash_shift
=
6
;
#define ELV_HASH_BLOCK(sec) ((sec) >> 3)
#define ELV_HASH_BLOCK(sec) ((sec) >> 3)
#define ELV_HASH_FN(sec) (hash_long(ELV_HASH_BLOCK((sec)), elv_hash_shift))
#define ELV_HASH_FN(sec) \
(hash_long(ELV_HASH_BLOCK((sec)), elv_hash_shift))
#define ELV_HASH_ENTRIES (1 << elv_hash_shift)
#define ELV_HASH_ENTRIES (1 << elv_hash_shift)
#define rq_hash_key(rq) ((rq)->sector + (rq)->nr_sectors)
#define rq_hash_key(rq) ((rq)->sector + (rq)->nr_sectors)
#define ELV_ON_HASH(rq) (!hlist_unhashed(&(rq)->hash))
#define ELV_ON_HASH(rq) (!hlist_unhashed(&(rq)->hash))
...
@@ -224,15 +225,27 @@ int elevator_init(struct request_queue *q, char *name)
...
@@ -224,15 +225,27 @@ int elevator_init(struct request_queue *q, char *name)
q
->
end_sector
=
0
;
q
->
end_sector
=
0
;
q
->
boundary_rq
=
NULL
;
q
->
boundary_rq
=
NULL
;
if
(
name
&&
!
(
e
=
elevator_get
(
name
)))
if
(
name
)
{
return
-
EINVAL
;
e
=
elevator_get
(
name
);
if
(
!
e
)
return
-
EINVAL
;
}
if
(
!
e
&&
*
chosen_elevator
&&
!
(
e
=
elevator_get
(
chosen_elevator
)))
if
(
!
e
&&
*
chosen_elevator
)
{
printk
(
"I/O scheduler %s not found
\n
"
,
chosen_elevator
);
e
=
elevator_get
(
chosen_elevator
);
if
(
!
e
)
printk
(
KERN_ERR
"I/O scheduler %s not found
\n
"
,
chosen_elevator
);
}
if
(
!
e
&&
!
(
e
=
elevator_get
(
CONFIG_DEFAULT_IOSCHED
)))
{
if
(
!
e
)
{
printk
(
"Default I/O scheduler not found, using no-op
\n
"
);
e
=
elevator_get
(
CONFIG_DEFAULT_IOSCHED
);
e
=
elevator_get
(
"noop"
);
if
(
!
e
)
{
printk
(
KERN_ERR
"Default I/O scheduler not found. "
\
"Using noop.
\n
"
);
e
=
elevator_get
(
"noop"
);
}
}
}
eq
=
elevator_alloc
(
q
,
e
);
eq
=
elevator_alloc
(
q
,
e
);
...
@@ -248,7 +261,6 @@ int elevator_init(struct request_queue *q, char *name)
...
@@ -248,7 +261,6 @@ int elevator_init(struct request_queue *q, char *name)
elevator_attach
(
q
,
eq
,
data
);
elevator_attach
(
q
,
eq
,
data
);
return
ret
;
return
ret
;
}
}
EXPORT_SYMBOL
(
elevator_init
);
EXPORT_SYMBOL
(
elevator_init
);
void
elevator_exit
(
elevator_t
*
e
)
void
elevator_exit
(
elevator_t
*
e
)
...
@@ -261,7 +273,6 @@ void elevator_exit(elevator_t *e)
...
@@ -261,7 +273,6 @@ void elevator_exit(elevator_t *e)
kobject_put
(
&
e
->
kobj
);
kobject_put
(
&
e
->
kobj
);
}
}
EXPORT_SYMBOL
(
elevator_exit
);
EXPORT_SYMBOL
(
elevator_exit
);
static
void
elv_activate_rq
(
struct
request_queue
*
q
,
struct
request
*
rq
)
static
void
elv_activate_rq
(
struct
request_queue
*
q
,
struct
request
*
rq
)
...
@@ -353,7 +364,6 @@ struct request *elv_rb_add(struct rb_root *root, struct request *rq)
...
@@ -353,7 +364,6 @@ struct request *elv_rb_add(struct rb_root *root, struct request *rq)
rb_insert_color
(
&
rq
->
rb_node
,
root
);
rb_insert_color
(
&
rq
->
rb_node
,
root
);
return
NULL
;
return
NULL
;
}
}
EXPORT_SYMBOL
(
elv_rb_add
);
EXPORT_SYMBOL
(
elv_rb_add
);
void
elv_rb_del
(
struct
rb_root
*
root
,
struct
request
*
rq
)
void
elv_rb_del
(
struct
rb_root
*
root
,
struct
request
*
rq
)
...
@@ -362,7 +372,6 @@ void elv_rb_del(struct rb_root *root, struct request *rq)
...
@@ -362,7 +372,6 @@ void elv_rb_del(struct rb_root *root, struct request *rq)
rb_erase
(
&
rq
->
rb_node
,
root
);
rb_erase
(
&
rq
->
rb_node
,
root
);
RB_CLEAR_NODE
(
&
rq
->
rb_node
);
RB_CLEAR_NODE
(
&
rq
->
rb_node
);
}
}
EXPORT_SYMBOL
(
elv_rb_del
);
EXPORT_SYMBOL
(
elv_rb_del
);
struct
request
*
elv_rb_find
(
struct
rb_root
*
root
,
sector_t
sector
)
struct
request
*
elv_rb_find
(
struct
rb_root
*
root
,
sector_t
sector
)
...
@@ -383,7 +392,6 @@ struct request *elv_rb_find(struct rb_root *root, sector_t sector)
...
@@ -383,7 +392,6 @@ struct request *elv_rb_find(struct rb_root *root, sector_t sector)
return
NULL
;
return
NULL
;
}
}
EXPORT_SYMBOL
(
elv_rb_find
);
EXPORT_SYMBOL
(
elv_rb_find
);
/*
/*
...
@@ -395,6 +403,7 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq)
...
@@ -395,6 +403,7 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq)
{
{
sector_t
boundary
;
sector_t
boundary
;
struct
list_head
*
entry
;
struct
list_head
*
entry
;
int
stop_flags
;
if
(
q
->
last_merge
==
rq
)
if
(
q
->
last_merge
==
rq
)
q
->
last_merge
=
NULL
;
q
->
last_merge
=
NULL
;
...
@@ -404,13 +413,13 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq)
...
@@ -404,13 +413,13 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq)
q
->
nr_sorted
--
;
q
->
nr_sorted
--
;
boundary
=
q
->
end_sector
;
boundary
=
q
->
end_sector
;
stop_flags
=
REQ_SOFTBARRIER
|
REQ_HARDBARRIER
|
REQ_STARTED
;
list_for_each_prev
(
entry
,
&
q
->
queue_head
)
{
list_for_each_prev
(
entry
,
&
q
->
queue_head
)
{
struct
request
*
pos
=
list_entry_rq
(
entry
);
struct
request
*
pos
=
list_entry_rq
(
entry
);
if
(
rq_data_dir
(
rq
)
!=
rq_data_dir
(
pos
))
if
(
rq_data_dir
(
rq
)
!=
rq_data_dir
(
pos
))
break
;
break
;
if
(
pos
->
cmd_flags
&
(
REQ_SOFTBARRIER
|
REQ_HARDBARRIER
|
REQ_STARTED
)
)
if
(
pos
->
cmd_flags
&
stop_flags
)
break
;
break
;
if
(
rq
->
sector
>=
boundary
)
{
if
(
rq
->
sector
>=
boundary
)
{
if
(
pos
->
sector
<
boundary
)
if
(
pos
->
sector
<
boundary
)
...
@@ -425,7 +434,6 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq)
...
@@ -425,7 +434,6 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq)
list_add
(
&
rq
->
queuelist
,
entry
);
list_add
(
&
rq
->
queuelist
,
entry
);
}
}
EXPORT_SYMBOL
(
elv_dispatch_sort
);
EXPORT_SYMBOL
(
elv_dispatch_sort
);
/*
/*
...
@@ -446,7 +454,6 @@ void elv_dispatch_add_tail(struct request_queue *q, struct request *rq)
...
@@ -446,7 +454,6 @@ void elv_dispatch_add_tail(struct request_queue *q, struct request *rq)
q
->
boundary_rq
=
rq
;
q
->
boundary_rq
=
rq
;
list_add_tail
(
&
rq
->
queuelist
,
&
q
->
queue_head
);
list_add_tail
(
&
rq
->
queuelist
,
&
q
->
queue_head
);
}
}
EXPORT_SYMBOL
(
elv_dispatch_add_tail
);
EXPORT_SYMBOL
(
elv_dispatch_add_tail
);
int
elv_merge
(
struct
request_queue
*
q
,
struct
request
**
req
,
struct
bio
*
bio
)
int
elv_merge
(
struct
request_queue
*
q
,
struct
request
**
req
,
struct
bio
*
bio
)
...
@@ -665,7 +672,8 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where,
...
@@ -665,7 +672,8 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where,
q
->
end_sector
=
rq_end_sector
(
rq
);
q
->
end_sector
=
rq_end_sector
(
rq
);
q
->
boundary_rq
=
rq
;
q
->
boundary_rq
=
rq
;
}
}
}
else
if
(
!
(
rq
->
cmd_flags
&
REQ_ELVPRIV
)
&&
where
==
ELEVATOR_INSERT_SORT
)
}
else
if
(
!
(
rq
->
cmd_flags
&
REQ_ELVPRIV
)
&&
where
==
ELEVATOR_INSERT_SORT
)
where
=
ELEVATOR_INSERT_BACK
;
where
=
ELEVATOR_INSERT_BACK
;
if
(
plug
)
if
(
plug
)
...
@@ -673,7 +681,6 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where,
...
@@ -673,7 +681,6 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where,
elv_insert
(
q
,
rq
,
where
);
elv_insert
(
q
,
rq
,
where
);
}
}
EXPORT_SYMBOL
(
__elv_add_request
);
EXPORT_SYMBOL
(
__elv_add_request
);
void
elv_add_request
(
struct
request_queue
*
q
,
struct
request
*
rq
,
int
where
,
void
elv_add_request
(
struct
request_queue
*
q
,
struct
request
*
rq
,
int
where
,
...
@@ -685,7 +692,6 @@ void elv_add_request(struct request_queue *q, struct request *rq, int where,
...
@@ -685,7 +692,6 @@ void elv_add_request(struct request_queue *q, struct request *rq, int where,
__elv_add_request
(
q
,
rq
,
where
,
plug
);
__elv_add_request
(
q
,
rq
,
where
,
plug
);
spin_unlock_irqrestore
(
q
->
queue_lock
,
flags
);
spin_unlock_irqrestore
(
q
->
queue_lock
,
flags
);
}
}
EXPORT_SYMBOL
(
elv_add_request
);
EXPORT_SYMBOL
(
elv_add_request
);
static
inline
struct
request
*
__elv_next_request
(
struct
request_queue
*
q
)
static
inline
struct
request
*
__elv_next_request
(
struct
request_queue
*
q
)
...
@@ -792,7 +798,6 @@ struct request *elv_next_request(struct request_queue *q)
...
@@ -792,7 +798,6 @@ struct request *elv_next_request(struct request_queue *q)
return
rq
;
return
rq
;
}
}
EXPORT_SYMBOL
(
elv_next_request
);
EXPORT_SYMBOL
(
elv_next_request
);
void
elv_dequeue_request
(
struct
request_queue
*
q
,
struct
request
*
rq
)
void
elv_dequeue_request
(
struct
request_queue
*
q
,
struct
request
*
rq
)
...
@@ -810,7 +815,6 @@ void elv_dequeue_request(struct request_queue *q, struct request *rq)
...
@@ -810,7 +815,6 @@ void elv_dequeue_request(struct request_queue *q, struct request *rq)
if
(
blk_account_rq
(
rq
))
if
(
blk_account_rq
(
rq
))
q
->
in_flight
++
;
q
->
in_flight
++
;
}
}
EXPORT_SYMBOL
(
elv_dequeue_request
);
EXPORT_SYMBOL
(
elv_dequeue_request
);
int
elv_queue_empty
(
struct
request_queue
*
q
)
int
elv_queue_empty
(
struct
request_queue
*
q
)
...
@@ -825,7 +829,6 @@ int elv_queue_empty(struct request_queue *q)
...
@@ -825,7 +829,6 @@ int elv_queue_empty(struct request_queue *q)
return
1
;
return
1
;
}
}
EXPORT_SYMBOL
(
elv_queue_empty
);
EXPORT_SYMBOL
(
elv_queue_empty
);
struct
request
*
elv_latter_request
(
struct
request_queue
*
q
,
struct
request
*
rq
)
struct
request
*
elv_latter_request
(
struct
request_queue
*
q
,
struct
request
*
rq
)
...
@@ -994,7 +997,8 @@ void elv_register(struct elevator_type *e)
...
@@ -994,7 +997,8 @@ void elv_register(struct elevator_type *e)
!
strcmp
(
e
->
elevator_name
,
CONFIG_DEFAULT_IOSCHED
)))
!
strcmp
(
e
->
elevator_name
,
CONFIG_DEFAULT_IOSCHED
)))
def
=
" (default)"
;
def
=
" (default)"
;
printk
(
KERN_INFO
"io scheduler %s registered%s
\n
"
,
e
->
elevator_name
,
def
);
printk
(
KERN_INFO
"io scheduler %s registered%s
\n
"
,
e
->
elevator_name
,
def
);
}
}
EXPORT_SYMBOL_GPL
(
elv_register
);
EXPORT_SYMBOL_GPL
(
elv_register
);
...
@@ -1126,7 +1130,8 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name,
...
@@ -1126,7 +1130,8 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name,
}
}
if
(
!
elevator_switch
(
q
,
e
))
if
(
!
elevator_switch
(
q
,
e
))
printk
(
KERN_ERR
"elevator: switch to %s failed
\n
"
,
elevator_name
);
printk
(
KERN_ERR
"elevator: switch to %s failed
\n
"
,
elevator_name
);
return
count
;
return
count
;
}
}
...
@@ -1160,7 +1165,6 @@ struct request *elv_rb_former_request(struct request_queue *q,
...
@@ -1160,7 +1165,6 @@ struct request *elv_rb_former_request(struct request_queue *q,
return
NULL
;
return
NULL
;
}
}
EXPORT_SYMBOL
(
elv_rb_former_request
);
EXPORT_SYMBOL
(
elv_rb_former_request
);
struct
request
*
elv_rb_latter_request
(
struct
request_queue
*
q
,
struct
request
*
elv_rb_latter_request
(
struct
request_queue
*
q
,
...
@@ -1173,5 +1177,4 @@ struct request *elv_rb_latter_request(struct request_queue *q,
...
@@ -1173,5 +1177,4 @@ struct request *elv_rb_latter_request(struct request_queue *q,
return
NULL
;
return
NULL
;
}
}
EXPORT_SYMBOL
(
elv_rb_latter_request
);
EXPORT_SYMBOL
(
elv_rb_latter_request
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录