Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp645642ybm; Wed, 27 May 2020 04:41:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzFPBKOjUKMmteOizhPcpevzo+zWEtLBN7+jxgS139czBQVfQ7309eDSxSL2PGYGid9yjc X-Received: by 2002:a17:906:7848:: with SMTP id p8mr5858637ejm.244.1590579716140; Wed, 27 May 2020 04:41:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590579716; cv=none; d=google.com; s=arc-20160816; b=kDO/j0jIU1fIFn55TQYAhm3B1N7YzxcgMadyVPySUwUA8RY6w6fJNx2ujjNxGo1w8U b1abDhoB3ty+9SRTksNkYKDUOd3x/HUGX2zsAhoFqRKSeI2Mkfg9i+sXdQ7dZzyZUdYS 6WgLZruqIrkzkU1br4sUnjY7EpYRflYaylSUOF00ESmEwFldnwDqY3yueq26len9/UWr Kfkbriu/EuvL8vjgjPMny8CODbk6xl71fYSIjxQyTS6opseZE+EZNTOrblsHJdvI6tHV ljJjSPT2nVjk+LQn7Az1kGJgEH2c7cbYar8QE+y+iYURALlFnPwpswdkXcmCWIQfXgxp 5exw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=mx0nkea3Pc2znNWWV5uhTHFyA/w1wmaaKMCyymR/Uhw=; b=faBGoJHIvpJd+DuN0YyOWUDncs6HIGNgeVHVxmY2Ug4/zFJUPFbbBUhIuIcx+rRPaK 4TikutZO8F+WS6EfZioyONlUYFOFdW0aKzhHdhWhunoKukq6my7QbZzqV8d9Cijhbg85 fhROWoKsAiZEX9kifKCGQQAS/49Ak/1ApIuTHi1g5Ehj7vcUe08xfj8bZb9ZITzPjJGj Ilmql2u7vU6n5RJ3oC3r/bTMepQsDwLOhfd5g1LYNcjYaffaDM1baKU8HxfOp0xM6HOw 79xnqKh6bmiKStbj6GKCTQYmqyw4zHgY9g29Cbb8Wrwno224g19U0jg+XLh1HWyB8EOJ RoqA== 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 q8si1502826edn.307.2020.05.27.04.41.32; Wed, 27 May 2020 04:41:56 -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 S2387772AbgE0KLy (ORCPT + 99 others); Wed, 27 May 2020 06:11:54 -0400 Received: from mail.thelounge.net ([91.118.73.15]:15931 "EHLO mail.thelounge.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387767AbgE0KLy (ORCPT ); Wed, 27 May 2020 06:11:54 -0400 Received: from srv-rhsoft.rhsoft.net (rh.vpn.thelounge.net [10.10.10.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) (Authenticated sender: h.reindl@thelounge.net) by mail.thelounge.net (THELOUNGE MTA) with ESMTPSA id 49X67X2KhczXSL; Wed, 27 May 2020 12:11:52 +0200 (CEST) Subject: Re: [PATCH] ext4: introduce EXT4_BG_WAS_TRIMMED to optimize trim To: Lukas Czerner Cc: Wang Shilong , linux-ext4@vger.kernel.org, Wang Shilong , Shuichi Ihara , Andreas Dilger References: <1590565130-23773-1-git-send-email-wangshilong1991@gmail.com> <20200527091938.647363ekmnz7av7y@work> <520b260b-13e9-4c62-eaeb-c44215b14089@thelounge.net> <20200527095751.7vt74n7grfre6wit@work> From: Reindl Harald Organization: the lounge interactive design Message-ID: <59df4f2f-f168-99a1-e929-82742693f8ee@thelounge.net> Date: Wed, 27 May 2020 12:11:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200527095751.7vt74n7grfre6wit@work> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Am 27.05.20 um 11:57 schrieb Lukas Czerner: > On Wed, May 27, 2020 at 11:32:02AM +0200, Reindl Harald wrote: >> >> >> Am 27.05.20 um 11:19 schrieb Lukas Czerner: >>> On Wed, May 27, 2020 at 04:38:50PM +0900, Wang Shilong wrote: >>>> From: Wang Shilong >>>> >>>> Currently WAS_TRIMMED flag is not persistent, whenever filesystem was >>>> remounted, fstrim need walk all block groups again, the problem with >>>> this is FSTRIM could be slow on very large LUN SSD based filesystem. >>>> >>>> To avoid this kind of problem, we introduce a block group flag >>>> EXT4_BG_WAS_TRIMMED, the side effect of this is we need introduce >>>> extra one block group dirty write after trimming block group. >> >> would that also fix the issue that *way too much* is trimmed all the >> time, no matter if it's a thin provisioned vmware disk or a phyiscal >> RAID10 with SSD > > no, the mechanism remains the same, but the proposal is to make it > pesisten across re-mounts. > >> >> no way of 315 MB deletes within 2 hours or so on a system with just 485M >> used > > The reason is that we're working on block group granularity. So if you > have almost free block group, and you free some blocks from it, the flag > gets freed and next time you run fstrim it'll trim all the free space in > the group. Then again if you free some blocks from the group, the flags > gets cleared again ... > > But I don't think this is a problem at all. Certainly not worth tracking > free/trimmed extents to solve it. it is a problem on a daily "fstrim -av" you trim gigabytes of alredy trimmed blocks which for example on a vmware thin provisioned vdisk makes it down to CBT (changed-block-tracking) so instead completly ignore that untouched space thanks to CBT it's considered as changed and verified in the follow up backup run which takes magnitutdes longer than needed without that behavior our daily backups would take 3 minutes instead 1 hour but without fstrim the backup grows with useless temp data over time