Commit 6eae2694 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: fix incorrect range->len in f2fs_trim_fs()

generic/260 reported below error:

     [+] Default length with start set (should succeed)
     [+] Length beyond the end of fs (should succeed)
     [+] Length beyond the end of fs with start set (should succeed)
    +./tests/generic/260: line 94: [: 18446744073709551615: integer expression expected
    +./tests/generic/260: line 104: [: 18446744073709551615: integer expression expected
     Test done
    ...

In f2fs_trim_fs(), if there is no discard being trimmed, we need to correct
range->len before return.
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 22969158
......@@ -2582,8 +2582,9 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)
trimmed += __wait_discard_cmd_range(sbi, &dpolicy,
start_block, end_block);
range->len = F2FS_BLK_TO_BYTES(trimmed);
out:
if (!err)
range->len = F2FS_BLK_TO_BYTES(trimmed);
return err;
}
......
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