Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
be628be0
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看板
提交
be628be0
编写于
10月 26, 2016
作者:
K
Kent Overstreet
提交者:
Jens Axboe
12月 17, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bcache: Make gc wakeup sane, remove set_task_state()
Signed-off-by:
N
Kent Overstreet
<
kent.overstreet@gmail.com
>
上级
59331c21
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
26 addition
and
26 deletion
+26
-26
drivers/md/bcache/bcache.h
drivers/md/bcache/bcache.h
+2
-2
drivers/md/bcache/btree.c
drivers/md/bcache/btree.c
+20
-19
drivers/md/bcache/btree.h
drivers/md/bcache/btree.h
+1
-2
drivers/md/bcache/request.c
drivers/md/bcache/request.c
+1
-3
drivers/md/bcache/super.c
drivers/md/bcache/super.c
+2
-0
未找到文件。
drivers/md/bcache/bcache.h
浏览文件 @
be628be0
...
...
@@ -425,7 +425,7 @@ struct cache {
* until a gc finishes - otherwise we could pointlessly burn a ton of
* cpu
*/
unsigned
invalidate_needs_gc
:
1
;
unsigned
invalidate_needs_gc
;
bool
discard
;
/* Get rid of? */
...
...
@@ -593,8 +593,8 @@ struct cache_set {
/* Counts how many sectors bio_insert has added to the cache */
atomic_t
sectors_to_gc
;
wait_queue_head_t
gc_wait
;
wait_queue_head_t
moving_gc_wait
;
struct
keybuf
moving_gc_keys
;
/* Number of moving GC bios in flight */
struct
semaphore
moving_in_flight
;
...
...
drivers/md/bcache/btree.c
浏览文件 @
be628be0
...
...
@@ -1757,32 +1757,34 @@ static void bch_btree_gc(struct cache_set *c)
bch_moving_gc
(
c
);
}
static
int
bch_gc_thread
(
void
*
arg
)
static
bool
gc_should_run
(
struct
cache_set
*
c
)
{
struct
cache_set
*
c
=
arg
;
struct
cache
*
ca
;
unsigned
i
;
while
(
1
)
{
again:
bch_btree_gc
(
c
)
;
for_each_cache
(
ca
,
c
,
i
)
if
(
ca
->
invalidate_needs_gc
)
return
true
;
set_current_state
(
TASK_INTERRUPTIBLE
);
if
(
kthread_should_stop
())
break
;
if
(
atomic_read
(
&
c
->
sectors_to_gc
)
<
0
)
return
true
;
mutex_lock
(
&
c
->
bucket_lock
);
return
false
;
}
for_each_cache
(
ca
,
c
,
i
)
if
(
ca
->
invalidate_needs_gc
)
{
mutex_unlock
(
&
c
->
bucket_lock
);
set_current_state
(
TASK_RUNNING
);
goto
again
;
}
static
int
bch_gc_thread
(
void
*
arg
)
{
struct
cache_set
*
c
=
arg
;
mutex_unlock
(
&
c
->
bucket_lock
);
while
(
1
)
{
wait_event_interruptible
(
c
->
gc_wait
,
kthread_should_stop
()
||
gc_should_run
(
c
));
schedule
();
if
(
kthread_should_stop
())
break
;
set_gc_sectors
(
c
);
bch_btree_gc
(
c
);
}
return
0
;
...
...
@@ -1790,11 +1792,10 @@ static int bch_gc_thread(void *arg)
int
bch_gc_thread_start
(
struct
cache_set
*
c
)
{
c
->
gc_thread
=
kthread_
create
(
bch_gc_thread
,
c
,
"bcache_gc"
);
c
->
gc_thread
=
kthread_
run
(
bch_gc_thread
,
c
,
"bcache_gc"
);
if
(
IS_ERR
(
c
->
gc_thread
))
return
PTR_ERR
(
c
->
gc_thread
);
set_task_state
(
c
->
gc_thread
,
TASK_INTERRUPTIBLE
);
return
0
;
}
...
...
drivers/md/bcache/btree.h
浏览文件 @
be628be0
...
...
@@ -260,8 +260,7 @@ void bch_initial_mark_key(struct cache_set *, int, struct bkey *);
static
inline
void
wake_up_gc
(
struct
cache_set
*
c
)
{
if
(
c
->
gc_thread
)
wake_up_process
(
c
->
gc_thread
);
wake_up
(
&
c
->
gc_wait
);
}
#define MAP_DONE 0
...
...
drivers/md/bcache/request.c
浏览文件 @
be628be0
...
...
@@ -196,10 +196,8 @@ static void bch_data_insert_start(struct closure *cl)
struct
data_insert_op
*
op
=
container_of
(
cl
,
struct
data_insert_op
,
cl
);
struct
bio
*
bio
=
op
->
bio
,
*
n
;
if
(
atomic_sub_return
(
bio_sectors
(
bio
),
&
op
->
c
->
sectors_to_gc
)
<
0
)
{
set_gc_sectors
(
op
->
c
);
if
(
atomic_sub_return
(
bio_sectors
(
bio
),
&
op
->
c
->
sectors_to_gc
)
<
0
)
wake_up_gc
(
op
->
c
);
}
if
(
op
->
bypass
)
return
bch_data_invalidate
(
cl
);
...
...
drivers/md/bcache/super.c
浏览文件 @
be628be0
...
...
@@ -1489,6 +1489,7 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb)
mutex_init
(
&
c
->
bucket_lock
);
init_waitqueue_head
(
&
c
->
btree_cache_wait
);
init_waitqueue_head
(
&
c
->
bucket_wait
);
init_waitqueue_head
(
&
c
->
gc_wait
);
sema_init
(
&
c
->
uuid_write_mutex
,
1
);
spin_lock_init
(
&
c
->
btree_gc_time
.
lock
);
...
...
@@ -1548,6 +1549,7 @@ static void run_cache_set(struct cache_set *c)
for_each_cache
(
ca
,
c
,
i
)
c
->
nbuckets
+=
ca
->
sb
.
nbuckets
;
set_gc_sectors
(
c
);
if
(
CACHE_SYNC
(
&
c
->
sb
))
{
LIST_HEAD
(
journal
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录