diff options
author | Lukas Czerner <lczerner@redhat.com> | 2011-02-23 17:49:51 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-02-23 17:49:51 -0500 |
commit | 5c2ed62fd447e2c696e222dcf71d1322bbbc58d4 (patch) | |
tree | 4ee089653fe84a9f21518a351b1ad06c8281011f | |
parent | 4143179218960a70d821a425e3c23ce44aa93dee (diff) |
ext4: Adjust minlen with discard_granularity in the FITRIM ioctl
Discard granularity tells us the minimum size of extent that can be
discarded by the device. If the user supplies a minimum extent that
should be discarded (range.minlen) which is smaller than the discard
granularity, increase minlen to the discard granularity, since there's
no point submitting trim requests that the device will reject anyway.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | fs/ext4/ioctl.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 25ba7c79d28..c052c9f0f3a 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -348,6 +348,8 @@ mext_out: | |||
348 | sizeof(range))) | 348 | sizeof(range))) |
349 | return -EFAULT; | 349 | return -EFAULT; |
350 | 350 | ||
351 | range.minlen = max((unsigned int)range.minlen, | ||
352 | q->limits.discard_granularity); | ||
351 | ret = ext4_trim_fs(sb, &range); | 353 | ret = ext4_trim_fs(sb, &range); |
352 | if (ret < 0) | 354 | if (ret < 0) |
353 | return ret; | 355 | return ret; |