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

From: Zheng Qixing

Date: Wed Jan 07 2026 - 20:49:23 EST



在 2026/1/6 23:36, Pascal Hambourg 写道:
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.

That makes sense. I will change it in the next version.


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.

I will try to test with disks that have lbs=512 and pbs=4096.

If 512B IOs can be successfully issued, then the bad block repair logic does need to

consider the minimum repair length and alignment logic.


Thanks,

Qixing