Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
3ffa3c0e
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
161
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3ffa3c0e
编写于
6月 24, 2012
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
aio: now fput() is OK from interrupt context; get rid of manual delayed __fput()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
4a9d4b02
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
3 addition
and
70 deletion
+3
-70
fs/aio.c
fs/aio.c
+3
-70
未找到文件。
fs/aio.c
浏览文件 @
3ffa3c0e
...
...
@@ -56,13 +56,6 @@ static struct kmem_cache *kioctx_cachep;
static
struct
workqueue_struct
*
aio_wq
;
/* Used for rare fput completion. */
static
void
aio_fput_routine
(
struct
work_struct
*
);
static
DECLARE_WORK
(
fput_work
,
aio_fput_routine
);
static
DEFINE_SPINLOCK
(
fput_lock
);
static
LIST_HEAD
(
fput_head
);
static
void
aio_kick_handler
(
struct
work_struct
*
);
static
void
aio_queue_work
(
struct
kioctx
*
);
...
...
@@ -479,7 +472,6 @@ static int kiocb_batch_refill(struct kioctx *ctx, struct kiocb_batch *batch)
{
unsigned
short
allocated
,
to_alloc
;
long
avail
;
bool
called_fput
=
false
;
struct
kiocb
*
req
,
*
n
;
struct
aio_ring
*
ring
;
...
...
@@ -495,28 +487,11 @@ static int kiocb_batch_refill(struct kioctx *ctx, struct kiocb_batch *batch)
if
(
allocated
==
0
)
goto
out
;
retry:
spin_lock_irq
(
&
ctx
->
ctx_lock
);
ring
=
kmap_atomic
(
ctx
->
ring_info
.
ring_pages
[
0
]);
avail
=
aio_ring_avail
(
&
ctx
->
ring_info
,
ring
)
-
ctx
->
reqs_active
;
BUG_ON
(
avail
<
0
);
if
(
avail
==
0
&&
!
called_fput
)
{
/*
* Handle a potential starvation case. It is possible that
* we hold the last reference on a struct file, causing us
* to delay the final fput to non-irq context. In this case,
* ctx->reqs_active is artificially high. Calling the fput
* routine here may free up a slot in the event completion
* ring, allowing this allocation to succeed.
*/
kunmap_atomic
(
ring
);
spin_unlock_irq
(
&
ctx
->
ctx_lock
);
aio_fput_routine
(
NULL
);
called_fput
=
true
;
goto
retry
;
}
if
(
avail
<
allocated
)
{
/* Trim back the number of requests. */
list_for_each_entry_safe
(
req
,
n
,
&
batch
->
head
,
ki_batch
)
{
...
...
@@ -570,36 +545,6 @@ static inline void really_put_req(struct kioctx *ctx, struct kiocb *req)
wake_up_all
(
&
ctx
->
wait
);
}
static
void
aio_fput_routine
(
struct
work_struct
*
data
)
{
spin_lock_irq
(
&
fput_lock
);
while
(
likely
(
!
list_empty
(
&
fput_head
)))
{
struct
kiocb
*
req
=
list_kiocb
(
fput_head
.
next
);
struct
kioctx
*
ctx
=
req
->
ki_ctx
;
list_del
(
&
req
->
ki_list
);
spin_unlock_irq
(
&
fput_lock
);
/* Complete the fput(s) */
if
(
req
->
ki_filp
!=
NULL
)
fput
(
req
->
ki_filp
);
/* Link the iocb into the context's free list */
rcu_read_lock
();
spin_lock_irq
(
&
ctx
->
ctx_lock
);
really_put_req
(
ctx
,
req
);
/*
* at that point ctx might've been killed, but actual
* freeing is RCU'd
*/
spin_unlock_irq
(
&
ctx
->
ctx_lock
);
rcu_read_unlock
();
spin_lock_irq
(
&
fput_lock
);
}
spin_unlock_irq
(
&
fput_lock
);
}
/* __aio_put_req
* Returns true if this put was the last user of the request.
*/
...
...
@@ -618,21 +563,9 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)
req
->
ki_cancel
=
NULL
;
req
->
ki_retry
=
NULL
;
/*
* Try to optimize the aio and eventfd file* puts, by avoiding to
* schedule work in case it is not final fput() time. In normal cases,
* we would not be holding the last reference to the file*, so
* this function will be executed w/out any aio kthread wakeup.
*/
if
(
unlikely
(
!
fput_atomic
(
req
->
ki_filp
)))
{
spin_lock
(
&
fput_lock
);
list_add
(
&
req
->
ki_list
,
&
fput_head
);
spin_unlock
(
&
fput_lock
);
schedule_work
(
&
fput_work
);
}
else
{
req
->
ki_filp
=
NULL
;
really_put_req
(
ctx
,
req
);
}
fput
(
req
->
ki_filp
);
req
->
ki_filp
=
NULL
;
really_put_req
(
ctx
,
req
);
return
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录