Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACD75C11F67 for ; Fri, 2 Jul 2021 01:29:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84CE4613BC for ; Fri, 2 Jul 2021 01:29:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234672AbhGBBc3 (ORCPT ); Thu, 1 Jul 2021 21:32:29 -0400 Received: from bee.birch.relay.mailchannels.net ([23.83.209.14]:51102 "EHLO bee.birch.relay.mailchannels.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234476AbhGBBc1 (ORCPT ); Thu, 1 Jul 2021 21:32:27 -0400 X-Sender-Id: instrampxe0y3a|x-authsender|calestyo@scientia.net Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id C18FE1E1C6C for ; Fri, 2 Jul 2021 01:29:55 +0000 (UTC) Received: from mailgw-02.dd24.net (100-96-13-105.trex-nlb.outbound.svc.cluster.local [100.96.13.105]) (Authenticated sender: instrampxe0y3a) by relay.mailchannels.net (Postfix) with ESMTPA id EE37C1E1AB8 for ; Fri, 2 Jul 2021 01:29:54 +0000 (UTC) X-Sender-Id: instrampxe0y3a|x-authsender|calestyo@scientia.net Received: from mailgw-02.dd24.net (mailgw-02.dd24.net [193.46.215.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.96.13.105 (trex/6.3.3); Fri, 02 Jul 2021 01:29:55 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: instrampxe0y3a|x-authsender|calestyo@scientia.net X-MailChannels-Auth-Id: instrampxe0y3a X-Bubble-Trade: 600569481171997a_1625189395508_3239045516 X-MC-Loop-Signature: 1625189395508:3283094367 X-MC-Ingress-Time: 1625189395508 Received: from heisenberg.fritz.box (ppp-88-217-47-84.dynamic.mnet-online.de [88.217.47.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: calestyo@scientia.net) by smtp.dd24.net (Postfix) with ESMTPSA id 262C25FC25 for ; Fri, 2 Jul 2021 01:29:53 +0000 (UTC) Message-ID: Subject: auto-detect and set -o discard? From: Christoph Anton Mitterer To: linux-btrfs@vger.kernel.org Date: Fri, 02 Jul 2021 03:29:52 +0200 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Hey. Right now it seems, btrfs doesn't automatically set -o discard, depending on whether or no a SSD is detected. The FAQ entry https://btrfs.wiki.kernel.org/index.php/FAQ#Does_Btrfs_support_TRIM.2Fdiscard.3F seems to imply that this was done because of several reasons: - dm-crypt security issues => that should be a non-issue, because AFAIU, dm-crypt itself simply blocks any TRIM/discard, unless cryptsetup’s --allow-discards is specifically set when opening the device - disputed performance benefits => Is this still questioned? I don't have any concrete benchmarks, but I mean using TRIM is what probably every SSD manufacturer suggests? Another disadvantage of not auto-detecting this is that - with default mount options (i.e. no discard) - VMs and the like, wont give back any space in their storage images. Cheers, Chris