mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
btrfs: don't attempt to trim devices that don't support it
commit0be88e367fupstream. We check whether any device the file system is using supports discard in the ioctl call, but then we attempt to trim free extents on every device regardless of whether discard is supported. Due to the way we mask off EOPNOTSUPP, we can end up issuing the trim operations on each free range on devices that don't support it, just wasting time. Fixes:499f377f49("btrfs: iterate over unused chunk space in FITRIM") CC: stable@vger.kernel.org # 4.4+ Signed-off-by: Jeff Mahoney <jeffm@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
76e59a628e
commit
4d0dfd8fc8
@@ -10789,6 +10789,10 @@ static int btrfs_trim_free_extents(struct btrfs_device *device,
|
||||
|
||||
*trimmed = 0;
|
||||
|
||||
/* Discard not supported = nothing to do. */
|
||||
if (!blk_queue_discard(bdev_get_queue(device->bdev)))
|
||||
return 0;
|
||||
|
||||
/* Not writeable = nothing to do. */
|
||||
if (!test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state))
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user