]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: detect wether a device supports discard
authorJosef Bacik <josef@redhat.com>
Thu, 4 Aug 2011 14:52:27 +0000 (14:52 +0000)
committerChris Mason <chris.mason@oracle.com>
Wed, 17 Aug 2011 01:09:15 +0000 (21:09 -0400)
commit055d684c24cd102299ef6e578438c60ff5457dbd
tree336234b9d9a144f180bc51738f55fef7f743b725
parent5920ccfdaea0c96d2aaa9082e0d2f20b727a22f9
Btrfs: detect wether a device supports discard

We have a problem where if a user specifies discard but doesn't actually support
it we will return EOPNOTSUPP from btrfs_discard_extent.  This is a problem
because this gets called (in a fashion) from the tree log recovery code, which
has a nice little BUG_ON(ret) after it, which causes us to fail the tree log
replay.  So instead detect wether our devices support discard when we're adding
them and then don't issue discards if we know that the device doesn't support
it.  And just for good measure set ret = 0 in btrfs_issue_discard just in case
we still get EOPNOTSUPP so we don't screw anybody up like this again.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent-tree.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h