mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 16:37:50 +00:00
block: make bi_phys_segments an unsigned int instead of short
raid5 can overflow with more than 255 stripes, and we can increase it to an int for free on both 32 and 64-bit archs due to the padding. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
parent
960e739d9e
commit
5b99c2ffa9
2 changed files with 7 additions and 7 deletions
|
@ -102,17 +102,17 @@ 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
|
* We maintain a biased count of active stripes in the bottom 16 bits of
|
||||||
* bi_phys_segments, and a count of processed stripes in the upper 8 bits
|
* bi_phys_segments, and a count of processed stripes in the upper 16 bits
|
||||||
*/
|
*/
|
||||||
static inline int raid5_bi_phys_segments(struct bio *bio)
|
static inline int raid5_bi_phys_segments(struct bio *bio)
|
||||||
{
|
{
|
||||||
return bio->bi_phys_segments & 0xff;
|
return bio->bi_phys_segments & 0xffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int raid5_bi_hw_segments(struct bio *bio)
|
static inline int raid5_bi_hw_segments(struct bio *bio)
|
||||||
{
|
{
|
||||||
return (bio->bi_phys_segments >> 8) & 0xff;
|
return (bio->bi_phys_segments >> 16) & 0xffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int raid5_dec_bi_phys_segments(struct bio *bio)
|
static inline int raid5_dec_bi_phys_segments(struct bio *bio)
|
||||||
|
@ -126,13 +126,13 @@ static inline int raid5_dec_bi_hw_segments(struct bio *bio)
|
||||||
unsigned short val = raid5_bi_hw_segments(bio);
|
unsigned short val = raid5_bi_hw_segments(bio);
|
||||||
|
|
||||||
--val;
|
--val;
|
||||||
bio->bi_phys_segments = (val << 8) | raid5_bi_phys_segments(bio);
|
bio->bi_phys_segments = (val << 16) | raid5_bi_phys_segments(bio);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void raid5_set_bi_hw_segments(struct bio *bio, unsigned int cnt)
|
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);
|
bio->bi_phys_segments = raid5_bi_phys_segments(bio) || (cnt << 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int raid6_next_disk(int disk, int raid_disks)
|
static inline int raid6_next_disk(int disk, int raid_disks)
|
||||||
|
|
|
@ -75,7 +75,7 @@ struct bio {
|
||||||
/* Number of segments in this BIO after
|
/* Number of segments in this BIO after
|
||||||
* physical address coalescing is performed.
|
* physical address coalescing is performed.
|
||||||
*/
|
*/
|
||||||
unsigned short bi_phys_segments;
|
unsigned int bi_phys_segments;
|
||||||
|
|
||||||
unsigned int bi_size; /* residual I/O count */
|
unsigned int bi_size; /* residual I/O count */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue