Skip to content

Commit

Permalink
ocfs2: adjust minlen with discard_granularity in the FITRIM ioctl
Browse files Browse the repository at this point in the history
Adjust minlen with discard_granularity for FITRIM ioctl(2) if the given
minimum size in bytes is less than it because, discard granularity is
used to tell us that the minimum size of extent that can be discarded by
the storage device.

This is inspired by ext4 commit 5c2ed62 ("ext4: Adjust minlen with
discard_granularity in the FITRIM ioctl") from Lukas Czerner.

Signed-off-by: Jie Liu <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
pibroch authored and torvalds committed Jan 22, 2014
1 parent aa89762 commit 1ba2212
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/ocfs2/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,8 @@ long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
if (copy_from_user(&range, argp, sizeof(range)))
return -EFAULT;

range.minlen = max_t(u64, q->limits.discard_granularity,
range.minlen);
ret = ocfs2_trim_fs(sb, &range);
if (ret < 0)
return ret;
Expand Down

0 comments on commit 1ba2212

Please sign in to comment.