diff options
author | Lukas Czerner <[email protected]> | 2017-04-27 08:59:36 -0700 |
---|---|---|
committer | Darrick J. Wong <[email protected]> | 2017-04-27 10:45:34 -0700 |
commit | 3c3781951c9a155a56e5eed567349118374cc315 (patch) | |
tree | 1fdb696b5a0dc6af0882245eeb1c1f61945b40d4 | |
parent | c4cf1acdb186436b88cc9aeaf08322bc49fec183 (diff) |
xfs: Allow user to kill fstrim process
fstrim can take really long time on big, slow device or on file system
with a lots of allocation groups. Currently there is no way for the user
to cancell the operation. This patch makes it possible for the user to
kill fstrim pocess by adding the check for fatal_signal_pending() in
xfs_trim_extents().
Signed-off-by: Lukas Czerner <[email protected]>
Reported-by: Zdenek Kabelac <[email protected]>
Reviewed-by: Eric Sandeen <[email protected]>
Reviewed-by: Darrick J. Wong <[email protected]>
Signed-off-by: Darrick J. Wong <[email protected]>
-rw-r--r-- | fs/xfs/xfs_discard.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c index d796ffac7296..6a05d278da64 100644 --- a/fs/xfs/xfs_discard.c +++ b/fs/xfs/xfs_discard.c @@ -132,6 +132,11 @@ next_extent: error = xfs_btree_decrement(cur, 0, &i); if (error) goto out_del_cursor; + + if (fatal_signal_pending(current)) { + error = -ERESTARTSYS; + goto out_del_cursor; + } } out_del_cursor: @@ -196,8 +201,11 @@ xfs_ioc_trim( for (agno = start_agno; agno <= end_agno; agno++) { error = xfs_trim_extents(mp, agno, start, end, minlen, &blocks_trimmed); - if (error) + if (error) { last_error = error; + if (error == -ERESTARTSYS) + break; + } } if (last_error) |