Re: [RFC PATCH 1/5] md: add helpers for requested sync action
Zheng Qixing <[email protected]>
| Newsgroups | gmane.linux.kernel,gmane.linux.raid |
|---|---|
| Message-ID | <[email protected]> |
在 2026/1/6 20:59, Li Nan 写道:
>>
>> +
>> +static int handle_requested_sync_action(struct mddev *mddev,
>> + enum sync_action action)
>> +{
>> + if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery))
>> + return -EBUSY;
>
> This return change origin logic; split factor out and fix into two
> patches.
Make sense to me.
>
>> + return __handle_requested_sync_action(mddev, action);
>> +}
>> +
>
> __handle_requested_sync_action does not need to be split.
>
>> +static enum sync_action __get_recovery_sync_action(struct mddev *mddev)
>> +{
>> + if (test_bit(MD_RECOVERY_CHECK, &mddev->recovery))
>> + return ACTION_CHECK;
>> + if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery))
>> + return ACTION_REPAIR;
>> + return ACTION_RESYNC;
>> +}
>> +
>> +static enum sync_action get_recovery_sync_action(struct mddev *mddev)
>> +{
>> + return __get_recovery_sync_action(mddev);
>> +}
>> +
>
> __get_recovery_sync_action also does not need to be split.
>
Okay.
>
>> +static void init_recovery_position(struct mddev *mddev)
>> +{
>> + mddev->resync_min = 0;
>> +}
>> +
>> +static void set_requested_position(struct mddev *mddev, sector_t value)
>> +{
>> + mddev->resync_min = value;
>> +}
>> +
>> +static sector_t get_requested_position(struct mddev *mddev)
>> +{
>> + return mddev->resync_min;
>> +}
>> +
>
> There is no need to factor the operations of resync_min;
> 'rectify_min' that follows can re-use 'resync_min' directly.
>
If we share resync_min with check/repair, bad blocks may be missed
during repair:
When check/repair is halfway through execution and then frozen,
followed by a rectify operation, any bad blocks that exist before
resync_min will not be repaired. This would require an additional
rectify operation.
Thanks,
Qixing