Commit fba6544
btrfs: add cancellation points to trim loops
commit 6931385 upstream.
There are reports that system cannot suspend due to running trim because
the task responsible for trimming the device isn't able to finish in
time, especially since we have a free extent discarding phase, which can
trim a lot of unallocated space. There are no limits on the trim size
(unlike the block group part).
Since trime isn't a critical call it can be interrupted at any time,
in such cases we stop the trim, report the amount of discarded bytes and
return an error.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=219180
Link: https://bugzilla.suse.com/show_bug.cgi?id=1229737
CC: stable@vger.kernel.org # 5.15+
Signed-off-by: Luca Stefani <luca.stefani.ge1@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 21e90ee commit fba6544
3 files changed
Lines changed: 14 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1316 | 1316 | | |
1317 | 1317 | | |
1318 | 1318 | | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
1319 | 1324 | | |
1320 | 1325 | | |
1321 | 1326 | | |
| |||
6470 | 6475 | | |
6471 | 6476 | | |
6472 | 6477 | | |
6473 | | - | |
| 6478 | + | |
6474 | 6479 | | |
6475 | 6480 | | |
6476 | 6481 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3809 | 3809 | | |
3810 | 3810 | | |
3811 | 3811 | | |
3812 | | - | |
| 3812 | + | |
3813 | 3813 | | |
3814 | 3814 | | |
3815 | 3815 | | |
| |||
4000 | 4000 | | |
4001 | 4001 | | |
4002 | 4002 | | |
4003 | | - | |
| 4003 | + | |
4004 | 4004 | | |
4005 | 4005 | | |
4006 | 4006 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
| |||
0 commit comments