Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2593046pxb; Sat, 23 Oct 2021 03:31:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlF6Anop5SMvvmGqV3HJHfz6mAHCsBhfpg2rZ2kkQQcgZjJCBMg42j9EOBmXOjuipVdVTS X-Received: by 2002:aa7:cf92:: with SMTP id z18mr8185795edx.100.1634985062060; Sat, 23 Oct 2021 03:31:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634985062; cv=none; d=google.com; s=arc-20160816; b=D3BBQAQ47MDtUf6wjxE4d6Js3uDQeVN7tfE1GV5I8u6ak3hngc/L1dsIm87Px/egCI CNo9iUB5ycU6sdolaPEm59y/g2ncpKlCnP1aBgRlVlvyg6Uxk1yp4F65ZE7CdSen1X4i NX1CxFVkftahe18+ChDUZzme0609Scr/P8ns1gsV3ZWfamgv8UUOvsky1NexQICoqa49 fFWnAEfH8PWH3Y/1WaX5wKVC2OzOIle+QL0Q7aQhXsiQEzNzdaiQXtnHhkepovAUuEU5 Q6NBvoSQRtU3zB8Iepx7h2sNlJMi52QxmEBxiYO7FyJ90veIDVfMX26Mj3BBJXNJWbEz ggog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:date:to :from:subject:message-id; bh=sOZRLGrJiOQ2eAQYqFKTb6nteMfIuZFpkDjuBQzkeM4=; b=NZ4tcQjEBYEQueFoJzv4CiviJS+z1FWA4M3OgXJNGyXfCsRevl+ZXImMTjdJynn4L/ idwVN21eFWN99jmTAtAU9dSsgaq1t2i8C68ZZnQT5Slulp6+040OKlfNx6+MeFIEb64t 3pibic6EnC5YtfkWHSQhRsB8lq0eVAy0ErN1ZFpQIXunFWDM8E5XxgchuCCwfFhat1Oi vHZ6Xljqf+MUNnw08qtu8Lk8aXAg0AVIgaYBlZ4bCXYXENvu+Ln6STKA+FV2E04byXXX pYu0qXRa4nrw4ert3S4NJtQbGROJUih2Jg4VfeDWvpbLAjsAjxSt6VxmFPUpHKGcGqOo SP8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sh10si8330986ejc.268.2021.10.23.03.30.20; Sat, 23 Oct 2021 03:31:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230140AbhJWKci (ORCPT + 99 others); Sat, 23 Oct 2021 06:32:38 -0400 Received: from mx1.tetaneutral.net ([91.224.149.83]:46766 "EHLO mx1.tetaneutral.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230126AbhJWKch (ORCPT ); Sat, 23 Oct 2021 06:32:37 -0400 X-Greylist: delayed 332 seconds by postgrey-1.27 at vger.kernel.org; Sat, 23 Oct 2021 06:32:37 EDT Received: by mx1.tetaneutral.net (Postfix, from userid 109) id 7F5568C0D4; Sat, 23 Oct 2021 12:24:45 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mx1.tetaneutral.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FSL_HELO_NON_FQDN_1 autolearn=ham autolearn_force=no version=3.4.2 Received: from lgnuc (ip165.tetaneutral.net [IPv6:2a03:7220:8080:a500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.tetaneutral.net (Postfix) with ESMTPS id 8C9B88C0CC for ; Sat, 23 Oct 2021 12:24:41 +0200 (CEST) Message-ID: <1634984680.26818.10.camel@guerby.net> Subject: How to force EXT4_MB_GRP_CLEAR_TRIMMED on a live ext4? From: Laurent GUERBY To: linux-ext4@vger.kernel.org Date: Sat, 23 Oct 2021 12:24:40 +0200 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1+deb9u2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Hi, When using fstrim on an ext4 filesystem trim are not issued for EXT4_MB_GRP_WAS_TRIMMED space which is a useful optimization. Is there a way to force a complete trim on a mounted ext4 filesystem?  My (limited) understanding of the code is that EXT4_MB_GRP_CLEAR_TRIMMED should be called to do so. My use case is having live migrated a virtual machine root disk from one storage to another, the target supporting trim, but since fstrim in the VM post migration does mostly nothing (assumes most space was trimmed) I cannot release space to the new storage. I tried mount -o remount but without effect. e2fsprogs don't seem to have an option/tool to do this either. I've seen suggestion that rebooting will do the job but the whole point of live migration is to avoid reboot :). I did end up creating dummy files to fill the filesystem and then removing them, but this is far less efficient than what a filesystem tool could do. Thanks in advance for your help, Sincerely, Laurent