diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2008-08-15 04:56:11 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-10-09 02:56:03 -0400 |
commit | 5b99c2ffa980528a197f26c7d876cceeccce8dd5 (patch) | |
tree | 65e3bbbccb3f796f0569c47fcfc00e222cd3066e /drivers/md/raid5.c | |
parent | 960e739d9e9f1c2346d8bdc65299ee2e1ed42218 (diff) |
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>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 05b22925cce4..37e546528f9c 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -102,17 +102,17 @@ const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256))); | |||
102 | #endif | 102 | #endif |
103 | 103 | ||
104 | /* | 104 | /* |
105 | * We maintain a biased count of active stripes in the bottom 8 bits of | 105 | * We maintain a biased count of active stripes in the bottom 16 bits of |
106 | * bi_phys_segments, and a count of processed stripes in the upper 8 bits | 106 | * bi_phys_segments, and a count of processed stripes in the upper 16 bits |
107 | */ | 107 | */ |
108 | static inline int raid5_bi_phys_segments(struct bio *bio) | 108 | static inline int raid5_bi_phys_segments(struct bio *bio) |
109 | { | 109 | { |
110 | return bio->bi_phys_segments & 0xff; | 110 | return bio->bi_phys_segments & 0xffff; |
111 | } | 111 | } |
112 | 112 | ||
113 | static inline int raid5_bi_hw_segments(struct bio *bio) | 113 | static inline int raid5_bi_hw_segments(struct bio *bio) |
114 | { | 114 | { |
115 | return (bio->bi_phys_segments >> 8) & 0xff; | 115 | return (bio->bi_phys_segments >> 16) & 0xffff; |
116 | } | 116 | } |
117 | 117 | ||
118 | static inline int raid5_dec_bi_phys_segments(struct bio *bio) | 118 | 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) | |||
126 | unsigned short val = raid5_bi_hw_segments(bio); | 126 | unsigned short val = raid5_bi_hw_segments(bio); |
127 | 127 | ||
128 | --val; | 128 | --val; |
129 | bio->bi_phys_segments = (val << 8) | raid5_bi_phys_segments(bio); | 129 | bio->bi_phys_segments = (val << 16) | raid5_bi_phys_segments(bio); |
130 | return val; | 130 | return val; |
131 | } | 131 | } |
132 | 132 | ||
133 | static inline void raid5_set_bi_hw_segments(struct bio *bio, unsigned int cnt) | 133 | static inline void raid5_set_bi_hw_segments(struct bio *bio, unsigned int cnt) |
134 | { | 134 | { |
135 | bio->bi_phys_segments = raid5_bi_phys_segments(bio) || (cnt << 8); | 135 | bio->bi_phys_segments = raid5_bi_phys_segments(bio) || (cnt << 16); |
136 | } | 136 | } |
137 | 137 | ||
138 | static inline int raid6_next_disk(int disk, int raid_disks) | 138 | static inline int raid6_next_disk(int disk, int raid_disks) |