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
Kirill Smelkov
linux
Commits
960e739d
Commit
960e739d
authored
Aug 15, 2008
by
Jens Axboe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
block: raid fixups for removal of bi_hw_segments
Signed-off-by:
Jens Axboe
<
jens.axboe@oracle.com
>
parent
5df97b91
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
17 deletions
+51
-17
drivers/md/raid1.c
drivers/md/raid1.c
+0
-1
drivers/md/raid10.c
drivers/md/raid10.c
+0
-1
drivers/md/raid5.c
drivers/md/raid5.c
+51
-15
No files found.
drivers/md/raid1.c
View file @
960e739d
...
@@ -1787,7 +1787,6 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
...
@@ -1787,7 +1787,6 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
bio
->
bi_vcnt
=
0
;
bio
->
bi_vcnt
=
0
;
bio
->
bi_idx
=
0
;
bio
->
bi_idx
=
0
;
bio
->
bi_phys_segments
=
0
;
bio
->
bi_phys_segments
=
0
;
bio
->
bi_hw_segments
=
0
;
bio
->
bi_size
=
0
;
bio
->
bi_size
=
0
;
bio
->
bi_end_io
=
NULL
;
bio
->
bi_end_io
=
NULL
;
bio
->
bi_private
=
NULL
;
bio
->
bi_private
=
NULL
;
...
...
drivers/md/raid10.c
View file @
960e739d
...
@@ -1944,7 +1944,6 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
...
@@ -1944,7 +1944,6 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
bio
->
bi_vcnt
=
0
;
bio
->
bi_vcnt
=
0
;
bio
->
bi_idx
=
0
;
bio
->
bi_idx
=
0
;
bio
->
bi_phys_segments
=
0
;
bio
->
bi_phys_segments
=
0
;
bio
->
bi_hw_segments
=
0
;
bio
->
bi_size
=
0
;
bio
->
bi_size
=
0
;
}
}
...
...
drivers/md/raid5.c
View file @
960e739d
...
@@ -101,6 +101,40 @@
...
@@ -101,6 +101,40 @@
const
char
raid6_empty_zero_page
[
PAGE_SIZE
]
__attribute__
((
aligned
(
256
)));
const
char
raid6_empty_zero_page
[
PAGE_SIZE
]
__attribute__
((
aligned
(
256
)));
#endif
#endif
/*
* We maintain a biased count of active stripes in the bottom 8 bits of
* bi_phys_segments, and a count of processed stripes in the upper 8 bits
*/
static
inline
int
raid5_bi_phys_segments
(
struct
bio
*
bio
)
{
return
bio
->
bi_phys_segments
&
0xff
;
}
static
inline
int
raid5_bi_hw_segments
(
struct
bio
*
bio
)
{
return
(
bio
->
bi_phys_segments
>>
8
)
&
0xff
;
}
static
inline
int
raid5_dec_bi_phys_segments
(
struct
bio
*
bio
)
{
--
bio
->
bi_phys_segments
;
return
raid5_bi_phys_segments
(
bio
);
}
static
inline
int
raid5_dec_bi_hw_segments
(
struct
bio
*
bio
)
{
unsigned
short
val
=
raid5_bi_hw_segments
(
bio
);
--
val
;
bio
->
bi_phys_segments
=
(
val
<<
8
)
|
raid5_bi_phys_segments
(
bio
);
return
val
;
}
static
inline
void
raid5_set_bi_hw_segments
(
struct
bio
*
bio
,
unsigned
int
cnt
)
{
bio
->
bi_phys_segments
=
raid5_bi_phys_segments
(
bio
)
||
(
cnt
<<
8
);
}
static
inline
int
raid6_next_disk
(
int
disk
,
int
raid_disks
)
static
inline
int
raid6_next_disk
(
int
disk
,
int
raid_disks
)
{
{
disk
++
;
disk
++
;
...
@@ -507,7 +541,7 @@ static void ops_complete_biofill(void *stripe_head_ref)
...
@@ -507,7 +541,7 @@ static void ops_complete_biofill(void *stripe_head_ref)
while
(
rbi
&&
rbi
->
bi_sector
<
while
(
rbi
&&
rbi
->
bi_sector
<
dev
->
sector
+
STRIPE_SECTORS
)
{
dev
->
sector
+
STRIPE_SECTORS
)
{
rbi2
=
r5_next_bio
(
rbi
,
dev
->
sector
);
rbi2
=
r5_next_bio
(
rbi
,
dev
->
sector
);
if
(
--
rbi
->
bi_phys_segments
==
0
)
{
if
(
!
raid5_dec_bi_phys_segments
(
rbi
)
)
{
rbi
->
bi_next
=
return_bi
;
rbi
->
bi_next
=
return_bi
;
return_bi
=
rbi
;
return_bi
=
rbi
;
}
}
...
@@ -1725,7 +1759,7 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, in
...
@@ -1725,7 +1759,7 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, in
if
(
*
bip
)
if
(
*
bip
)
bi
->
bi_next
=
*
bip
;
bi
->
bi_next
=
*
bip
;
*
bip
=
bi
;
*
bip
=
bi
;
bi
->
bi_phys_segments
++
;
bi
->
bi_phys_segments
++
;
spin_unlock_irq
(
&
conf
->
device_lock
);
spin_unlock_irq
(
&
conf
->
device_lock
);
spin_unlock
(
&
sh
->
lock
);
spin_unlock
(
&
sh
->
lock
);
...
@@ -1819,7 +1853,7 @@ handle_failed_stripe(raid5_conf_t *conf, struct stripe_head *sh,
...
@@ -1819,7 +1853,7 @@ handle_failed_stripe(raid5_conf_t *conf, struct stripe_head *sh,
sh
->
dev
[
i
].
sector
+
STRIPE_SECTORS
)
{
sh
->
dev
[
i
].
sector
+
STRIPE_SECTORS
)
{
struct
bio
*
nextbi
=
r5_next_bio
(
bi
,
sh
->
dev
[
i
].
sector
);
struct
bio
*
nextbi
=
r5_next_bio
(
bi
,
sh
->
dev
[
i
].
sector
);
clear_bit
(
BIO_UPTODATE
,
&
bi
->
bi_flags
);
clear_bit
(
BIO_UPTODATE
,
&
bi
->
bi_flags
);
if
(
--
bi
->
bi_phys_segments
==
0
)
{
if
(
!
raid5_dec_bi_phys_segments
(
bi
)
)
{
md_write_end
(
conf
->
mddev
);
md_write_end
(
conf
->
mddev
);
bi
->
bi_next
=
*
return_bi
;
bi
->
bi_next
=
*
return_bi
;
*
return_bi
=
bi
;
*
return_bi
=
bi
;
...
@@ -1834,7 +1868,7 @@ handle_failed_stripe(raid5_conf_t *conf, struct stripe_head *sh,
...
@@ -1834,7 +1868,7 @@ handle_failed_stripe(raid5_conf_t *conf, struct stripe_head *sh,
sh
->
dev
[
i
].
sector
+
STRIPE_SECTORS
)
{
sh
->
dev
[
i
].
sector
+
STRIPE_SECTORS
)
{
struct
bio
*
bi2
=
r5_next_bio
(
bi
,
sh
->
dev
[
i
].
sector
);
struct
bio
*
bi2
=
r5_next_bio
(
bi
,
sh
->
dev
[
i
].
sector
);
clear_bit
(
BIO_UPTODATE
,
&
bi
->
bi_flags
);
clear_bit
(
BIO_UPTODATE
,
&
bi
->
bi_flags
);
if
(
--
bi
->
bi_phys_segments
==
0
)
{
if
(
!
raid5_dec_bi_phys_segments
(
bi
)
)
{
md_write_end
(
conf
->
mddev
);
md_write_end
(
conf
->
mddev
);
bi
->
bi_next
=
*
return_bi
;
bi
->
bi_next
=
*
return_bi
;
*
return_bi
=
bi
;
*
return_bi
=
bi
;
...
@@ -1858,7 +1892,7 @@ handle_failed_stripe(raid5_conf_t *conf, struct stripe_head *sh,
...
@@ -1858,7 +1892,7 @@ handle_failed_stripe(raid5_conf_t *conf, struct stripe_head *sh,
struct
bio
*
nextbi
=
struct
bio
*
nextbi
=
r5_next_bio
(
bi
,
sh
->
dev
[
i
].
sector
);
r5_next_bio
(
bi
,
sh
->
dev
[
i
].
sector
);
clear_bit
(
BIO_UPTODATE
,
&
bi
->
bi_flags
);
clear_bit
(
BIO_UPTODATE
,
&
bi
->
bi_flags
);
if
(
--
bi
->
bi_phys_segments
==
0
)
{
if
(
!
raid5_dec_bi_phys_segments
(
bi
)
)
{
bi
->
bi_next
=
*
return_bi
;
bi
->
bi_next
=
*
return_bi
;
*
return_bi
=
bi
;
*
return_bi
=
bi
;
}
}
...
@@ -2033,7 +2067,7 @@ static void handle_stripe_clean_event(raid5_conf_t *conf,
...
@@ -2033,7 +2067,7 @@ static void handle_stripe_clean_event(raid5_conf_t *conf,
while
(
wbi
&&
wbi
->
bi_sector
<
while
(
wbi
&&
wbi
->
bi_sector
<
dev
->
sector
+
STRIPE_SECTORS
)
{
dev
->
sector
+
STRIPE_SECTORS
)
{
wbi2
=
r5_next_bio
(
wbi
,
dev
->
sector
);
wbi2
=
r5_next_bio
(
wbi
,
dev
->
sector
);
if
(
--
wbi
->
bi_phys_segments
==
0
)
{
if
(
!
raid5_dec_bi_phys_segments
(
wbi
)
)
{
md_write_end
(
conf
->
mddev
);
md_write_end
(
conf
->
mddev
);
wbi
->
bi_next
=
*
return_bi
;
wbi
->
bi_next
=
*
return_bi
;
*
return_bi
=
wbi
;
*
return_bi
=
wbi
;
...
@@ -2814,7 +2848,7 @@ static bool handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
...
@@ -2814,7 +2848,7 @@ static bool handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
copy_data
(
0
,
rbi
,
dev
->
page
,
dev
->
sector
);
copy_data
(
0
,
rbi
,
dev
->
page
,
dev
->
sector
);
rbi2
=
r5_next_bio
(
rbi
,
dev
->
sector
);
rbi2
=
r5_next_bio
(
rbi
,
dev
->
sector
);
spin_lock_irq
(
&
conf
->
device_lock
);
spin_lock_irq
(
&
conf
->
device_lock
);
if
(
--
rbi
->
bi_phys_segments
==
0
)
{
if
(
!
raid5_dec_bi_phys_segments
(
rbi
)
)
{
rbi
->
bi_next
=
return_bi
;
rbi
->
bi_next
=
return_bi
;
return_bi
=
rbi
;
return_bi
=
rbi
;
}
}
...
@@ -3155,8 +3189,11 @@ static struct bio *remove_bio_from_retry(raid5_conf_t *conf)
...
@@ -3155,8 +3189,11 @@ static struct bio *remove_bio_from_retry(raid5_conf_t *conf)
if
(
bi
)
{
if
(
bi
)
{
conf
->
retry_read_aligned_list
=
bi
->
bi_next
;
conf
->
retry_read_aligned_list
=
bi
->
bi_next
;
bi
->
bi_next
=
NULL
;
bi
->
bi_next
=
NULL
;
/*
* this sets the active strip count to 1 and the processed
* strip count to zero (upper 8 bits)
*/
bi
->
bi_phys_segments
=
1
;
/* biased count of active stripes */
bi
->
bi_phys_segments
=
1
;
/* biased count of active stripes */
bi
->
bi_hw_segments
=
0
;
/* count of processed stripes */
}
}
return
bi
;
return
bi
;
...
@@ -3206,8 +3243,7 @@ static int bio_fits_rdev(struct bio *bi)
...
@@ -3206,8 +3243,7 @@ static int bio_fits_rdev(struct bio *bi)
if
((
bi
->
bi_size
>>
9
)
>
q
->
max_sectors
)
if
((
bi
->
bi_size
>>
9
)
>
q
->
max_sectors
)
return
0
;
return
0
;
blk_recount_segments
(
q
,
bi
);
blk_recount_segments
(
q
,
bi
);
if
(
bi
->
bi_phys_segments
>
q
->
max_phys_segments
||
if
(
bi
->
bi_phys_segments
>
q
->
max_phys_segments
)
bi
->
bi_hw_segments
>
q
->
max_hw_segments
)
return
0
;
return
0
;
if
(
q
->
merge_bvec_fn
)
if
(
q
->
merge_bvec_fn
)
...
@@ -3468,7 +3504,7 @@ static int make_request(struct request_queue *q, struct bio * bi)
...
@@ -3468,7 +3504,7 @@ static int make_request(struct request_queue *q, struct bio * bi)
}
}
spin_lock_irq
(
&
conf
->
device_lock
);
spin_lock_irq
(
&
conf
->
device_lock
);
remaining
=
--
bi
->
bi_phys_segments
;
remaining
=
raid5_dec_bi_phys_segments
(
bi
)
;
spin_unlock_irq
(
&
conf
->
device_lock
);
spin_unlock_irq
(
&
conf
->
device_lock
);
if
(
remaining
==
0
)
{
if
(
remaining
==
0
)
{
...
@@ -3752,7 +3788,7 @@ static int retry_aligned_read(raid5_conf_t *conf, struct bio *raid_bio)
...
@@ -3752,7 +3788,7 @@ static int retry_aligned_read(raid5_conf_t *conf, struct bio *raid_bio)
sector
+=
STRIPE_SECTORS
,
sector
+=
STRIPE_SECTORS
,
scnt
++
)
{
scnt
++
)
{
if
(
scnt
<
raid
_bio
->
bi_hw_segments
)
if
(
scnt
<
raid
5_bi_hw_segments
(
raid_bio
)
)
/* already done this stripe */
/* already done this stripe */
continue
;
continue
;
...
@@ -3760,7 +3796,7 @@ static int retry_aligned_read(raid5_conf_t *conf, struct bio *raid_bio)
...
@@ -3760,7 +3796,7 @@ static int retry_aligned_read(raid5_conf_t *conf, struct bio *raid_bio)
if
(
!
sh
)
{
if
(
!
sh
)
{
/* failed to get a stripe - must wait */
/* failed to get a stripe - must wait */
raid
_bio
->
bi_hw_segments
=
scnt
;
raid
5_set_bi_hw_segments
(
raid_bio
,
scnt
)
;
conf
->
retry_read_aligned
=
raid_bio
;
conf
->
retry_read_aligned
=
raid_bio
;
return
handled
;
return
handled
;
}
}
...
@@ -3768,7 +3804,7 @@ static int retry_aligned_read(raid5_conf_t *conf, struct bio *raid_bio)
...
@@ -3768,7 +3804,7 @@ static int retry_aligned_read(raid5_conf_t *conf, struct bio *raid_bio)
set_bit
(
R5_ReadError
,
&
sh
->
dev
[
dd_idx
].
flags
);
set_bit
(
R5_ReadError
,
&
sh
->
dev
[
dd_idx
].
flags
);
if
(
!
add_stripe_bio
(
sh
,
raid_bio
,
dd_idx
,
0
))
{
if
(
!
add_stripe_bio
(
sh
,
raid_bio
,
dd_idx
,
0
))
{
release_stripe
(
sh
);
release_stripe
(
sh
);
raid
_bio
->
bi_hw_segments
=
scnt
;
raid
5_set_bi_hw_segments
(
raid_bio
,
scnt
)
;
conf
->
retry_read_aligned
=
raid_bio
;
conf
->
retry_read_aligned
=
raid_bio
;
return
handled
;
return
handled
;
}
}
...
@@ -3778,7 +3814,7 @@ static int retry_aligned_read(raid5_conf_t *conf, struct bio *raid_bio)
...
@@ -3778,7 +3814,7 @@ static int retry_aligned_read(raid5_conf_t *conf, struct bio *raid_bio)
handled
++
;
handled
++
;
}
}
spin_lock_irq
(
&
conf
->
device_lock
);
spin_lock_irq
(
&
conf
->
device_lock
);
remaining
=
--
raid_bio
->
bi_phys_segments
;
remaining
=
raid5_dec_bi_phys_segments
(
raid_bio
)
;
spin_unlock_irq
(
&
conf
->
device_lock
);
spin_unlock_irq
(
&
conf
->
device_lock
);
if
(
remaining
==
0
)
if
(
remaining
==
0
)
bio_endio
(
raid_bio
,
0
);
bio_endio
(
raid_bio
,
0
);
...
...
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