Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
45b3e77f
Commit
45b3e77f
authored
May 26, 2003
by
Neil Brown
Committed by
Linus Torvalds
May 26, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] md: Replace bdev_partition_name with calls to bdevname
parent
89670a77
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
98 additions
and
82 deletions
+98
-82
drivers/md/linear.c
drivers/md/linear.c
+3
-2
drivers/md/md.c
drivers/md/md.c
+56
-42
drivers/md/multipath.c
drivers/md/multipath.c
+9
-5
drivers/md/raid0.c
drivers/md/raid0.c
+13
-9
drivers/md/raid1.c
drivers/md/raid1.c
+11
-6
drivers/md/raid5.c
drivers/md/raid5.c
+6
-3
include/linux/raid/md.h
include/linux/raid/md.h
+0
-15
No files found.
drivers/md/linear.c
View file @
45b3e77f
...
@@ -254,12 +254,13 @@ static void linear_status (struct seq_file *seq, mddev_t *mddev)
...
@@ -254,12 +254,13 @@ static void linear_status (struct seq_file *seq, mddev_t *mddev)
seq_printf
(
seq
,
" "
);
seq_printf
(
seq
,
" "
);
for
(
j
=
0
;
j
<
conf
->
nr_zones
;
j
++
)
for
(
j
=
0
;
j
<
conf
->
nr_zones
;
j
++
)
{
{
char
b
[
BDEVNAME_SIZE
];
seq_printf
(
seq
,
"[%s"
,
seq_printf
(
seq
,
"[%s"
,
bdev_partition_name
(
conf
->
hash_table
[
j
].
dev0
->
rdev
->
bdev
));
bdevname
(
conf
->
hash_table
[
j
].
dev0
->
rdev
->
bdev
,
b
));
if
(
conf
->
hash_table
[
j
].
dev1
)
if
(
conf
->
hash_table
[
j
].
dev1
)
seq_printf
(
seq
,
"/%s] "
,
seq_printf
(
seq
,
"/%s] "
,
bdev_partition_name
(
conf
->
hash_table
[
j
].
dev1
->
rdev
->
bdev
));
bdevname
(
conf
->
hash_table
[
j
].
dev1
->
rdev
->
bdev
,
b
));
else
else
seq_printf
(
seq
,
"] "
);
seq_printf
(
seq
,
"] "
);
}
}
...
...
drivers/md/md.c
View file @
45b3e77f
...
@@ -349,7 +349,7 @@ static int sync_page_io(struct block_device *bdev, sector_t sector, int size,
...
@@ -349,7 +349,7 @@ static int sync_page_io(struct block_device *bdev, sector_t sector, int size,
static
int
read_disk_sb
(
mdk_rdev_t
*
rdev
)
static
int
read_disk_sb
(
mdk_rdev_t
*
rdev
)
{
{
char
b
[
BDEVNAME_SIZE
];
if
(
!
rdev
->
sb_page
)
{
if
(
!
rdev
->
sb_page
)
{
MD_BUG
();
MD_BUG
();
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -365,7 +365,7 @@ static int read_disk_sb(mdk_rdev_t * rdev)
...
@@ -365,7 +365,7 @@ static int read_disk_sb(mdk_rdev_t * rdev)
fail:
fail:
printk
(
KERN_ERR
"md: disabled device %s, could not read superblock.
\n
"
,
printk
(
KERN_ERR
"md: disabled device %s, could not read superblock.
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
));
bdev
name
(
rdev
->
bdev
,
b
));
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -473,6 +473,7 @@ struct super_type {
...
@@ -473,6 +473,7 @@ struct super_type {
*/
*/
static
int
super_90_load
(
mdk_rdev_t
*
rdev
,
mdk_rdev_t
*
refdev
,
int
minor_version
)
static
int
super_90_load
(
mdk_rdev_t
*
rdev
,
mdk_rdev_t
*
refdev
,
int
minor_version
)
{
{
char
b
[
BDEVNAME_SIZE
],
b2
[
BDEVNAME_SIZE
];
mdp_super_t
*
sb
;
mdp_super_t
*
sb
;
int
ret
;
int
ret
;
sector_t
sb_offset
;
sector_t
sb_offset
;
...
@@ -491,11 +492,12 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version
...
@@ -491,11 +492,12 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
bdevname
(
rdev
->
bdev
,
b
);
sb
=
(
mdp_super_t
*
)
page_address
(
rdev
->
sb_page
);
sb
=
(
mdp_super_t
*
)
page_address
(
rdev
->
sb_page
);
if
(
sb
->
md_magic
!=
MD_SB_MAGIC
)
{
if
(
sb
->
md_magic
!=
MD_SB_MAGIC
)
{
printk
(
KERN_ERR
"md: invalid raid superblock magic on %s
\n
"
,
printk
(
KERN_ERR
"md: invalid raid superblock magic on %s
\n
"
,
bdev_partition_name
(
rdev
->
bdev
)
);
b
);
goto
abort
;
goto
abort
;
}
}
...
@@ -503,13 +505,13 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version
...
@@ -503,13 +505,13 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version
sb
->
minor_version
!=
90
)
{
sb
->
minor_version
!=
90
)
{
printk
(
KERN_WARNING
"Bad version number %d.%d on %s
\n
"
,
printk
(
KERN_WARNING
"Bad version number %d.%d on %s
\n
"
,
sb
->
major_version
,
sb
->
minor_version
,
sb
->
major_version
,
sb
->
minor_version
,
b
dev_partition_name
(
rdev
->
bdev
)
);
b
);
goto
abort
;
goto
abort
;
}
}
if
(
sb
->
md_minor
>=
MAX_MD_DEVS
)
{
if
(
sb
->
md_minor
>=
MAX_MD_DEVS
)
{
printk
(
KERN_ERR
"md: %s: invalid raid minor (%x)
\n
"
,
printk
(
KERN_ERR
"md: %s: invalid raid minor (%x)
\n
"
,
b
dev_partition_name
(
rdev
->
bdev
)
,
sb
->
md_minor
);
b
,
sb
->
md_minor
);
goto
abort
;
goto
abort
;
}
}
if
(
sb
->
raid_disks
<=
0
)
if
(
sb
->
raid_disks
<=
0
)
...
@@ -517,7 +519,7 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version
...
@@ -517,7 +519,7 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version
if
(
calc_sb_csum
(
sb
)
!=
sb
->
sb_csum
)
{
if
(
calc_sb_csum
(
sb
)
!=
sb
->
sb_csum
)
{
printk
(
KERN_WARNING
"md: invalid superblock checksum on %s
\n
"
,
printk
(
KERN_WARNING
"md: invalid superblock checksum on %s
\n
"
,
b
dev_partition_name
(
rdev
->
bdev
)
);
b
);
goto
abort
;
goto
abort
;
}
}
...
@@ -536,15 +538,13 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version
...
@@ -536,15 +538,13 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version
mdp_super_t
*
refsb
=
(
mdp_super_t
*
)
page_address
(
refdev
->
sb_page
);
mdp_super_t
*
refsb
=
(
mdp_super_t
*
)
page_address
(
refdev
->
sb_page
);
if
(
!
uuid_equal
(
refsb
,
sb
))
{
if
(
!
uuid_equal
(
refsb
,
sb
))
{
printk
(
KERN_WARNING
"md: %s has different UUID to %s
\n
"
,
printk
(
KERN_WARNING
"md: %s has different UUID to %s
\n
"
,
bdev_partition_name
(
rdev
->
bdev
),
b
,
bdevname
(
refdev
->
bdev
,
b2
));
bdev_partition_name
(
refdev
->
bdev
));
goto
abort
;
goto
abort
;
}
}
if
(
!
sb_equal
(
refsb
,
sb
))
{
if
(
!
sb_equal
(
refsb
,
sb
))
{
printk
(
KERN_WARNING
"md: %s has same UUID"
printk
(
KERN_WARNING
"md: %s has same UUID"
" but different superblock to %s
\n
"
,
" but different superblock to %s
\n
"
,
bdev_partition_name
(
rdev
->
bdev
),
b
,
bdevname
(
refdev
->
bdev
,
b2
));
bdev_partition_name
(
refdev
->
bdev
));
goto
abort
;
goto
abort
;
}
}
ev1
=
md_event
(
sb
);
ev1
=
md_event
(
sb
);
...
@@ -756,6 +756,7 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version)
...
@@ -756,6 +756,7 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version)
struct
mdp_superblock_1
*
sb
;
struct
mdp_superblock_1
*
sb
;
int
ret
;
int
ret
;
sector_t
sb_offset
;
sector_t
sb_offset
;
char
b
[
BDEVNAME_SIZE
],
b2
[
BDEVNAME_SIZE
];
/*
/*
* Calculate the position of the superblock.
* Calculate the position of the superblock.
...
@@ -799,7 +800,7 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version)
...
@@ -799,7 +800,7 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version)
if
(
calc_sb_1_csum
(
sb
)
!=
sb
->
sb_csum
)
{
if
(
calc_sb_1_csum
(
sb
)
!=
sb
->
sb_csum
)
{
printk
(
"md: invalid superblock checksum on %s
\n
"
,
printk
(
"md: invalid superblock checksum on %s
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
));
bdev
name
(
rdev
->
bdev
,
b
));
return
-
EINVAL
;
return
-
EINVAL
;
}
}
rdev
->
preferred_minor
=
0xffff
;
rdev
->
preferred_minor
=
0xffff
;
...
@@ -818,8 +819,8 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version)
...
@@ -818,8 +819,8 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version)
sb
->
chunksize
!=
refsb
->
chunksize
)
{
sb
->
chunksize
!=
refsb
->
chunksize
)
{
printk
(
KERN_WARNING
"md: %s has strangely different"
printk
(
KERN_WARNING
"md: %s has strangely different"
" superblock to %s
\n
"
,
" superblock to %s
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
),
bdev
name
(
rdev
->
bdev
,
b
),
bdev
_partition_name
(
refdev
->
bdev
));
bdev
name
(
refdev
->
bdev
,
b2
));
return
-
EINVAL
;
return
-
EINVAL
;
}
}
ev1
=
le64_to_cpu
(
sb
->
events
);
ev1
=
le64_to_cpu
(
sb
->
events
);
...
@@ -987,6 +988,7 @@ static LIST_HEAD(pending_raid_disks);
...
@@ -987,6 +988,7 @@ static LIST_HEAD(pending_raid_disks);
static
int
bind_rdev_to_array
(
mdk_rdev_t
*
rdev
,
mddev_t
*
mddev
)
static
int
bind_rdev_to_array
(
mdk_rdev_t
*
rdev
,
mddev_t
*
mddev
)
{
{
mdk_rdev_t
*
same_pdev
;
mdk_rdev_t
*
same_pdev
;
char
b
[
BDEVNAME_SIZE
],
b2
[
BDEVNAME_SIZE
];
if
(
rdev
->
mddev
)
{
if
(
rdev
->
mddev
)
{
MD_BUG
();
MD_BUG
();
...
@@ -998,8 +1000,8 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
...
@@ -998,8 +1000,8 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
"md%d: WARNING: %s appears to be on the same physical"
"md%d: WARNING: %s appears to be on the same physical"
" disk as %s. True
\n
protection against single-disk"
" disk as %s. True
\n
protection against single-disk"
" failure might be compromised.
\n
"
,
" failure might be compromised.
\n
"
,
mdidx
(
mddev
),
bdev
_partition_name
(
rdev
->
bdev
),
mdidx
(
mddev
),
bdev
name
(
rdev
->
bdev
,
b
),
bdev
_partition_name
(
same_pdev
->
bdev
));
bdev
name
(
same_pdev
->
bdev
,
b2
));
/* Verify rdev->desc_nr is unique.
/* Verify rdev->desc_nr is unique.
* If it is -1, assign a free number, else
* If it is -1, assign a free number, else
...
@@ -1018,18 +1020,19 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
...
@@ -1018,18 +1020,19 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
list_add
(
&
rdev
->
same_set
,
&
mddev
->
disks
);
list_add
(
&
rdev
->
same_set
,
&
mddev
->
disks
);
rdev
->
mddev
=
mddev
;
rdev
->
mddev
=
mddev
;
printk
(
KERN_INFO
"md: bind<%s>
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
));
printk
(
KERN_INFO
"md: bind<%s>
\n
"
,
bdev
name
(
rdev
->
bdev
,
b
));
return
0
;
return
0
;
}
}
static
void
unbind_rdev_from_array
(
mdk_rdev_t
*
rdev
)
static
void
unbind_rdev_from_array
(
mdk_rdev_t
*
rdev
)
{
{
char
b
[
BDEVNAME_SIZE
];
if
(
!
rdev
->
mddev
)
{
if
(
!
rdev
->
mddev
)
{
MD_BUG
();
MD_BUG
();
return
;
return
;
}
}
list_del_init
(
&
rdev
->
same_set
);
list_del_init
(
&
rdev
->
same_set
);
printk
(
KERN_INFO
"md: unbind<%s>
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
));
printk
(
KERN_INFO
"md: unbind<%s>
\n
"
,
bdev
name
(
rdev
->
bdev
,
b
));
rdev
->
mddev
=
NULL
;
rdev
->
mddev
=
NULL
;
}
}
...
@@ -1071,8 +1074,9 @@ void md_autodetect_dev(dev_t dev);
...
@@ -1071,8 +1074,9 @@ void md_autodetect_dev(dev_t dev);
static
void
export_rdev
(
mdk_rdev_t
*
rdev
)
static
void
export_rdev
(
mdk_rdev_t
*
rdev
)
{
{
char
b
[
BDEVNAME_SIZE
];
printk
(
KERN_INFO
"md: export_rdev(%s)
\n
"
,
printk
(
KERN_INFO
"md: export_rdev(%s)
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
));
bdev
name
(
rdev
->
bdev
,
b
));
if
(
rdev
->
mddev
)
if
(
rdev
->
mddev
)
MD_BUG
();
MD_BUG
();
free_disk_sb
(
rdev
);
free_disk_sb
(
rdev
);
...
@@ -1153,8 +1157,9 @@ static void print_sb(mdp_super_t *sb)
...
@@ -1153,8 +1157,9 @@ static void print_sb(mdp_super_t *sb)
static
void
print_rdev
(
mdk_rdev_t
*
rdev
)
static
void
print_rdev
(
mdk_rdev_t
*
rdev
)
{
{
char
b
[
BDEVNAME_SIZE
];
printk
(
KERN_INFO
"md: rdev %s, SZ:%08llu F:%d S:%d DN:%u
\n
"
,
printk
(
KERN_INFO
"md: rdev %s, SZ:%08llu F:%d S:%d DN:%u
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
),
(
unsigned
long
long
)
rdev
->
size
,
bdev
name
(
rdev
->
bdev
,
b
),
(
unsigned
long
long
)
rdev
->
size
,
rdev
->
faulty
,
rdev
->
in_sync
,
rdev
->
desc_nr
);
rdev
->
faulty
,
rdev
->
in_sync
,
rdev
->
desc_nr
);
if
(
rdev
->
sb_loaded
)
{
if
(
rdev
->
sb_loaded
)
{
printk
(
KERN_INFO
"md: rdev superblock:
\n
"
);
printk
(
KERN_INFO
"md: rdev superblock:
\n
"
);
...
@@ -1168,6 +1173,7 @@ void md_print_devices(void)
...
@@ -1168,6 +1173,7 @@ void md_print_devices(void)
struct
list_head
*
tmp
,
*
tmp2
;
struct
list_head
*
tmp
,
*
tmp2
;
mdk_rdev_t
*
rdev
;
mdk_rdev_t
*
rdev
;
mddev_t
*
mddev
;
mddev_t
*
mddev
;
char
b
[
BDEVNAME_SIZE
];
printk
(
"
\n
"
);
printk
(
"
\n
"
);
printk
(
"md: **********************************
\n
"
);
printk
(
"md: **********************************
\n
"
);
...
@@ -1177,7 +1183,7 @@ void md_print_devices(void)
...
@@ -1177,7 +1183,7 @@ void md_print_devices(void)
printk
(
"md%d: "
,
mdidx
(
mddev
));
printk
(
"md%d: "
,
mdidx
(
mddev
));
ITERATE_RDEV
(
mddev
,
rdev
,
tmp2
)
ITERATE_RDEV
(
mddev
,
rdev
,
tmp2
)
printk
(
"<%s>"
,
bdev
_partition_name
(
rdev
->
bdev
));
printk
(
"<%s>"
,
bdev
name
(
rdev
->
bdev
,
b
));
printk
(
"
\n
"
);
printk
(
"
\n
"
);
ITERATE_RDEV
(
mddev
,
rdev
,
tmp2
)
ITERATE_RDEV
(
mddev
,
rdev
,
tmp2
)
...
@@ -1190,7 +1196,7 @@ void md_print_devices(void)
...
@@ -1190,7 +1196,7 @@ void md_print_devices(void)
static
int
write_disk_sb
(
mdk_rdev_t
*
rdev
)
static
int
write_disk_sb
(
mdk_rdev_t
*
rdev
)
{
{
char
b
[
BDEVNAME_SIZE
];
if
(
!
rdev
->
sb_loaded
)
{
if
(
!
rdev
->
sb_loaded
)
{
MD_BUG
();
MD_BUG
();
return
1
;
return
1
;
...
@@ -1201,14 +1207,14 @@ static int write_disk_sb(mdk_rdev_t * rdev)
...
@@ -1201,14 +1207,14 @@ static int write_disk_sb(mdk_rdev_t * rdev)
}
}
dprintk
(
KERN_INFO
"(write) %s's sb offset: %llu
\n
"
,
dprintk
(
KERN_INFO
"(write) %s's sb offset: %llu
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
),
bdev
name
(
rdev
->
bdev
,
b
),
(
unsigned
long
long
)
rdev
->
sb_offset
);
(
unsigned
long
long
)
rdev
->
sb_offset
);
if
(
sync_page_io
(
rdev
->
bdev
,
rdev
->
sb_offset
<<
1
,
MD_SB_BYTES
,
rdev
->
sb_page
,
WRITE
))
if
(
sync_page_io
(
rdev
->
bdev
,
rdev
->
sb_offset
<<
1
,
MD_SB_BYTES
,
rdev
->
sb_page
,
WRITE
))
return
0
;
return
0
;
printk
(
"md: write_disk_sb failed for device %s
\n
"
,
printk
(
"md: write_disk_sb failed for device %s
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
));
bdev
name
(
rdev
->
bdev
,
b
));
return
1
;
return
1
;
}
}
...
@@ -1259,11 +1265,12 @@ static void md_update_sb(mddev_t * mddev)
...
@@ -1259,11 +1265,12 @@ static void md_update_sb(mddev_t * mddev)
err
=
0
;
err
=
0
;
ITERATE_RDEV
(
mddev
,
rdev
,
tmp
)
{
ITERATE_RDEV
(
mddev
,
rdev
,
tmp
)
{
char
b
[
BDEVNAME_SIZE
];
dprintk
(
KERN_INFO
"md: "
);
dprintk
(
KERN_INFO
"md: "
);
if
(
rdev
->
faulty
)
if
(
rdev
->
faulty
)
dprintk
(
"(skipping faulty "
);
dprintk
(
"(skipping faulty "
);
dprintk
(
"%s "
,
bdev
_partition_name
(
rdev
->
bdev
));
dprintk
(
"%s "
,
bdev
name
(
rdev
->
bdev
,
b
));
if
(
!
rdev
->
faulty
)
{
if
(
!
rdev
->
faulty
)
{
err
+=
write_disk_sb
(
rdev
);
err
+=
write_disk_sb
(
rdev
);
}
else
}
else
...
@@ -1327,7 +1334,7 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int super_format, int super_mi
...
@@ -1327,7 +1334,7 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int super_format, int super_mi
if
(
!
size
)
{
if
(
!
size
)
{
printk
(
KERN_WARNING
printk
(
KERN_WARNING
"md: %s has zero or unknown size, marking faulty!
\n
"
,
"md: %s has zero or unknown size, marking faulty!
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
));
bdev
name
(
rdev
->
bdev
,
b
));
err
=
-
EINVAL
;
err
=
-
EINVAL
;
goto
abort_free
;
goto
abort_free
;
}
}
...
@@ -1338,13 +1345,13 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int super_format, int super_mi
...
@@ -1338,13 +1345,13 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int super_format, int super_mi
if
(
err
==
-
EINVAL
)
{
if
(
err
==
-
EINVAL
)
{
printk
(
KERN_WARNING
printk
(
KERN_WARNING
"md: %s has invalid sb, not importing!
\n
"
,
"md: %s has invalid sb, not importing!
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
));
bdev
name
(
rdev
->
bdev
,
b
));
goto
abort_free
;
goto
abort_free
;
}
}
if
(
err
<
0
)
{
if
(
err
<
0
)
{
printk
(
KERN_WARNING
printk
(
KERN_WARNING
"md: could not read %s's sb, not importing!
\n
"
,
"md: could not read %s's sb, not importing!
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
));
bdev
name
(
rdev
->
bdev
,
b
));
goto
abort_free
;
goto
abort_free
;
}
}
}
}
...
@@ -1372,6 +1379,7 @@ static int analyze_sbs(mddev_t * mddev)
...
@@ -1372,6 +1379,7 @@ static int analyze_sbs(mddev_t * mddev)
int
i
;
int
i
;
struct
list_head
*
tmp
;
struct
list_head
*
tmp
;
mdk_rdev_t
*
rdev
,
*
freshest
;
mdk_rdev_t
*
rdev
,
*
freshest
;
char
b
[
BDEVNAME_SIZE
];
freshest
=
NULL
;
freshest
=
NULL
;
ITERATE_RDEV
(
mddev
,
rdev
,
tmp
)
ITERATE_RDEV
(
mddev
,
rdev
,
tmp
)
...
@@ -1386,7 +1394,7 @@ static int analyze_sbs(mddev_t * mddev)
...
@@ -1386,7 +1394,7 @@ static int analyze_sbs(mddev_t * mddev)
printk
(
KERN_ERR
\
printk
(
KERN_ERR
\
"md: fatal superblock inconsistency in %s"
"md: fatal superblock inconsistency in %s"
" -- removing from array
\n
"
,
" -- removing from array
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
));
bdev
name
(
rdev
->
bdev
,
b
));
kick_rdev_from_array
(
rdev
);
kick_rdev_from_array
(
rdev
);
}
}
...
@@ -1401,7 +1409,7 @@ static int analyze_sbs(mddev_t * mddev)
...
@@ -1401,7 +1409,7 @@ static int analyze_sbs(mddev_t * mddev)
validate_super
(
mddev
,
rdev
))
{
validate_super
(
mddev
,
rdev
))
{
printk
(
KERN_WARNING
"md: kicking non-fresh %s"
printk
(
KERN_WARNING
"md: kicking non-fresh %s"
" from array!
\n
"
,
" from array!
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
));
bdev
name
(
rdev
->
bdev
,
b
));
kick_rdev_from_array
(
rdev
);
kick_rdev_from_array
(
rdev
);
continue
;
continue
;
}
}
...
@@ -1489,6 +1497,7 @@ static int do_md_run(mddev_t * mddev)
...
@@ -1489,6 +1497,7 @@ static int do_md_run(mddev_t * mddev)
struct
list_head
*
tmp
;
struct
list_head
*
tmp
;
mdk_rdev_t
*
rdev
;
mdk_rdev_t
*
rdev
;
struct
gendisk
*
disk
;
struct
gendisk
*
disk
;
char
b
[
BDEVNAME_SIZE
];
if
(
list_empty
(
&
mddev
->
disks
))
{
if
(
list_empty
(
&
mddev
->
disks
))
{
MD_BUG
();
MD_BUG
();
...
@@ -1547,7 +1556,7 @@ static int do_md_run(mddev_t * mddev)
...
@@ -1547,7 +1556,7 @@ static int do_md_run(mddev_t * mddev)
printk
(
KERN_WARNING
printk
(
KERN_WARNING
"md: Dev %s smaller than chunk_size:"
"md: Dev %s smaller than chunk_size:"
" %lluk < %dk
\n
"
,
" %lluk < %dk
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
),
bdev
name
(
rdev
->
bdev
,
b
),
(
unsigned
long
long
)
rdev
->
size
,
(
unsigned
long
long
)
rdev
->
size
,
chunk_size
/
1024
);
chunk_size
/
1024
);
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -1747,7 +1756,8 @@ static void autorun_array(mddev_t *mddev)
...
@@ -1747,7 +1756,8 @@ static void autorun_array(mddev_t *mddev)
printk
(
KERN_INFO
"md: running: "
);
printk
(
KERN_INFO
"md: running: "
);
ITERATE_RDEV
(
mddev
,
rdev
,
tmp
)
{
ITERATE_RDEV
(
mddev
,
rdev
,
tmp
)
{
printk
(
"<%s>"
,
bdev_partition_name
(
rdev
->
bdev
));
char
b
[
BDEVNAME_SIZE
];
printk
(
"<%s>"
,
bdevname
(
rdev
->
bdev
,
b
));
}
}
printk
(
"
\n
"
);
printk
(
"
\n
"
);
...
@@ -1776,6 +1786,7 @@ static void autorun_devices(void)
...
@@ -1776,6 +1786,7 @@ static void autorun_devices(void)
struct
list_head
*
tmp
;
struct
list_head
*
tmp
;
mdk_rdev_t
*
rdev0
,
*
rdev
;
mdk_rdev_t
*
rdev0
,
*
rdev
;
mddev_t
*
mddev
;
mddev_t
*
mddev
;
char
b
[
BDEVNAME_SIZE
];
printk
(
KERN_INFO
"md: autorun ...
\n
"
);
printk
(
KERN_INFO
"md: autorun ...
\n
"
);
while
(
!
list_empty
(
&
pending_raid_disks
))
{
while
(
!
list_empty
(
&
pending_raid_disks
))
{
...
@@ -1783,12 +1794,12 @@ static void autorun_devices(void)
...
@@ -1783,12 +1794,12 @@ static void autorun_devices(void)
mdk_rdev_t
,
same_set
);
mdk_rdev_t
,
same_set
);
printk
(
KERN_INFO
"md: considering %s ...
\n
"
,
printk
(
KERN_INFO
"md: considering %s ...
\n
"
,
bdev
_partition_name
(
rdev0
->
bdev
));
bdev
name
(
rdev0
->
bdev
,
b
));
INIT_LIST_HEAD
(
&
candidates
);
INIT_LIST_HEAD
(
&
candidates
);
ITERATE_RDEV_PENDING
(
rdev
,
tmp
)
ITERATE_RDEV_PENDING
(
rdev
,
tmp
)
if
(
super_90_load
(
rdev
,
rdev0
,
0
)
>=
0
)
{
if
(
super_90_load
(
rdev
,
rdev0
,
0
)
>=
0
)
{
printk
(
KERN_INFO
"md: adding %s ...
\n
"
,
printk
(
KERN_INFO
"md: adding %s ...
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
));
bdev
name
(
rdev
->
bdev
,
b
));
list_move
(
&
rdev
->
same_set
,
&
candidates
);
list_move
(
&
rdev
->
same_set
,
&
candidates
);
}
}
/*
/*
...
@@ -1810,7 +1821,7 @@ static void autorun_devices(void)
...
@@ -1810,7 +1821,7 @@ static void autorun_devices(void)
||
!
list_empty
(
&
mddev
->
disks
))
{
||
!
list_empty
(
&
mddev
->
disks
))
{
printk
(
KERN_WARNING
printk
(
KERN_WARNING
"md: md%d already running, cannot run %s
\n
"
,
"md: md%d already running, cannot run %s
\n
"
,
mdidx
(
mddev
),
bdev
_partition_name
(
rdev0
->
bdev
));
mdidx
(
mddev
),
bdev
name
(
rdev0
->
bdev
,
b
));
mddev_unlock
(
mddev
);
mddev_unlock
(
mddev
);
}
else
{
}
else
{
printk
(
KERN_INFO
"md: created md%d
\n
"
,
mdidx
(
mddev
));
printk
(
KERN_INFO
"md: created md%d
\n
"
,
mdidx
(
mddev
));
...
@@ -1863,7 +1874,7 @@ static int autostart_array(dev_t startdev)
...
@@ -1863,7 +1874,7 @@ static int autostart_array(dev_t startdev)
if
(
start_rdev
->
faulty
)
{
if
(
start_rdev
->
faulty
)
{
printk
(
KERN_WARNING
printk
(
KERN_WARNING
"md: can not autostart based on faulty %s!
\n
"
,
"md: can not autostart based on faulty %s!
\n
"
,
bdev
_partition_name
(
start_rdev
->
bdev
));
bdev
name
(
start_rdev
->
bdev
,
b
));
export_rdev
(
start_rdev
);
export_rdev
(
start_rdev
);
return
err
;
return
err
;
}
}
...
@@ -2000,6 +2011,7 @@ static int get_disk_info(mddev_t * mddev, void * arg)
...
@@ -2000,6 +2011,7 @@ static int get_disk_info(mddev_t * mddev, void * arg)
static
int
add_new_disk
(
mddev_t
*
mddev
,
mdu_disk_info_t
*
info
)
static
int
add_new_disk
(
mddev_t
*
mddev
,
mdu_disk_info_t
*
info
)
{
{
char
b
[
BDEVNAME_SIZE
],
b2
[
BDEVNAME_SIZE
];
mdk_rdev_t
*
rdev
;
mdk_rdev_t
*
rdev
;
dev_t
dev
;
dev_t
dev
;
dev
=
MKDEV
(
info
->
major
,
info
->
minor
);
dev
=
MKDEV
(
info
->
major
,
info
->
minor
);
...
@@ -2021,8 +2033,8 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)
...
@@ -2021,8 +2033,8 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)
if
(
err
<
0
)
{
if
(
err
<
0
)
{
printk
(
KERN_WARNING
printk
(
KERN_WARNING
"md: %s has different UUID to %s
\n
"
,
"md: %s has different UUID to %s
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
),
bdev
name
(
rdev
->
bdev
,
b
),
bdev
_partition_name
(
rdev0
->
bdev
));
bdev
name
(
rdev0
->
bdev
,
b2
));
export_rdev
(
rdev
);
export_rdev
(
rdev
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -2174,7 +2186,7 @@ static int hot_remove_disk(mddev_t * mddev, dev_t dev)
...
@@ -2174,7 +2186,7 @@ static int hot_remove_disk(mddev_t * mddev, dev_t dev)
return
0
;
return
0
;
busy:
busy:
printk
(
KERN_WARNING
"md: cannot remove active disk %s from md%d ...
\n
"
,
printk
(
KERN_WARNING
"md: cannot remove active disk %s from md%d ...
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
),
mdidx
(
mddev
));
bdev
name
(
rdev
->
bdev
,
b
),
mdidx
(
mddev
));
return
-
EBUSY
;
return
-
EBUSY
;
}
}
...
@@ -2228,7 +2240,7 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
...
@@ -2228,7 +2240,7 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
if
(
rdev
->
faulty
)
{
if
(
rdev
->
faulty
)
{
printk
(
KERN_WARNING
printk
(
KERN_WARNING
"md: can not hot-add faulty %s disk to md%d!
\n
"
,
"md: can not hot-add faulty %s disk to md%d!
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
),
mdidx
(
mddev
));
bdev
name
(
rdev
->
bdev
,
b
),
mdidx
(
mddev
));
err
=
-
EINVAL
;
err
=
-
EINVAL
;
goto
abort_export
;
goto
abort_export
;
}
}
...
@@ -2781,9 +2793,10 @@ static void status_unused(struct seq_file *seq)
...
@@ -2781,9 +2793,10 @@ static void status_unused(struct seq_file *seq)
seq_printf
(
seq
,
"unused devices: "
);
seq_printf
(
seq
,
"unused devices: "
);
ITERATE_RDEV_PENDING
(
rdev
,
tmp
)
{
ITERATE_RDEV_PENDING
(
rdev
,
tmp
)
{
char
b
[
BDEVNAME_SIZE
];
i
++
;
i
++
;
seq_printf
(
seq
,
"%s "
,
seq_printf
(
seq
,
"%s "
,
bdev
_partition_name
(
rdev
->
bdev
));
bdev
name
(
rdev
->
bdev
,
b
));
}
}
if
(
!
i
)
if
(
!
i
)
seq_printf
(
seq
,
"<none>"
);
seq_printf
(
seq
,
"<none>"
);
...
@@ -2938,8 +2951,9 @@ static int md_seq_show(struct seq_file *seq, void *v)
...
@@ -2938,8 +2951,9 @@ static int md_seq_show(struct seq_file *seq, void *v)
size
=
0
;
size
=
0
;
ITERATE_RDEV
(
mddev
,
rdev
,
tmp2
)
{
ITERATE_RDEV
(
mddev
,
rdev
,
tmp2
)
{
char
b
[
BDEVNAME_SIZE
];
seq_printf
(
seq
,
" %s[%d]"
,
seq_printf
(
seq
,
" %s[%d]"
,
bdev
_partition_name
(
rdev
->
bdev
),
rdev
->
desc_nr
);
bdev
name
(
rdev
->
bdev
,
b
),
rdev
->
desc_nr
);
if
(
rdev
->
faulty
)
{
if
(
rdev
->
faulty
)
{
seq_printf
(
seq
,
"(F)"
);
seq_printf
(
seq
,
"(F)"
);
continue
;
continue
;
...
...
drivers/md/multipath.c
View file @
45b3e77f
...
@@ -127,9 +127,10 @@ int multipath_end_request(struct bio *bio, unsigned int bytes_done, int error)
...
@@ -127,9 +127,10 @@ int multipath_end_request(struct bio *bio, unsigned int bytes_done, int error)
/*
/*
* oops, IO error:
* oops, IO error:
*/
*/
char
b
[
BDEVNAME_SIZE
];
md_error
(
mp_bh
->
mddev
,
rdev
);
md_error
(
mp_bh
->
mddev
,
rdev
);
printk
(
KERN_ERR
"multipath: %s: rescheduling sector %llu
\n
"
,
printk
(
KERN_ERR
"multipath: %s: rescheduling sector %llu
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
),
bdev
name
(
rdev
->
bdev
,
b
),
(
unsigned
long
long
)
bio
->
bi_sector
);
(
unsigned
long
long
)
bio
->
bi_sector
);
multipath_reschedule_retry
(
mp_bh
);
multipath_reschedule_retry
(
mp_bh
);
}
}
...
@@ -220,6 +221,7 @@ static void multipath_error (mddev_t *mddev, mdk_rdev_t *rdev)
...
@@ -220,6 +221,7 @@ static void multipath_error (mddev_t *mddev, mdk_rdev_t *rdev)
* Mark disk as unusable
* Mark disk as unusable
*/
*/
if
(
!
rdev
->
faulty
)
{
if
(
!
rdev
->
faulty
)
{
char
b
[
BDEVNAME_SIZE
];
rdev
->
in_sync
=
0
;
rdev
->
in_sync
=
0
;
rdev
->
faulty
=
1
;
rdev
->
faulty
=
1
;
mddev
->
sb_dirty
=
1
;
mddev
->
sb_dirty
=
1
;
...
@@ -227,7 +229,7 @@ static void multipath_error (mddev_t *mddev, mdk_rdev_t *rdev)
...
@@ -227,7 +229,7 @@ static void multipath_error (mddev_t *mddev, mdk_rdev_t *rdev)
printk
(
KERN_ALERT
"multipath: IO failure on %s,"
printk
(
KERN_ALERT
"multipath: IO failure on %s,"
" disabling IO path.
\n
Operation continuing"
" disabling IO path.
\n
Operation continuing"
" on %d IO paths.
\n
"
,
" on %d IO paths.
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
),
bdev
name
(
rdev
->
bdev
,
b
),
conf
->
working_disks
);
conf
->
working_disks
);
}
}
}
}
...
@@ -247,11 +249,12 @@ static void print_multipath_conf (multipath_conf_t *conf)
...
@@ -247,11 +249,12 @@ static void print_multipath_conf (multipath_conf_t *conf)
conf
->
raid_disks
);
conf
->
raid_disks
);
for
(
i
=
0
;
i
<
conf
->
raid_disks
;
i
++
)
{
for
(
i
=
0
;
i
<
conf
->
raid_disks
;
i
++
)
{
char
b
[
BDEVNAME_SIZE
];
tmp
=
conf
->
multipaths
+
i
;
tmp
=
conf
->
multipaths
+
i
;
if
(
tmp
->
rdev
)
if
(
tmp
->
rdev
)
printk
(
" disk%d, o:%d, dev:%s
\n
"
,
printk
(
" disk%d, o:%d, dev:%s
\n
"
,
i
,
!
tmp
->
rdev
->
faulty
,
i
,
!
tmp
->
rdev
->
faulty
,
bdev
_partition_name
(
tmp
->
rdev
->
bdev
));
bdev
name
(
tmp
->
rdev
->
bdev
,
b
));
}
}
}
}
...
@@ -326,6 +329,7 @@ static void multipathd (mddev_t *mddev)
...
@@ -326,6 +329,7 @@ static void multipathd (mddev_t *mddev)
md_check_recovery
(
mddev
);
md_check_recovery
(
mddev
);
for
(;;)
{
for
(;;)
{
char
b
[
BDEVNAME_SIZE
];
spin_lock_irqsave
(
&
retry_list_lock
,
flags
);
spin_lock_irqsave
(
&
retry_list_lock
,
flags
);
mp_bh
=
multipath_retry_list
;
mp_bh
=
multipath_retry_list
;
if
(
!
mp_bh
)
if
(
!
mp_bh
)
...
@@ -341,13 +345,13 @@ static void multipathd (mddev_t *mddev)
...
@@ -341,13 +345,13 @@ static void multipathd (mddev_t *mddev)
if
(
multipath_map
(
mddev
,
&
rdev
)
<
0
)
{
if
(
multipath_map
(
mddev
,
&
rdev
)
<
0
)
{
printk
(
KERN_ALERT
"multipath: %s: unrecoverable IO read"
printk
(
KERN_ALERT
"multipath: %s: unrecoverable IO read"
" error for block %llu
\n
"
,
" error for block %llu
\n
"
,
bdev
_partition_name
(
bio
->
bi_bdev
),
bdev
name
(
bio
->
bi_bdev
,
b
),
(
unsigned
long
long
)
bio
->
bi_sector
);
(
unsigned
long
long
)
bio
->
bi_sector
);
multipath_end_bh_io
(
mp_bh
,
0
);
multipath_end_bh_io
(
mp_bh
,
0
);
}
else
{
}
else
{
printk
(
KERN_ERR
"multipath: %s: redirecting sector %llu"
printk
(
KERN_ERR
"multipath: %s: redirecting sector %llu"
" to another IO path
\n
"
,
" to another IO path
\n
"
,
bdev
_partition_name
(
bio
->
bi_bdev
),
bdev
name
(
bio
->
bi_bdev
,
b
),
(
unsigned
long
long
)
bio
->
bi_sector
);
(
unsigned
long
long
)
bio
->
bi_sector
);
bio
->
bi_bdev
=
rdev
->
bdev
;
bio
->
bi_bdev
=
rdev
->
bdev
;
generic_make_request
(
bio
);
generic_make_request
(
bio
);
...
...
drivers/md/raid0.c
View file @
45b3e77f
...
@@ -36,6 +36,7 @@ static int create_strip_zones (mddev_t *mddev)
...
@@ -36,6 +36,7 @@ static int create_strip_zones (mddev_t *mddev)
struct
list_head
*
tmp1
,
*
tmp2
;
struct
list_head
*
tmp1
,
*
tmp2
;
struct
strip_zone
*
zone
;
struct
strip_zone
*
zone
;
int
cnt
;
int
cnt
;
char
b
[
BDEVNAME_SIZE
];
/*
/*
* The number of 'same size groups'
* The number of 'same size groups'
...
@@ -44,14 +45,15 @@ static int create_strip_zones (mddev_t *mddev)
...
@@ -44,14 +45,15 @@ static int create_strip_zones (mddev_t *mddev)
ITERATE_RDEV
(
mddev
,
rdev1
,
tmp1
)
{
ITERATE_RDEV
(
mddev
,
rdev1
,
tmp1
)
{
printk
(
"raid0: looking at %s
\n
"
,
printk
(
"raid0: looking at %s
\n
"
,
bdev
_partition_name
(
rdev1
->
bdev
));
bdev
name
(
rdev1
->
bdev
,
b
));
c
=
0
;
c
=
0
;
ITERATE_RDEV
(
mddev
,
rdev2
,
tmp2
)
{
ITERATE_RDEV
(
mddev
,
rdev2
,
tmp2
)
{
printk
(
"raid0: comparing %s(%llu) with %s(%llu)
\n
"
,
printk
(
"raid0: comparing %s(%llu)"
,
bdev_partition_name
(
rdev1
->
bdev
),
bdevname
(
rdev1
->
bdev
,
b
),
(
unsigned
long
long
)
rdev1
->
size
,
(
unsigned
long
long
)
rdev1
->
size
);
bdev_partition_name
(
rdev2
->
bdev
),
printk
(
" with %s(%llu)
\n
"
,
(
unsigned
long
long
)
rdev2
->
size
);
bdevname
(
rdev2
->
bdev
,
b
),
(
unsigned
long
long
)
rdev2
->
size
);
if
(
rdev2
==
rdev1
)
{
if
(
rdev2
==
rdev1
)
{
printk
(
"raid0: END
\n
"
);
printk
(
"raid0: END
\n
"
);
break
;
break
;
...
@@ -138,8 +140,9 @@ static int create_strip_zones (mddev_t *mddev)
...
@@ -138,8 +140,9 @@ static int create_strip_zones (mddev_t *mddev)
c
=
0
;
c
=
0
;
for
(
j
=
0
;
j
<
cnt
;
j
++
)
{
for
(
j
=
0
;
j
<
cnt
;
j
++
)
{
char
b
[
BDEVNAME_SIZE
];
rdev
=
conf
->
strip_zone
[
0
].
dev
[
j
];
rdev
=
conf
->
strip_zone
[
0
].
dev
[
j
];
printk
(
"raid0: checking %s ..."
,
bdev
_partition_name
(
rdev
->
bdev
));
printk
(
"raid0: checking %s ..."
,
bdev
name
(
rdev
->
bdev
,
b
));
if
(
rdev
->
size
>
current_offset
)
if
(
rdev
->
size
>
current_offset
)
{
{
printk
(
" contained as device %d
\n
"
,
c
);
printk
(
" contained as device %d
\n
"
,
c
);
...
@@ -404,6 +407,7 @@ static void raid0_status (struct seq_file *seq, mddev_t *mddev)
...
@@ -404,6 +407,7 @@ static void raid0_status (struct seq_file *seq, mddev_t *mddev)
#undef MD_DEBUG
#undef MD_DEBUG
#ifdef MD_DEBUG
#ifdef MD_DEBUG
int
j
,
k
,
h
;
int
j
,
k
,
h
;
char
b
[
BDEVNAME_SIZE
];
raid0_conf_t
*
conf
=
mddev_to_conf
(
mddev
);
raid0_conf_t
*
conf
=
mddev_to_conf
(
mddev
);
h
=
0
;
h
=
0
;
...
@@ -413,8 +417,8 @@ static void raid0_status (struct seq_file *seq, mddev_t *mddev)
...
@@ -413,8 +417,8 @@ static void raid0_status (struct seq_file *seq, mddev_t *mddev)
seq_printf
(
"(h%d)"
,
h
++
);
seq_printf
(
"(h%d)"
,
h
++
);
seq_printf
(
seq
,
"=["
);
seq_printf
(
seq
,
"=["
);
for
(
k
=
0
;
k
<
conf
->
strip_zone
[
j
].
nb_dev
;
k
++
)
for
(
k
=
0
;
k
<
conf
->
strip_zone
[
j
].
nb_dev
;
k
++
)
seq_printf
(
seq
,
"%s/"
,
bdev
_partition_
name
(
seq_printf
(
seq
,
"%s/"
,
bdevname
(
conf
->
strip_zone
[
j
].
dev
[
k
]
->
bdev
));
conf
->
strip_zone
[
j
].
dev
[
k
]
->
bdev
,
b
));
seq_printf
(
seq
,
"] zo=%d do=%d s=%d
\n
"
,
seq_printf
(
seq
,
"] zo=%d do=%d s=%d
\n
"
,
conf
->
strip_zone
[
j
].
zone_offset
,
conf
->
strip_zone
[
j
].
zone_offset
,
...
...
drivers/md/raid1.c
View file @
45b3e77f
...
@@ -308,8 +308,9 @@ static int raid1_end_request(struct bio *bio, unsigned int bytes_done, int error
...
@@ -308,8 +308,9 @@ static int raid1_end_request(struct bio *bio, unsigned int bytes_done, int error
/*
/*
* oops, read error:
* oops, read error:
*/
*/
char
b
[
BDEVNAME_SIZE
];
printk
(
KERN_ERR
"raid1: %s: rescheduling sector %llu
\n
"
,
printk
(
KERN_ERR
"raid1: %s: rescheduling sector %llu
\n
"
,
bdev
_partition_name
(
conf
->
mirrors
[
mirror
].
rdev
->
bdev
),
(
unsigned
long
long
)
r1_bio
->
sector
);
bdev
name
(
conf
->
mirrors
[
mirror
].
rdev
->
bdev
,
b
),
(
unsigned
long
long
)
r1_bio
->
sector
);
reschedule_retry
(
r1_bio
);
reschedule_retry
(
r1_bio
);
}
}
}
else
{
}
else
{
...
@@ -597,6 +598,7 @@ static void status(struct seq_file *seq, mddev_t *mddev)
...
@@ -597,6 +598,7 @@ static void status(struct seq_file *seq, mddev_t *mddev)
static
void
error
(
mddev_t
*
mddev
,
mdk_rdev_t
*
rdev
)
static
void
error
(
mddev_t
*
mddev
,
mdk_rdev_t
*
rdev
)
{
{
char
b
[
BDEVNAME_SIZE
];
conf_t
*
conf
=
mddev_to_conf
(
mddev
);
conf_t
*
conf
=
mddev_to_conf
(
mddev
);
/*
/*
...
@@ -625,7 +627,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
...
@@ -625,7 +627,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
mddev
->
sb_dirty
=
1
;
mddev
->
sb_dirty
=
1
;
printk
(
KERN_ALERT
"raid1: Disk failure on %s, disabling device.
\n
"
printk
(
KERN_ALERT
"raid1: Disk failure on %s, disabling device.
\n
"
" Operation continuing on %d devices
\n
"
,
" Operation continuing on %d devices
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
),
conf
->
working_disks
);
bdev
name
(
rdev
->
bdev
,
b
),
conf
->
working_disks
);
}
}
static
void
print_conf
(
conf_t
*
conf
)
static
void
print_conf
(
conf_t
*
conf
)
...
@@ -642,11 +644,12 @@ static void print_conf(conf_t *conf)
...
@@ -642,11 +644,12 @@ static void print_conf(conf_t *conf)
conf
->
raid_disks
);
conf
->
raid_disks
);
for
(
i
=
0
;
i
<
conf
->
raid_disks
;
i
++
)
{
for
(
i
=
0
;
i
<
conf
->
raid_disks
;
i
++
)
{
char
b
[
BDEVNAME_SIZE
];
tmp
=
conf
->
mirrors
+
i
;
tmp
=
conf
->
mirrors
+
i
;
if
(
tmp
->
rdev
)
if
(
tmp
->
rdev
)
printk
(
" disk %d, wo:%d, o:%d, dev:%s
\n
"
,
printk
(
" disk %d, wo:%d, o:%d, dev:%s
\n
"
,
i
,
!
tmp
->
rdev
->
in_sync
,
!
tmp
->
rdev
->
faulty
,
i
,
!
tmp
->
rdev
->
in_sync
,
!
tmp
->
rdev
->
faulty
,
bdev
_partition_name
(
tmp
->
rdev
->
bdev
));
bdev
name
(
tmp
->
rdev
->
bdev
,
b
));
}
}
}
}
...
@@ -814,9 +817,10 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
...
@@ -814,9 +817,10 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
* There is no point trying a read-for-reconstruct as
* There is no point trying a read-for-reconstruct as
* reconstruct is about to be aborted
* reconstruct is about to be aborted
*/
*/
char
b
[
BDEVNAME_SIZE
];
printk
(
KERN_ALERT
"raid1: %s: unrecoverable I/O read error"
printk
(
KERN_ALERT
"raid1: %s: unrecoverable I/O read error"
" for block %llu
\n
"
,
" for block %llu
\n
"
,
bdev
_partition_name
(
bio
->
bi_bdev
),
bdev
name
(
bio
->
bi_bdev
,
b
),
(
unsigned
long
long
)
r1_bio
->
sector
);
(
unsigned
long
long
)
r1_bio
->
sector
);
md_done_sync
(
mddev
,
r1_bio
->
master_bio
->
bi_size
>>
9
,
0
);
md_done_sync
(
mddev
,
r1_bio
->
master_bio
->
bi_size
>>
9
,
0
);
put_buf
(
r1_bio
);
put_buf
(
r1_bio
);
...
@@ -906,6 +910,7 @@ static void raid1d(mddev_t *mddev)
...
@@ -906,6 +910,7 @@ static void raid1d(mddev_t *mddev)
md_handle_safemode
(
mddev
);
md_handle_safemode
(
mddev
);
for
(;;)
{
for
(;;)
{
char
b
[
BDEVNAME_SIZE
];
spin_lock_irqsave
(
&
retry_list_lock
,
flags
);
spin_lock_irqsave
(
&
retry_list_lock
,
flags
);
if
(
list_empty
(
head
))
if
(
list_empty
(
head
))
break
;
break
;
...
@@ -925,14 +930,14 @@ static void raid1d(mddev_t *mddev)
...
@@ -925,14 +930,14 @@ static void raid1d(mddev_t *mddev)
if
(
map
(
mddev
,
&
rdev
)
==
-
1
)
{
if
(
map
(
mddev
,
&
rdev
)
==
-
1
)
{
printk
(
KERN_ALERT
"raid1: %s: unrecoverable I/O"
printk
(
KERN_ALERT
"raid1: %s: unrecoverable I/O"
" read error for block %llu
\n
"
,
" read error for block %llu
\n
"
,
bdev
_partition_name
(
bio
->
bi_bdev
),
bdev
name
(
bio
->
bi_bdev
,
b
),
(
unsigned
long
long
)
r1_bio
->
sector
);
(
unsigned
long
long
)
r1_bio
->
sector
);
raid_end_bio_io
(
r1_bio
);
raid_end_bio_io
(
r1_bio
);
break
;
break
;
}
}
printk
(
KERN_ERR
"raid1: %s: redirecting sector %llu to"
printk
(
KERN_ERR
"raid1: %s: redirecting sector %llu to"
" another mirror
\n
"
,
" another mirror
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
),
bdev
name
(
rdev
->
bdev
,
b
),
(
unsigned
long
long
)
r1_bio
->
sector
);
(
unsigned
long
long
)
r1_bio
->
sector
);
bio
->
bi_bdev
=
rdev
->
bdev
;
bio
->
bi_bdev
=
rdev
->
bdev
;
bio
->
bi_sector
=
r1_bio
->
sector
+
rdev
->
data_offset
;
bio
->
bi_sector
=
r1_bio
->
sector
+
rdev
->
data_offset
;
...
...
drivers/md/raid5.c
View file @
45b3e77f
...
@@ -457,6 +457,7 @@ static void raid5_build_block (struct stripe_head *sh, int i)
...
@@ -457,6 +457,7 @@ static void raid5_build_block (struct stripe_head *sh, int i)
static
void
error
(
mddev_t
*
mddev
,
mdk_rdev_t
*
rdev
)
static
void
error
(
mddev_t
*
mddev
,
mdk_rdev_t
*
rdev
)
{
{
char
b
[
BDEVNAME_SIZE
];
raid5_conf_t
*
conf
=
(
raid5_conf_t
*
)
mddev
->
private
;
raid5_conf_t
*
conf
=
(
raid5_conf_t
*
)
mddev
->
private
;
PRINTK
(
"raid5: error called
\n
"
);
PRINTK
(
"raid5: error called
\n
"
);
...
@@ -476,7 +477,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
...
@@ -476,7 +477,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
printk
(
KERN_ALERT
printk
(
KERN_ALERT
"raid5: Disk failure on %s, disabling device."
"raid5: Disk failure on %s, disabling device."
" Operation continuing on %d devices
\n
"
,
" Operation continuing on %d devices
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
),
conf
->
working_disks
);
bdev
name
(
rdev
->
bdev
,
b
),
conf
->
working_disks
);
}
}
}
}
...
@@ -1486,8 +1487,9 @@ static int run (mddev_t *mddev)
...
@@ -1486,8 +1487,9 @@ static int run (mddev_t *mddev)
disk
->
rdev
=
rdev
;
disk
->
rdev
=
rdev
;
if
(
rdev
->
in_sync
)
{
if
(
rdev
->
in_sync
)
{
char
b
[
BDEVNAME_SIZE
];
printk
(
KERN_INFO
"raid5: device %s operational as raid"
printk
(
KERN_INFO
"raid5: device %s operational as raid"
" disk %d
\n
"
,
bdev
_partition_name
(
rdev
->
bdev
),
" disk %d
\n
"
,
bdev
name
(
rdev
->
bdev
,
b
),
raid_disk
);
raid_disk
);
conf
->
working_disks
++
;
conf
->
working_disks
++
;
}
}
...
@@ -1663,11 +1665,12 @@ static void print_raid5_conf (raid5_conf_t *conf)
...
@@ -1663,11 +1665,12 @@ static void print_raid5_conf (raid5_conf_t *conf)
conf
->
working_disks
,
conf
->
failed_disks
);
conf
->
working_disks
,
conf
->
failed_disks
);
for
(
i
=
0
;
i
<
conf
->
raid_disks
;
i
++
)
{
for
(
i
=
0
;
i
<
conf
->
raid_disks
;
i
++
)
{
char
b
[
BDEVNAME_SIZE
];
tmp
=
conf
->
disks
+
i
;
tmp
=
conf
->
disks
+
i
;
if
(
tmp
->
rdev
)
if
(
tmp
->
rdev
)
printk
(
" disk %d, o:%d, dev:%s
\n
"
,
printk
(
" disk %d, o:%d, dev:%s
\n
"
,
i
,
!
tmp
->
rdev
->
faulty
,
i
,
!
tmp
->
rdev
->
faulty
,
bdev
_partition_name
(
tmp
->
rdev
->
bdev
));
bdev
name
(
tmp
->
rdev
->
bdev
,
b
));
}
}
}
}
...
...
include/linux/raid/md.h
View file @
45b3e77f
...
@@ -62,21 +62,6 @@
...
@@ -62,21 +62,6 @@
#define MD_MINOR_VERSION 90
#define MD_MINOR_VERSION 90
#define MD_PATCHLEVEL_VERSION 0
#define MD_PATCHLEVEL_VERSION 0
/*
* XXX(hch): This function is broken. Someone who understands the md
* code needs to go through all callers, check whether bdev could
* be NULL and replace it with direct calls to bdevmame.
*
* This would also fix the returns buffer on stack issue nicely :)
*/
static
inline
const
char
*
bdev_partition_name
(
struct
block_device
*
bdev
)
{
char
b
[
BDEVNAME_SIZE
];
if
(
!
bdev
)
return
__bdevname
(
0
,
b
);
return
bdevname
(
bdev
,
b
);
}
extern
int
register_md_personality
(
int
p_num
,
mdk_personality_t
*
p
);
extern
int
register_md_personality
(
int
p_num
,
mdk_personality_t
*
p
);
extern
int
unregister_md_personality
(
int
p_num
);
extern
int
unregister_md_personality
(
int
p_num
);
extern
mdk_thread_t
*
md_register_thread
(
void
(
*
run
)
(
mddev_t
*
mddev
),
extern
mdk_thread_t
*
md_register_thread
(
void
(
*
run
)
(
mddev_t
*
mddev
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment