Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2299032pxt; Sun, 8 Aug 2021 18:57:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGFSBHbCzSD11FsaSLm9FmztrPXorwo/0E/8NSuLUdWlOqk3vncZpVc1iONF352fmfWOR2 X-Received: by 2002:a5e:974b:: with SMTP id h11mr952670ioq.135.1628474234979; Sun, 08 Aug 2021 18:57:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628474234; cv=none; d=google.com; s=arc-20160816; b=guCahfey58rvcYN/VA/pqMxaBBF9Pow3SxOTyc/gwDxV9ULoAgi6AeKndvR5KXVuJQ 098Dz7xaX80wWB7AIIIs/BUtcDqLj+10V2rVunPiikUY7pzlrryS8mccnC2Do4ezb1uM hUnE9nARtlMCBtjCFlLn4szYAZAWEAwL9xJua5VrPuD59T0YFYOS5okeM2aGc2YpiJjj wrDUTXYJGUxvSaiXo9hIoPgXhakGrsP3/7K/3gIHKzBaRKkhfZdLUrqsDlCoAtM2iSQR q+u02IHKEauDjSlzhceF1Xrlqs3Apt3QLnvUZ1RgsgiB44rc1aXQyIOHGvQK/YCm8Kt9 kLeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=1/SqEdVcqKwRbzA57HOA+GUZ/QoDMkzaWXxxA9PmuWE=; b=JMWsiJWMYZ+nDJpB5/L6bSDqyWtwIXcai6nbV6clV4N9+k7Y3XGFRXyzKRBSNJObSF gGe9PR/QiIh3cwPmzjZitkofCf7flBx6Rl1iKsFF0C1N3ArOFBnXBR1NfTYLC68xThOh HMujez+JLwUUuGO9al1AVnun5hkfpQ5iAsSqjaL3p3DIqCE63keb/DYoRzzjkyFUlZQ6 j+eiQKbIQVyGdosHbf6oAz9WOJvF1hQT3hPisxZj5AtAFfxQIx9JdX7SL8OZibLbeuo8 ovFe5sldqy8F2FRH4+bruJYpmRwFlwZayhQ4ETZHdsqR8RNWAamh9yUXtRNweMYGjSn6 uF8A== 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 h15si16129695ile.62.2021.08.08.18.56.55; Sun, 08 Aug 2021 18:57:14 -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 S231324AbhHIBv4 (ORCPT + 99 others); Sun, 8 Aug 2021 21:51:56 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:51939 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230076AbhHIBvz (ORCPT ); Sun, 8 Aug 2021 21:51:55 -0400 Received: from cwcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 1791pNjW019581 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 8 Aug 2021 21:51:24 -0400 Received: by cwcc.thunk.org (Postfix, from userid 15806) id B2A7715C3E25; Sun, 8 Aug 2021 21:51:23 -0400 (EDT) Date: Sun, 8 Aug 2021 21:51:23 -0400 From: "Theodore Ts'o" To: ValdikSS Cc: linux-ext4@vger.kernel.org Subject: Re: ext4lazyinit reads HDD data on mount since 5.13 Message-ID: References: <015c7506-7f33-3967-772a-1285b0f1052f@valdikss.org.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <015c7506-7f33-3967-772a-1285b0f1052f@valdikss.org.ru> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Aug 09, 2021 at 01:13:03AM +0300, ValdikSS wrote: > Hello, > After updating to kernel 5.13, my ext4 partition is read for ~20 seconds > upon mounting by ext4lazyinit. It does not write anything, only reads > (inspected with iotop), and it does so only on mount and only for relatively > short amount of time. > > My partition is several years old and have been fully initialized long ago. > Mounting with `init_itable=0` did not change anything: ext4lazyinit does not > write anything to begin with. > > 5.12.15 does not have such behavior. Did I miss a configuration change? Is > that a regression or a new feature? It's a new feature which optimizes block allocations for very large file systems. The work being done by ext4lazyinit is to read the block allocation bitmaps so we can cache the buddy bitmaps and how fragmented (or not) various block groups are, which is used to optimize the block allocator. Quoting from the commit description for 196e402adf2e: With this patchset, following experiment was performed: Created a highly fragmented disk of size 65TB. The disk had no contiguous 2M regions. Following command was run consecutively for 3 times: time dd if=/dev/urandom of=file bs=2M count=10 Here are the results with and without cr 0/1 optimizations introduced in this patch: |---------+------------------------------+---------------------------| | | Without CR 0/1 Optimizations | With CR 0/1 Optimizations | |---------+------------------------------+---------------------------| | 1st run | 5m1.871s | 2m47.642s | | 2nd run | 2m28.390s | 0m0.611s | | 3rd run | 2m26.530s | 0m1.255s | |---------+------------------------------+---------------------------| The timings are done with a freshly mounted file system; the prefetched block bitmaps plus the mballoc optimizations more than doubles the time to allocate a 20 MiB file on a highly fragmented file system. Cheers, - Ted