Re: [RFC PATCH 0/5] md/raid1: introduce a new sync action to repair badblocks

From: Pascal Hambourg

Date: Tue Jan 06 2026 - 11:12:38 EST


On 06/01/2026 at 03:44, Zheng Qixing wrote:
在 2025/12/31 19:11, Roman Mamedov 写道:
On Wed, 31 Dec 2025 15:09:47 +0800

Could you also check here that it reads back successfully, and only then clear?

Otherwise there are cases when the block won't read even after rewriting it.

I confirm. The rewrite is reported successful but SMART reallocation attributes did not change and a further read still fails.

I'm a bit worried that reading the data again before clearing the bad blocks might affect the performance of the bad block repair process.

Isn't it more worrying to clear bad blocks while they may still be bad ?
Bad blocks should be rare anyway, so performance impact should be low.

Side note, on some hardware it might be necessary to rewrite a larger area
around the problematic block, to finally trigger a remap. Not 512B, but at
least the native sector size, which is often 4K.

Are you referring to the case where we have logical 512B sectors but physical 4K sectors?

Yes. Writing a single logical sector implies a read-modify-write of the whole underlying physical sector and will not complete if the read fails.

Can a physical 4K block have partial recovery (e.g., one 512B sector succeeds while the other 7 fail)?

Not in my experience. There seems to be a single ECC for the whole physical sector.