Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
08464e09
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
08464e09
编写于
11月 02, 2016
作者:
N
NeilBrown
提交者:
Shaohua Li
11月 07, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
md/raid10: change printk() to pr_*()
Signed-off-by:
N
NeilBrown
<
neilb@suse.com
>
Signed-off-by:
N
Shaohua Li
<
shli@fb.com
>
上级
1d41c216
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
56 addition
and
85 deletion
+56
-85
drivers/md/raid10.c
drivers/md/raid10.c
+56
-85
未找到文件。
drivers/md/raid10.c
浏览文件 @
08464e09
...
@@ -404,8 +404,7 @@ static void raid10_end_read_request(struct bio *bio)
...
@@ -404,8 +404,7 @@ static void raid10_end_read_request(struct bio *bio)
* oops, read error - keep the refcount on the rdev
* oops, read error - keep the refcount on the rdev
*/
*/
char
b
[
BDEVNAME_SIZE
];
char
b
[
BDEVNAME_SIZE
];
printk_ratelimited
(
KERN_ERR
pr_err_ratelimited
(
"md/raid10:%s: %s: rescheduling sector %llu
\n
"
,
"md/raid10:%s: %s: rescheduling sector %llu
\n
"
,
mdname
(
conf
->
mddev
),
mdname
(
conf
->
mddev
),
bdevname
(
rdev
->
bdev
,
b
),
bdevname
(
rdev
->
bdev
,
b
),
(
unsigned
long
long
)
r10_bio
->
sector
);
(
unsigned
long
long
)
r10_bio
->
sector
);
...
@@ -1589,11 +1588,10 @@ static void raid10_error(struct mddev *mddev, struct md_rdev *rdev)
...
@@ -1589,11 +1588,10 @@ static void raid10_error(struct mddev *mddev, struct md_rdev *rdev)
set_mask_bits
(
&
mddev
->
flags
,
0
,
set_mask_bits
(
&
mddev
->
flags
,
0
,
BIT
(
MD_CHANGE_DEVS
)
|
BIT
(
MD_CHANGE_PENDING
));
BIT
(
MD_CHANGE_DEVS
)
|
BIT
(
MD_CHANGE_PENDING
));
spin_unlock_irqrestore
(
&
conf
->
device_lock
,
flags
);
spin_unlock_irqrestore
(
&
conf
->
device_lock
,
flags
);
printk
(
KERN_ALERT
pr_crit
(
"md/raid10:%s: Disk failure on %s, disabling device.
\n
"
"md/raid10:%s: Disk failure on %s, disabling device.
\n
"
"md/raid10:%s: Operation continuing on %d devices.
\n
"
,
"md/raid10:%s: Operation continuing on %d devices.
\n
"
,
mdname
(
mddev
),
bdevname
(
rdev
->
bdev
,
b
),
mdname
(
mddev
),
bdevname
(
rdev
->
bdev
,
b
),
mdname
(
mddev
),
conf
->
geo
.
raid_disks
-
mddev
->
degraded
);
mdname
(
mddev
),
conf
->
geo
.
raid_disks
-
mddev
->
degraded
);
}
}
static
void
print_conf
(
struct
r10conf
*
conf
)
static
void
print_conf
(
struct
r10conf
*
conf
)
...
@@ -1601,13 +1599,13 @@ static void print_conf(struct r10conf *conf)
...
@@ -1601,13 +1599,13 @@ static void print_conf(struct r10conf *conf)
int
i
;
int
i
;
struct
md_rdev
*
rdev
;
struct
md_rdev
*
rdev
;
pr
intk
(
KERN_DEBUG
"RAID10 conf printout:
\n
"
);
pr
_debug
(
"RAID10 conf printout:
\n
"
);
if
(
!
conf
)
{
if
(
!
conf
)
{
pr
intk
(
KERN_DEBUG
"(!conf)
\n
"
);
pr
_debug
(
"(!conf)
\n
"
);
return
;
return
;
}
}
pr
intk
(
KERN_DEBUG
" --- wd:%d rd:%d
\n
"
,
conf
->
geo
.
raid_disks
-
conf
->
mddev
->
degraded
,
pr
_debug
(
" --- wd:%d rd:%d
\n
"
,
conf
->
geo
.
raid_disks
-
conf
->
mddev
->
degraded
,
conf
->
geo
.
raid_disks
);
conf
->
geo
.
raid_disks
);
/* This is only called with ->reconfix_mutex held, so
/* This is only called with ->reconfix_mutex held, so
* rcu protection of rdev is not needed */
* rcu protection of rdev is not needed */
...
@@ -1615,10 +1613,10 @@ static void print_conf(struct r10conf *conf)
...
@@ -1615,10 +1613,10 @@ static void print_conf(struct r10conf *conf)
char
b
[
BDEVNAME_SIZE
];
char
b
[
BDEVNAME_SIZE
];
rdev
=
conf
->
mirrors
[
i
].
rdev
;
rdev
=
conf
->
mirrors
[
i
].
rdev
;
if
(
rdev
)
if
(
rdev
)
pr
intk
(
KERN_DEBUG
" disk %d, wo:%d, o:%d, dev:%s
\n
"
,
pr
_debug
(
" disk %d, wo:%d, o:%d, dev:%s
\n
"
,
i
,
!
test_bit
(
In_sync
,
&
rdev
->
flags
),
i
,
!
test_bit
(
In_sync
,
&
rdev
->
flags
),
!
test_bit
(
Faulty
,
&
rdev
->
flags
),
!
test_bit
(
Faulty
,
&
rdev
->
flags
),
bdevname
(
rdev
->
bdev
,
b
));
bdevname
(
rdev
->
bdev
,
b
));
}
}
}
}
...
@@ -2109,10 +2107,8 @@ static void fix_recovery_read_error(struct r10bio *r10_bio)
...
@@ -2109,10 +2107,8 @@ static void fix_recovery_read_error(struct r10bio *r10_bio)
ok
=
rdev_set_badblocks
(
rdev2
,
addr
,
s
,
0
);
ok
=
rdev_set_badblocks
(
rdev2
,
addr
,
s
,
0
);
if
(
!
ok
)
{
if
(
!
ok
)
{
/* just abort the recovery */
/* just abort the recovery */
printk
(
KERN_NOTICE
pr_notice
(
"md/raid10:%s: recovery aborted due to read error
\n
"
,
"md/raid10:%s: recovery aborted"
mdname
(
mddev
));
" due to read error
\n
"
,
mdname
(
mddev
));
conf
->
mirrors
[
dw
].
recovery_disabled
conf
->
mirrors
[
dw
].
recovery_disabled
=
mddev
->
recovery_disabled
;
=
mddev
->
recovery_disabled
;
...
@@ -2259,14 +2255,11 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
...
@@ -2259,14 +2255,11 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
char
b
[
BDEVNAME_SIZE
];
char
b
[
BDEVNAME_SIZE
];
bdevname
(
rdev
->
bdev
,
b
);
bdevname
(
rdev
->
bdev
,
b
);
printk
(
KERN_NOTICE
pr_notice
(
"md/raid10:%s: %s: Raid device exceeded read_error threshold [cur %d:max %d]
\n
"
,
"md/raid10:%s: %s: Raid device exceeded "
mdname
(
mddev
),
b
,
"read_error threshold [cur %d:max %d]
\n
"
,
atomic_read
(
&
rdev
->
read_errors
),
max_read_errors
);
mdname
(
mddev
),
b
,
pr_notice
(
"md/raid10:%s: %s: Failing raid device
\n
"
,
atomic_read
(
&
rdev
->
read_errors
),
max_read_errors
);
mdname
(
mddev
),
b
);
printk
(
KERN_NOTICE
"md/raid10:%s: %s: Failing raid device
\n
"
,
mdname
(
mddev
),
b
);
md_error
(
mddev
,
rdev
);
md_error
(
mddev
,
rdev
);
r10_bio
->
devs
[
r10_bio
->
read_slot
].
bio
=
IO_BLOCKED
;
r10_bio
->
devs
[
r10_bio
->
read_slot
].
bio
=
IO_BLOCKED
;
return
;
return
;
...
@@ -2356,20 +2349,16 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
...
@@ -2356,20 +2349,16 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
s
,
conf
->
tmppage
,
WRITE
)
s
,
conf
->
tmppage
,
WRITE
)
==
0
)
{
==
0
)
{
/* Well, this device is dead */
/* Well, this device is dead */
printk
(
KERN_NOTICE
pr_notice
(
"md/raid10:%s: read correction write failed (%d sectors at %llu on %s)
\n
"
,
"md/raid10:%s: read correction "
mdname
(
mddev
),
s
,
"write failed"
(
unsigned
long
long
)(
" (%d sectors at %llu on %s)
\n
"
,
sect
+
mdname
(
mddev
),
s
,
choose_data_offset
(
r10_bio
,
(
unsigned
long
long
)(
rdev
)),
sect
+
bdevname
(
rdev
->
bdev
,
b
));
choose_data_offset
(
r10_bio
,
pr_notice
(
"md/raid10:%s: %s: failing drive
\n
"
,
rdev
)),
mdname
(
mddev
),
bdevname
(
rdev
->
bdev
,
b
));
bdevname
(
rdev
->
bdev
,
b
));
printk
(
KERN_NOTICE
"md/raid10:%s: %s: failing "
"drive
\n
"
,
mdname
(
mddev
),
bdevname
(
rdev
->
bdev
,
b
));
}
}
rdev_dec_pending
(
rdev
,
mddev
);
rdev_dec_pending
(
rdev
,
mddev
);
rcu_read_lock
();
rcu_read_lock
();
...
@@ -2397,24 +2386,18 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
...
@@ -2397,24 +2386,18 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
READ
))
{
READ
))
{
case
0
:
case
0
:
/* Well, this device is dead */
/* Well, this device is dead */
printk
(
KERN_NOTICE
pr_notice
(
"md/raid10:%s: unable to read back corrected sectors (%d sectors at %llu on %s)
\n
"
,
"md/raid10:%s: unable to read back "
"corrected sectors"
" (%d sectors at %llu on %s)
\n
"
,
mdname
(
mddev
),
s
,
mdname
(
mddev
),
s
,
(
unsigned
long
long
)(
(
unsigned
long
long
)(
sect
+
sect
+
choose_data_offset
(
r10_bio
,
rdev
)),
choose_data_offset
(
r10_bio
,
rdev
)),
bdevname
(
rdev
->
bdev
,
b
));
bdevname
(
rdev
->
bdev
,
b
));
printk
(
KERN_NOTICE
"md/raid10:%s: %s: failing "
pr_notice
(
"md/raid10:%s: %s: failing drive
\n
"
,
"drive
\n
"
,
mdname
(
mddev
),
mdname
(
mddev
),
bdevname
(
rdev
->
bdev
,
b
));
bdevname
(
rdev
->
bdev
,
b
));
break
;
break
;
case
1
:
case
1
:
printk
(
KERN_INFO
pr_info
(
"md/raid10:%s: read error corrected (%d sectors at %llu on %s)
\n
"
,
"md/raid10:%s: read error corrected"
" (%d sectors at %llu on %s)
\n
"
,
mdname
(
mddev
),
s
,
mdname
(
mddev
),
s
,
(
unsigned
long
long
)(
(
unsigned
long
long
)(
sect
+
sect
+
...
@@ -2529,23 +2512,19 @@ static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio)
...
@@ -2529,23 +2512,19 @@ static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio)
read_more:
read_more:
rdev
=
read_balance
(
conf
,
r10_bio
,
&
max_sectors
);
rdev
=
read_balance
(
conf
,
r10_bio
,
&
max_sectors
);
if
(
rdev
==
NULL
)
{
if
(
rdev
==
NULL
)
{
printk
(
KERN_ALERT
"md/raid10:%s: %s: unrecoverable I/O"
pr_crit_ratelimited
(
"md/raid10:%s: %s: unrecoverable I/O read error for block %llu
\n
"
,
" read error for block %llu
\n
"
,
mdname
(
mddev
),
b
,
mdname
(
mddev
),
b
,
(
unsigned
long
long
)
r10_bio
->
sector
);
(
unsigned
long
long
)
r10_bio
->
sector
);
raid_end_bio_io
(
r10_bio
);
raid_end_bio_io
(
r10_bio
);
return
;
return
;
}
}
do_sync
=
(
r10_bio
->
master_bio
->
bi_opf
&
REQ_SYNC
);
do_sync
=
(
r10_bio
->
master_bio
->
bi_opf
&
REQ_SYNC
);
slot
=
r10_bio
->
read_slot
;
slot
=
r10_bio
->
read_slot
;
printk_ratelimited
(
pr_err_ratelimited
(
"md/raid10:%s: %s: redirecting sector %llu to another mirror
\n
"
,
KERN_ERR
mdname
(
mddev
),
"md/raid10:%s: %s: redirecting "
bdevname
(
rdev
->
bdev
,
b
),
"sector %llu to another mirror
\n
"
,
(
unsigned
long
long
)
r10_bio
->
sector
);
mdname
(
mddev
),
bdevname
(
rdev
->
bdev
,
b
),
(
unsigned
long
long
)
r10_bio
->
sector
);
bio
=
bio_clone_mddev
(
r10_bio
->
master_bio
,
bio
=
bio_clone_mddev
(
r10_bio
->
master_bio
,
GFP_NOIO
,
mddev
);
GFP_NOIO
,
mddev
);
bio_trim
(
bio
,
r10_bio
->
sector
-
bio
->
bi_iter
.
bi_sector
,
max_sectors
);
bio_trim
(
bio
,
r10_bio
->
sector
-
bio
->
bi_iter
.
bi_sector
,
max_sectors
);
...
@@ -3160,8 +3139,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
...
@@ -3160,8 +3139,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
if
(
!
any_working
)
{
if
(
!
any_working
)
{
if
(
!
test_and_set_bit
(
MD_RECOVERY_INTR
,
if
(
!
test_and_set_bit
(
MD_RECOVERY_INTR
,
&
mddev
->
recovery
))
&
mddev
->
recovery
))
printk
(
KERN_INFO
"md/raid10:%s: insufficient "
pr_warn
(
"md/raid10:%s: insufficient working devices for recovery.
\n
"
,
"working devices for recovery.
\n
"
,
mdname
(
mddev
));
mdname
(
mddev
));
mirror
->
recovery_disabled
mirror
->
recovery_disabled
=
mddev
->
recovery_disabled
;
=
mddev
->
recovery_disabled
;
...
@@ -3489,15 +3467,14 @@ static struct r10conf *setup_conf(struct mddev *mddev)
...
@@ -3489,15 +3467,14 @@ static struct r10conf *setup_conf(struct mddev *mddev)
copies
=
setup_geo
(
&
geo
,
mddev
,
geo_new
);
copies
=
setup_geo
(
&
geo
,
mddev
,
geo_new
);
if
(
copies
==
-
2
)
{
if
(
copies
==
-
2
)
{
printk
(
KERN_ERR
"md/raid10:%s: chunk size must be "
pr_warn
(
"md/raid10:%s: chunk size must be at least PAGE_SIZE(%ld) and be a power of 2.
\n
"
,
"at least PAGE_SIZE(%ld) and be a power of 2.
\n
"
,
mdname
(
mddev
),
PAGE_SIZE
);
mdname
(
mddev
),
PAGE_SIZE
);
goto
out
;
goto
out
;
}
}
if
(
copies
<
2
||
copies
>
mddev
->
raid_disks
)
{
if
(
copies
<
2
||
copies
>
mddev
->
raid_disks
)
{
pr
intk
(
KERN_ERR
"md/raid10:%s: unsupported raid10 layout: 0x%8x
\n
"
,
pr
_warn
(
"md/raid10:%s: unsupported raid10 layout: 0x%8x
\n
"
,
mdname
(
mddev
),
mddev
->
new_layout
);
mdname
(
mddev
),
mddev
->
new_layout
);
goto
out
;
goto
out
;
}
}
...
@@ -3557,9 +3534,6 @@ static struct r10conf *setup_conf(struct mddev *mddev)
...
@@ -3557,9 +3534,6 @@ static struct r10conf *setup_conf(struct mddev *mddev)
return
conf
;
return
conf
;
out:
out:
if
(
err
==
-
ENOMEM
)
printk
(
KERN_ERR
"md/raid10:%s: couldn't allocate memory.
\n
"
,
mdname
(
mddev
));
if
(
conf
)
{
if
(
conf
)
{
mempool_destroy
(
conf
->
r10bio_pool
);
mempool_destroy
(
conf
->
r10bio_pool
);
kfree
(
conf
->
mirrors
);
kfree
(
conf
->
mirrors
);
...
@@ -3656,7 +3630,7 @@ static int raid10_run(struct mddev *mddev)
...
@@ -3656,7 +3630,7 @@ static int raid10_run(struct mddev *mddev)
}
}
/* need to check that every block has at least one working mirror */
/* need to check that every block has at least one working mirror */
if
(
!
enough
(
conf
,
-
1
))
{
if
(
!
enough
(
conf
,
-
1
))
{
pr
intk
(
KERN_ERR
"md/raid10:%s: not enough operational mirrors.
\n
"
,
pr
_err
(
"md/raid10:%s: not enough operational mirrors.
\n
"
,
mdname
(
mddev
));
mdname
(
mddev
));
goto
out_free_conf
;
goto
out_free_conf
;
}
}
...
@@ -3698,11 +3672,9 @@ static int raid10_run(struct mddev *mddev)
...
@@ -3698,11 +3672,9 @@ static int raid10_run(struct mddev *mddev)
}
}
if
(
mddev
->
recovery_cp
!=
MaxSector
)
if
(
mddev
->
recovery_cp
!=
MaxSector
)
printk
(
KERN_NOTICE
"md/raid10:%s: not clean"
pr_notice
(
"md/raid10:%s: not clean -- starting background reconstruction
\n
"
,
" -- starting background reconstruction
\n
"
,
mdname
(
mddev
));
mdname
(
mddev
));
pr_info
(
"md/raid10:%s: active with %d out of %d devices
\n
"
,
printk
(
KERN_INFO
"md/raid10:%s: active with %d out of %d devices
\n
"
,
mdname
(
mddev
),
conf
->
geo
.
raid_disks
-
mddev
->
degraded
,
mdname
(
mddev
),
conf
->
geo
.
raid_disks
-
mddev
->
degraded
,
conf
->
geo
.
raid_disks
);
conf
->
geo
.
raid_disks
);
/*
/*
...
@@ -3739,7 +3711,7 @@ static int raid10_run(struct mddev *mddev)
...
@@ -3739,7 +3711,7 @@ static int raid10_run(struct mddev *mddev)
if
(
max
(
before_length
,
after_length
)
>
min_offset_diff
)
{
if
(
max
(
before_length
,
after_length
)
>
min_offset_diff
)
{
/* This cannot work */
/* This cannot work */
pr
intk
(
"md/raid10: offset difference not enough to continue reshape
\n
"
);
pr
_warn
(
"md/raid10: offset difference not enough to continue reshape
\n
"
);
goto
out_free_conf
;
goto
out_free_conf
;
}
}
conf
->
offset_diff
=
min_offset_diff
;
conf
->
offset_diff
=
min_offset_diff
;
...
@@ -3846,8 +3818,8 @@ static void *raid10_takeover_raid0(struct mddev *mddev, sector_t size, int devs)
...
@@ -3846,8 +3818,8 @@ static void *raid10_takeover_raid0(struct mddev *mddev, sector_t size, int devs)
struct
r10conf
*
conf
;
struct
r10conf
*
conf
;
if
(
mddev
->
degraded
>
0
)
{
if
(
mddev
->
degraded
>
0
)
{
pr
intk
(
KERN_ERR
"md/raid10:%s: Error: degraded raid0!
\n
"
,
pr
_warn
(
"md/raid10:%s: Error: degraded raid0!
\n
"
,
mdname
(
mddev
));
mdname
(
mddev
));
return
ERR_PTR
(
-
EINVAL
);
return
ERR_PTR
(
-
EINVAL
);
}
}
sector_div
(
size
,
devs
);
sector_div
(
size
,
devs
);
...
@@ -3887,9 +3859,8 @@ static void *raid10_takeover(struct mddev *mddev)
...
@@ -3887,9 +3859,8 @@ static void *raid10_takeover(struct mddev *mddev)
/* for raid0 takeover only one zone is supported */
/* for raid0 takeover only one zone is supported */
raid0_conf
=
mddev
->
private
;
raid0_conf
=
mddev
->
private
;
if
(
raid0_conf
->
nr_strip_zones
>
1
)
{
if
(
raid0_conf
->
nr_strip_zones
>
1
)
{
printk
(
KERN_ERR
"md/raid10:%s: cannot takeover raid 0"
pr_warn
(
"md/raid10:%s: cannot takeover raid 0 with more than one zone.
\n
"
,
" with more than one zone.
\n
"
,
mdname
(
mddev
));
mdname
(
mddev
));
return
ERR_PTR
(
-
EINVAL
);
return
ERR_PTR
(
-
EINVAL
);
}
}
return
raid10_takeover_raid0
(
mddev
,
return
raid10_takeover_raid0
(
mddev
,
...
@@ -4078,8 +4049,8 @@ static int raid10_start_reshape(struct mddev *mddev)
...
@@ -4078,8 +4049,8 @@ static int raid10_start_reshape(struct mddev *mddev)
sector_t
size
=
raid10_size
(
mddev
,
0
,
0
);
sector_t
size
=
raid10_size
(
mddev
,
0
,
0
);
if
(
size
<
mddev
->
array_sectors
)
{
if
(
size
<
mddev
->
array_sectors
)
{
spin_unlock_irq
(
&
conf
->
device_lock
);
spin_unlock_irq
(
&
conf
->
device_lock
);
pr
intk
(
KERN_ERR
"md/raid10:%s: array size must be reduce before number of disks
\n
"
,
pr
_warn
(
"md/raid10:%s: array size must be reduce before number of disks
\n
"
,
mdname
(
mddev
));
mdname
(
mddev
));
return
-
EINVAL
;
return
-
EINVAL
;
}
}
mddev
->
resync_max_sectors
=
size
;
mddev
->
resync_max_sectors
=
size
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录