PM: sleep: Call pm_sleep_fs_sync() instead of ksys_sync_helper()

Replace the direct calls to ksys_sync_helper() with the new
pm_sleep_fs_sync() in suspend and hibernation code paths.

This enables the new mechanism allowing the filesystem sync phase
to be interrupted.

Suggested-by: Saravana Kannan <saravanak@google.com>
Signed-off-by: Samuel Wu <wusamuel@google.com>
Co-developed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ rjw: Subject and changelog edits, tags adjustment ]
Link: https://patch.msgid.link/20251119171426.4086783-3-wusamuel@google.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Samuel Wu 2025-11-19 09:14:25 -08:00 committed by Rafael J. Wysocki
parent bf8867eae1
commit 8e2d57e653
3 changed files with 13 additions and 3 deletions

View File

@ -820,7 +820,10 @@ int hibernate(void)
if (error)
goto Restore;
ksys_sync_helper();
error = pm_sleep_fs_sync();
if (error)
goto Notify;
if (filesystem_freeze_enabled)
filesystems_freeze();
@ -892,6 +895,7 @@ int hibernate(void)
freezer_test_done = false;
Exit:
filesystems_thaw();
Notify:
pm_notifier_call_chain(PM_POST_HIBERNATION);
Restore:
pm_restore_console();

View File

@ -594,7 +594,11 @@ static int enter_state(suspend_state_t state)
if (sync_on_suspend_enabled) {
trace_suspend_resume(TPS("sync_filesystems"), 0, true);
ksys_sync_helper();
error = pm_sleep_fs_sync();
if (error)
goto Unlock;
trace_suspend_resume(TPS("sync_filesystems"), 0, false);
}

View File

@ -278,7 +278,9 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
if (data->frozen)
break;
ksys_sync_helper();
error = pm_sleep_fs_sync();
if (error)
break;
error = freeze_processes();
if (error)