]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: check if device support discard in FITRIM ioctl
authorLukas Czerner <lczerner@redhat.com>
Wed, 23 Feb 2011 17:42:32 +0000 (12:42 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 23 Feb 2011 17:42:32 +0000 (12:42 -0500)
commit572b971088faaf05bad5c9fbf00443976ff23fbf
tree8f7aa98378a979ebfa323165ae985d7d5b39a24c
parent651a5475b275b75e5c15e001e50c6cce57532ed2
ext4: check if device support discard in FITRIM ioctl

For a device that does not support discard, the FITRIM ioctl returns
-EOPNOTSUPP when blkdev_issue_discard() returns this error code, which
is how the user is informed that the device does not support discard.

If there are no suitable free extents to be trimmed, then FITRIM will
return success even though the device does not support discard, which
could confuse the user.  So check explicitly if the device supports
discard and return an error code at the beginning of the FITRIM ioctl
processing.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/ioctl.c