Skip to content

Commit 32e9ad4

Browse files
Li Nanaxboe
authored andcommitted
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: aa511ff ("badblocks: switch to the improved badblock handling code") Signed-off-by: Li Nan <[email protected]> Reviewed-by: Yu Kuai <[email protected]> Acked-by: Coly Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 270b68f commit 32e9ad4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

block/badblocks.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,11 @@ void ack_all_badblocks(struct badblocks *bb)
14911491
p[i] = BB_MAKE(start, len, 1);
14921492
}
14931493
}
1494+
1495+
for (i = 0; i < bb->count ; i++)
1496+
while (try_adjacent_combine(bb, i))
1497+
;
1498+
14941499
bb->unacked_exist = 0;
14951500
}
14961501
write_sequnlock_irq(&bb->lock);

0 commit comments

Comments
 (0)