Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
c4d951dd
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c4d951dd
编写于
8月 21, 2013
作者:
K
Kent Overstreet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bcache: Fix sysfs splat on shutdown with flash only devs
Whoops. Signed-off-by:
N
Kent Overstreet
<
kmo@daterainc.com
>
上级
48a915a8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
33 deletion
+30
-33
drivers/md/bcache/bcache.h
drivers/md/bcache/bcache.h
+4
-6
drivers/md/bcache/request.c
drivers/md/bcache/request.c
+1
-1
drivers/md/bcache/super.c
drivers/md/bcache/super.c
+20
-21
drivers/md/bcache/sysfs.c
drivers/md/bcache/sysfs.c
+1
-1
drivers/md/bcache/writeback.c
drivers/md/bcache/writeback.c
+3
-3
drivers/md/bcache/writeback.h
drivers/md/bcache/writeback.h
+1
-1
未找到文件。
drivers/md/bcache/bcache.h
浏览文件 @
c4d951dd
...
...
@@ -266,12 +266,10 @@ struct bcache_device {
struct
gendisk
*
disk
;
/* If nonzero, we're closing */
atomic_t
closing
;
/* If nonzero, we're detaching/unregistering from cache set */
atomic_t
detaching
;
int
flush_done
;
unsigned
long
flags
;
#define BCACHE_DEV_CLOSING 0
#define BCACHE_DEV_DETACHING 1
#define BCACHE_DEV_UNLINK_DONE 2
unsigned
nr_stripes
;
unsigned
stripe_size
;
...
...
drivers/md/bcache/request.c
浏览文件 @
c4d951dd
...
...
@@ -512,7 +512,7 @@ static bool check_should_bypass(struct cached_dev *dc, struct bio *bio)
struct
task_struct
*
task
=
current
;
struct
io
*
i
;
if
(
atomic_read
(
&
dc
->
disk
.
detaching
)
||
if
(
test_bit
(
BCACHE_DEV_DETACHING
,
&
dc
->
disk
.
flags
)
||
c
->
gc_stats
.
in_use
>
CUTOFF_CACHE_ADD
||
(
bio
->
bi_rw
&
REQ_DISCARD
))
goto
skip
;
...
...
drivers/md/bcache/super.c
浏览文件 @
c4d951dd
...
...
@@ -621,7 +621,7 @@ static void prio_read(struct cache *ca, uint64_t bucket)
static
int
open_dev
(
struct
block_device
*
b
,
fmode_t
mode
)
{
struct
bcache_device
*
d
=
b
->
bd_disk
->
private_data
;
if
(
atomic_read
(
&
d
->
closing
))
if
(
test_bit
(
BCACHE_DEV_CLOSING
,
&
d
->
flags
))
return
-
ENXIO
;
closure_get
(
&
d
->
cl
);
...
...
@@ -650,20 +650,24 @@ static const struct block_device_operations bcache_ops = {
void
bcache_device_stop
(
struct
bcache_device
*
d
)
{
if
(
!
atomic_xchg
(
&
d
->
closing
,
1
))
if
(
!
test_and_set_bit
(
BCACHE_DEV_CLOSING
,
&
d
->
flags
))
closure_queue
(
&
d
->
cl
);
}
static
void
bcache_device_unlink
(
struct
bcache_device
*
d
)
{
unsigned
i
;
struct
cache
*
ca
;
lockdep_assert_held
(
&
bch_register_lock
);
sysfs_remove_link
(
&
d
->
c
->
kobj
,
d
->
name
);
sysfs_remove_link
(
&
d
->
kobj
,
"cache"
);
if
(
d
->
c
&&
!
test_and_set_bit
(
BCACHE_DEV_UNLINK_DONE
,
&
d
->
flags
))
{
unsigned
i
;
struct
cache
*
ca
;
for_each_cache
(
ca
,
d
->
c
,
i
)
bd_unlink_disk_holder
(
ca
->
bdev
,
d
->
disk
);
sysfs_remove_link
(
&
d
->
c
->
kobj
,
d
->
name
);
sysfs_remove_link
(
&
d
->
kobj
,
"cache"
);
for_each_cache
(
ca
,
d
->
c
,
i
)
bd_unlink_disk_holder
(
ca
->
bdev
,
d
->
disk
);
}
}
static
void
bcache_device_link
(
struct
bcache_device
*
d
,
struct
cache_set
*
c
,
...
...
@@ -687,19 +691,16 @@ static void bcache_device_detach(struct bcache_device *d)
{
lockdep_assert_held
(
&
bch_register_lock
);
if
(
atomic_read
(
&
d
->
detaching
))
{
if
(
test_bit
(
BCACHE_DEV_DETACHING
,
&
d
->
flags
))
{
struct
uuid_entry
*
u
=
d
->
c
->
uuids
+
d
->
id
;
SET_UUID_FLASH_ONLY
(
u
,
0
);
memcpy
(
u
->
uuid
,
invalid_uuid
,
16
);
u
->
invalidated
=
cpu_to_le32
(
get_seconds
());
bch_uuid_write
(
d
->
c
);
atomic_set
(
&
d
->
detaching
,
0
);
}
if
(
!
d
->
flush_done
)
bcache_device_unlink
(
d
);
bcache_device_unlink
(
d
);
d
->
c
->
devices
[
d
->
id
]
=
NULL
;
closure_put
(
&
d
->
c
->
caching
);
...
...
@@ -879,7 +880,7 @@ static void cached_dev_detach_finish(struct work_struct *w)
struct
closure
cl
;
closure_init_stack
(
&
cl
);
BUG_ON
(
!
atomic_read
(
&
dc
->
disk
.
detaching
));
BUG_ON
(
!
test_bit
(
BCACHE_DEV_DETACHING
,
&
dc
->
disk
.
flags
));
BUG_ON
(
atomic_read
(
&
dc
->
count
));
mutex_lock
(
&
bch_register_lock
);
...
...
@@ -893,6 +894,8 @@ static void cached_dev_detach_finish(struct work_struct *w)
bcache_device_detach
(
&
dc
->
disk
);
list_move
(
&
dc
->
list
,
&
uncached_devices
);
clear_bit
(
BCACHE_DEV_DETACHING
,
&
dc
->
disk
.
flags
);
mutex_unlock
(
&
bch_register_lock
);
pr_info
(
"Caching disabled for %s"
,
bdevname
(
dc
->
bdev
,
buf
));
...
...
@@ -905,10 +908,10 @@ void bch_cached_dev_detach(struct cached_dev *dc)
{
lockdep_assert_held
(
&
bch_register_lock
);
if
(
atomic_read
(
&
dc
->
disk
.
closing
))
if
(
test_bit
(
BCACHE_DEV_CLOSING
,
&
dc
->
disk
.
flags
))
return
;
if
(
atomic_xchg
(
&
dc
->
disk
.
detaching
,
1
))
if
(
test_and_set_bit
(
BCACHE_DEV_DETACHING
,
&
dc
->
disk
.
flags
))
return
;
/*
...
...
@@ -1064,11 +1067,7 @@ static void cached_dev_flush(struct closure *cl)
struct
bcache_device
*
d
=
&
dc
->
disk
;
mutex_lock
(
&
bch_register_lock
);
d
->
flush_done
=
1
;
if
(
d
->
c
)
bcache_device_unlink
(
d
);
bcache_device_unlink
(
d
);
mutex_unlock
(
&
bch_register_lock
);
bch_cache_accounting_destroy
(
&
dc
->
accounting
);
...
...
drivers/md/bcache/sysfs.c
浏览文件 @
c4d951dd
...
...
@@ -370,7 +370,7 @@ STORE(__bch_flash_dev)
}
if
(
attr
==
&
sysfs_unregister
)
{
atomic_set
(
&
d
->
detaching
,
1
);
set_bit
(
BCACHE_DEV_DETACHING
,
&
d
->
flags
);
bcache_device_stop
(
d
);
}
...
...
drivers/md/bcache/writeback.c
浏览文件 @
c4d951dd
...
...
@@ -89,7 +89,7 @@ static unsigned writeback_delay(struct cached_dev *dc, unsigned sectors)
{
uint64_t
ret
;
if
(
atomic_read
(
&
dc
->
disk
.
detaching
)
||
if
(
test_bit
(
BCACHE_DEV_DETACHING
,
&
dc
->
disk
.
flags
)
||
!
dc
->
writeback_percent
)
return
0
;
...
...
@@ -404,7 +404,7 @@ static int bch_writeback_thread(void *arg)
while
(
!
kthread_should_stop
())
{
down_write
(
&
dc
->
writeback_lock
);
if
(
!
atomic_read
(
&
dc
->
has_dirty
)
||
(
!
atomic_read
(
&
dc
->
disk
.
detaching
)
&&
(
!
test_bit
(
BCACHE_DEV_DETACHING
,
&
dc
->
disk
.
flags
)
&&
!
dc
->
writeback_running
))
{
up_write
(
&
dc
->
writeback_lock
);
set_current_state
(
TASK_INTERRUPTIBLE
);
...
...
@@ -437,7 +437,7 @@ static int bch_writeback_thread(void *arg)
while
(
delay
&&
!
kthread_should_stop
()
&&
!
atomic_read
(
&
dc
->
disk
.
detaching
))
!
test_bit
(
BCACHE_DEV_DETACHING
,
&
dc
->
disk
.
flags
))
delay
=
schedule_timeout_interruptible
(
delay
);
}
}
...
...
drivers/md/bcache/writeback.h
浏览文件 @
c4d951dd
...
...
@@ -45,7 +45,7 @@ static inline bool should_writeback(struct cached_dev *dc, struct bio *bio,
unsigned
in_use
=
dc
->
disk
.
c
->
gc_stats
.
in_use
;
if
(
cache_mode
!=
CACHE_MODE_WRITEBACK
||
atomic_read
(
&
dc
->
disk
.
detaching
)
||
test_bit
(
BCACHE_DEV_DETACHING
,
&
dc
->
disk
.
flags
)
||
in_use
>
CUTOFF_WRITEBACK_SYNC
)
return
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录