Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
b33d9f59
K
Kernel
项目概览
openeuler
/
Kernel
大约 2 年 前同步成功
通知
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看板
提交
b33d9f59
编写于
8月 14, 2021
作者:
T
Theodore Ts'o
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
jbd2: add sparse annotations for add_transaction_credits()
Signed-off-by:
N
Theodore Ts'o
<
tytso@mit.edu
>
上级
a5fda113
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
1 deletion
+18
-1
fs/jbd2/transaction.c
fs/jbd2/transaction.c
+18
-1
未找到文件。
fs/jbd2/transaction.c
浏览文件 @
b33d9f59
...
@@ -223,9 +223,15 @@ static void sub_reserved_credits(journal_t *journal, int blocks)
...
@@ -223,9 +223,15 @@ static void sub_reserved_credits(journal_t *journal, int blocks)
* with j_state_lock held for reading. Returns 0 if handle joined the running
* with j_state_lock held for reading. Returns 0 if handle joined the running
* transaction. Returns 1 if we had to wait, j_state_lock is dropped, and
* transaction. Returns 1 if we had to wait, j_state_lock is dropped, and
* caller must retry.
* caller must retry.
*
* Note: because j_state_lock may be dropped depending on the return
* value, we need to fake out sparse so ti doesn't complain about a
* locking imbalance. Callers of add_transaction_credits will need to
* make a similar accomodation.
*/
*/
static
int
add_transaction_credits
(
journal_t
*
journal
,
int
blocks
,
static
int
add_transaction_credits
(
journal_t
*
journal
,
int
blocks
,
int
rsv_blocks
)
int
rsv_blocks
)
__must_hold
(
&
journal
->
j_state_lock
)
{
{
transaction_t
*
t
=
journal
->
j_running_transaction
;
transaction_t
*
t
=
journal
->
j_running_transaction
;
int
needed
;
int
needed
;
...
@@ -238,6 +244,7 @@ static int add_transaction_credits(journal_t *journal, int blocks,
...
@@ -238,6 +244,7 @@ static int add_transaction_credits(journal_t *journal, int blocks,
if
(
t
->
t_state
!=
T_RUNNING
)
{
if
(
t
->
t_state
!=
T_RUNNING
)
{
WARN_ON_ONCE
(
t
->
t_state
>=
T_FLUSH
);
WARN_ON_ONCE
(
t
->
t_state
>=
T_FLUSH
);
wait_transaction_locked
(
journal
);
wait_transaction_locked
(
journal
);
__acquire
(
&
journal
->
j_state_lock
);
/* fake out sparse */
return
1
;
return
1
;
}
}
...
@@ -266,10 +273,12 @@ static int add_transaction_credits(journal_t *journal, int blocks,
...
@@ -266,10 +273,12 @@ static int add_transaction_credits(journal_t *journal, int blocks,
wait_event
(
journal
->
j_wait_reserved
,
wait_event
(
journal
->
j_wait_reserved
,
atomic_read
(
&
journal
->
j_reserved_credits
)
+
total
<=
atomic_read
(
&
journal
->
j_reserved_credits
)
+
total
<=
journal
->
j_max_transaction_buffers
);
journal
->
j_max_transaction_buffers
);
__acquire
(
&
journal
->
j_state_lock
);
/* fake out sparse */
return
1
;
return
1
;
}
}
wait_transaction_locked
(
journal
);
wait_transaction_locked
(
journal
);
__acquire
(
&
journal
->
j_state_lock
);
/* fake out sparse */
return
1
;
return
1
;
}
}
...
@@ -293,6 +302,7 @@ static int add_transaction_credits(journal_t *journal, int blocks,
...
@@ -293,6 +302,7 @@ static int add_transaction_credits(journal_t *journal, int blocks,
journal
->
j_max_transaction_buffers
)
journal
->
j_max_transaction_buffers
)
__jbd2_log_wait_for_space
(
journal
);
__jbd2_log_wait_for_space
(
journal
);
write_unlock
(
&
journal
->
j_state_lock
);
write_unlock
(
&
journal
->
j_state_lock
);
__acquire
(
&
journal
->
j_state_lock
);
/* fake out sparse */
return
1
;
return
1
;
}
}
...
@@ -310,6 +320,7 @@ static int add_transaction_credits(journal_t *journal, int blocks,
...
@@ -310,6 +320,7 @@ static int add_transaction_credits(journal_t *journal, int blocks,
wait_event
(
journal
->
j_wait_reserved
,
wait_event
(
journal
->
j_wait_reserved
,
atomic_read
(
&
journal
->
j_reserved_credits
)
+
rsv_blocks
atomic_read
(
&
journal
->
j_reserved_credits
)
+
rsv_blocks
<=
journal
->
j_max_transaction_buffers
/
2
);
<=
journal
->
j_max_transaction_buffers
/
2
);
__acquire
(
&
journal
->
j_state_lock
);
/* fake out sparse */
return
1
;
return
1
;
}
}
return
0
;
return
0
;
...
@@ -413,8 +424,14 @@ static int start_this_handle(journal_t *journal, handle_t *handle,
...
@@ -413,8 +424,14 @@ static int start_this_handle(journal_t *journal, handle_t *handle,
if
(
!
handle
->
h_reserved
)
{
if
(
!
handle
->
h_reserved
)
{
/* We may have dropped j_state_lock - restart in that case */
/* We may have dropped j_state_lock - restart in that case */
if
(
add_transaction_credits
(
journal
,
blocks
,
rsv_blocks
))
if
(
add_transaction_credits
(
journal
,
blocks
,
rsv_blocks
))
{
/*
* add_transaction_credits releases
* j_state_lock on a non-zero return
*/
__release
(
&
journal
->
j_state_lock
);
goto
repeat
;
goto
repeat
;
}
}
else
{
}
else
{
/*
/*
* We have handle reserved so we are allowed to join T_LOCKED
* We have handle reserved so we are allowed to join T_LOCKED
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录