Re: [PATCH] btrfs: Don't block system suspend during fstrim

From: Qu Wenruo
Date: Mon Sep 02 2024 - 05:41:15 EST




在 2024/9/2 19:01, Luca Stefani 写道:
[...]

Oh, then it's fine.

Except the return code, everything looks fine to me now.

Forgot to mention that, even for error case, we should copy the fstrim_range structure to the ioctl parameter to indicate any progress we made.
This seems to be already the case.
range->len = trimmed; is always executed regardless of previous failures
and there doesn't seem to be any early return.

What I mean is inside btrfs_ioctl_fitrim(), at the end if btrfs_trim_fs() returned error (including interrupted), copy_to_user() will not be call, that's the problem needs to be solved, as long as we return error for interrupted cases.

Thanks,
Qu

Will try adding back the errno and try the repro.

Thanks.

Thanks,
Qu

Just please update the commit message to explicitly mention that, we
have a free extent discarding phase, which can trim a lot of unallocated
space, and there is no limits on the trim size (unlike the block group
part).

Thanks,
Qu

    Thanks,
    Qu

     >>       }
     >>       mutex_unlock(&fs_devices->device_list_mutex);
     >