mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 14:04:54 +02:00
FROMLIST: f2fs: run fstrim asynchronously if runtime discard is on
Cherry-picked from:
origin/upstream-f2fs-stable-linux-4.4.y
We don't need to wait for whole bunch of discard candidates in fstrim, since
runtime discard will issue them in idle time.
Change-Id: I32602711842d603cca030765eab49b337789e8ad
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
aa6ef14126
commit
6dd708f898
|
|
@ -2519,9 +2519,18 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)
|
|||
|
||||
__init_discard_policy(sbi, &dpolicy, DPOLICY_FSTRIM, cpc.trim_minlen);
|
||||
__issue_discard_cmd_range(sbi, &dpolicy, start_block, end_block);
|
||||
trimmed = __wait_discard_cmd_range(sbi, &dpolicy,
|
||||
|
||||
/*
|
||||
* We filed discard candidates, but actually we don't need to wait for
|
||||
* all of them, since they'll be issued in idle time along with runtime
|
||||
* discard option. User configuration looks like using runtime discard
|
||||
* or periodic fstrim instead of it.
|
||||
*/
|
||||
if (!test_opt(sbi, DISCARD)) {
|
||||
trimmed = __wait_discard_cmd_range(sbi, &dpolicy,
|
||||
start_block, end_block);
|
||||
range->len = F2FS_BLK_TO_BYTES(trimmed);
|
||||
range->len = F2FS_BLK_TO_BYTES(trimmed);
|
||||
}
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user