@@ -219,18 +219,18 @@ int badblocks_set(struct badblocks *bb, sector_t s, int sectors,
if (e < s + sectors)
e = s + sectors;
if (e - a <= BB_MAX_LEN) {
- p[lo] = BB_MAKE(a, e-a, ack);
s = e;
} else {
/* does not all fit in one range,
* make p[lo] maximal
*/
- if (BB_LEN(p[lo]) != BB_MAX_LEN)
- p[lo] = BB_MAKE(a, BB_MAX_LEN, ack);
s = a + BB_MAX_LEN;
}
+ if (s - a != BB_LEN(p[lo]) || ack != BB_ACK(p[lo])) {
+ p[lo] = BB_MAKE(a, s - a, ack);
+ changed = true;
+ }
sectors = e - s;
- changed = true;
}
}
if (sectors && hi < bb->count) {