Commit 3c378195 authored by Lukas Czerner's avatar Lukas Czerner Committed by Darrick J. Wong

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: default avatarLukas Czerner <lczerner@redhat.com>
Reported-by: default avatarZdenek Kabelac <zkabelac@redhat.com>
Reviewed-by: default avatarEric Sandeen <sandeen@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent c4cf1acd
...@@ -132,6 +132,11 @@ xfs_trim_extents( ...@@ -132,6 +132,11 @@ xfs_trim_extents(
error = xfs_btree_decrement(cur, 0, &i); error = xfs_btree_decrement(cur, 0, &i);
if (error) if (error)
goto out_del_cursor; goto out_del_cursor;
if (fatal_signal_pending(current)) {
error = -ERESTARTSYS;
goto out_del_cursor;
}
} }
out_del_cursor: out_del_cursor:
...@@ -196,8 +201,11 @@ xfs_ioc_trim( ...@@ -196,8 +201,11 @@ xfs_ioc_trim(
for (agno = start_agno; agno <= end_agno; agno++) { for (agno = start_agno; agno <= end_agno; agno++) {
error = xfs_trim_extents(mp, agno, start, end, minlen, error = xfs_trim_extents(mp, agno, start, end, minlen,
&blocks_trimmed); &blocks_trimmed);
if (error) if (error) {
last_error = error; last_error = error;
if (error == -ERESTARTSYS)
break;
}
} }
if (last_error) if (last_error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment