badblocks: attempt to merge adjacent badblocks during ack_all_badblocks
If ack and unack badblocks are adjacent, they will not be merged and will
remain as two separate badblocks. Even after the bad blocks are written
to disk and both become ack, they will still remain as two independent
bad blocks. This is not ideal as it wastes the limited space for
badblocks. Therefore, during ack_all_badblocks(), attempt to merge
badblocks if they are adjacent.
Fixes: aa511ff821 ("badblocks: switch to the improved badblock handling code")
Signed-off-by: Li Nan <linan122@huawei.com>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Acked-by: Coly Li <colyli@kernel.org>
Link: https://lore.kernel.org/r/20250227075507.151331-4-zhengqixing@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
pull/1188/head
parent
270b68fee9
commit
32e9ad4d11
|
|
@ -1491,6 +1491,11 @@ void ack_all_badblocks(struct badblocks *bb)
|
||||||
p[i] = BB_MAKE(start, len, 1);
|
p[i] = BB_MAKE(start, len, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < bb->count ; i++)
|
||||||
|
while (try_adjacent_combine(bb, i))
|
||||||
|
;
|
||||||
|
|
||||||
bb->unacked_exist = 0;
|
bb->unacked_exist = 0;
|
||||||
}
|
}
|
||||||
write_sequnlock_irq(&bb->lock);
|
write_sequnlock_irq(&bb->lock);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue