Jie Liu 2f42d612e7 xfs: don't perform discard if the given range length is less than block size
For discard operation, we should return EINVAL if the given range length
is less than a block size, otherwise it will go through the file system
to discard data blocks as the end range might be evaluated to -1, e.g,
# fstrim -v -o 0 -l 100 /xfs7
/xfs7: 9811378176 bytes were trimmed

This issue can be triggered via xfstests/generic/288.

Also, it seems to get the request queue pointer via bdev_get_queue()
instead of the hard code pointer dereference is not a bad thing.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ben Myers <bpm@sgi.com>

(cherry picked from commit f9fd0135610084abef6867d984e9951c3099950d)
2013-12-10 10:00:33 -06:00
..
2013-05-07 18:45:36 -05:00
2013-11-06 16:31:27 -06:00
2013-11-06 16:31:27 -06:00
2013-05-07 18:45:36 -05:00
2011-08-12 16:21:35 -05:00
2011-08-12 16:21:35 -05:00
2012-11-19 20:11:24 -06:00
2013-08-12 16:53:39 -05:00
2012-11-19 20:11:24 -06:00
2011-08-12 16:21:35 -05:00
2011-08-12 16:21:35 -05:00
2011-03-07 10:09:35 +11:00
2011-08-12 16:21:35 -05:00
2013-09-12 16:13:41 -07:00
2012-05-14 16:20:54 -05:00
2011-08-12 16:21:35 -05:00
2013-08-12 16:56:06 -05:00
2013-11-06 12:41:51 -06:00
2013-05-07 18:45:36 -05:00
2013-11-14 17:16:35 +09:00
2012-10-17 12:01:25 -05:00
2013-11-06 12:41:51 -06:00
2013-05-07 18:45:36 -05:00