diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a94948221c5993971824b081d8b5ec8ab8721b7b..f042dc595d05986e75118bad315873739a6b0a31 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -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;