Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2098551ybh; Fri, 24 Jul 2020 04:29:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBbHPN+78xwkLArXLz+gtQUNAgfX9YejGVnr+Hfc6riBLPXEfnCrqd6R6hkoXkeosQgl8x X-Received: by 2002:aa7:ce91:: with SMTP id y17mr8599119edv.105.1595590180042; Fri, 24 Jul 2020 04:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595590180; cv=none; d=google.com; s=arc-20160816; b=x1OAvaAaI3BLPgDupDKmu8iigZJk0cPfXqn5nvcF1CQzq3uIwUp6ipcCDskKWE7GG8 UmWwGYHgMTQ+J3Skc/goCb27yWaOlQGon3Y//HABNQG6Y+PE7izyIzCOtltcW3/HUOfb yzEN/SUfor/vpQgvnJRfVsCg2X61vDEnYiKkJZ0gW7EQbnzAAqavHBWyziFGz14/wj/D KVDoZpTNjk+Le6N1AD64R+ZVVOCCcL7ygLVwkNmRDTbgUJGz8WPVRKjEC60YSBApFW61 SpksPEr7KlLof66rLsCcO90QlDlh6XoZG59lUYphjka6TXFxO8gDo7Zd3dPrr7D2G+E7 6YBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=8HeVgGPueNBRRDpahYDN/80YdB4Ni14xuwuUIzLd78g=; b=fiSb5XTsHZVQLhlI0xpxTbNz3v1nRIa20A+TRrSuycEJJ5ShCSzwoYfWig43+xe0ua X0gyU1S79zifBwdhntiu0iT3I3aF51NNiRiXM7i2Wkyh0YyzYa6NxZ+7U8Gruepz5Vvs eOYPIB4fcX55kl0g/u4ONHKzrdu1+1A+3OiLzMFWfJtqu1vNSLEyKipXQH5K+X3IpNfa 44osZgbsu8CWgQ8pgHm4AXKNrUhu+PsXTzmrAH0ruuMoDFYaJw08oIrzZXJkp4Lzdqxe OFRn3mm2S8wmkCXLCywCN7Gyx9QOEPPS2qyv4WdZRnVgJUIn3SYJnx6fGUWVcPEenMSr FVYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jEfmKM4p; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u10si305312edo.324.2020.07.24.04.29.07; Fri, 24 Jul 2020 04:29:40 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jEfmKM4p; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726280AbgGXL14 (ORCPT + 99 others); Fri, 24 Jul 2020 07:27:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726182AbgGXL1z (ORCPT ); Fri, 24 Jul 2020 07:27:55 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB117C0619D3 for ; Fri, 24 Jul 2020 04:27:53 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id q6so9605312ljp.4 for ; Fri, 24 Jul 2020 04:27:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=8HeVgGPueNBRRDpahYDN/80YdB4Ni14xuwuUIzLd78g=; b=jEfmKM4pU3jtbTxZGT+c8ZMmxrH3aso/dXfPd/YFYjxL6ebVYWfowrb8P0+/YYDDcz rOMyTxIurh1mXNV7lsgIodbw/Akn+Fk5FaTHne2CydV0lXAmuH71zCJOk2AGqt89R4oP bdlCibOEiYOJctRI2R0avb0c3C5iDoZiem9QRBXeV7+VcV70QTW+OIIwv3GgoutDPDI7 3nQ245PRQ5AaYUpfTbFeMk0j9sz0DHZyHOiStA7q23H3hZHRJ5mliwCpqvQhfA71Kb/L CnsHRhtnEUtljks8AUayflMRr6g6K4Ri0UnQ4s+VamrKlahvmZRxafOustYx54wGMa+T lnbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=8HeVgGPueNBRRDpahYDN/80YdB4Ni14xuwuUIzLd78g=; b=sdeUVQfzmmb0dRQry0jGcd2pTIB6AO32Yo4VOTnESaPNP+pXc6j9+mXjb4hTY/WDb7 ER57ERqL5u7AxMtu61Jw6scNTVSJM7ORrAhmh1EXYBzjaAILodFQXTuQmAJH7JLaHB8j /WMPNiehxTfoux8ik7gPvKs8gAXUqgiOGnR0a4dJJV37dpYkcYG+25OTrjygxiHJo4rk wdrCzxm/EFDy8ECZrRYxXAwp48oKCfjsNWu4xDsLfYdfosaIc6jUXU8DL2ZFax43FtwI U2zwpcmEEb34MvJLmC9J6qEopqs+89hpo6QHwBkCAmOYCaeB4DMVobQGOXVhFi+ooC9w x83g== X-Gm-Message-State: AOAM530r1KOT5u8oTZ8lbIn0fzXqQ3RwiYoMyy8Gb2xVyyoVez7unAWi SWogDozpTxgvoZQT214mlSU= X-Received: by 2002:a05:651c:1291:: with SMTP id 17mr4471491ljc.286.1595590072273; Fri, 24 Jul 2020 04:27:52 -0700 (PDT) Received: from [192.168.1.192] ([195.245.244.36]) by smtp.gmail.com with ESMTPSA id b16sm178890ljp.124.2020.07.24.04.27.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2020 04:27:51 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.15\)) Subject: Re: [PATCH 2/4] ext4: skip non-loaded groups at cr=0/1 when scanning for good groups From: =?utf-8?B?0JHQu9Cw0LPQvtC00LDRgNC10L3QutC+INCQ0YDRgtGR0Lw=?= In-Reply-To: <20200717155352.1053040-3-tytso@mit.edu> Date: Fri, 24 Jul 2020 14:27:48 +0300 Cc: Ext4 Developers List , Alex Zhuravlev , Alex Zhuravlev , Andreas Dilger Content-Transfer-Encoding: quoted-printable Message-Id: <81448013-525F-4C51-A9F3-88969CB49B70@gmail.com> References: <20200717155352.1053040-1-tytso@mit.edu> <20200717155352.1053040-3-tytso@mit.edu> To: Theodore Ts'o X-Mailer: Apple Mail (2.3445.104.15) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Looks good. Reviewed-by: Artem Blagodarenko > On 17 Jul 2020, at 18:53, Theodore Ts'o wrote: >=20 > From: Alex Zhuravlev >=20 > cr=3D0 is supposed to be an optimization to save CPU cycles, but if > buddy data (in memory) is not initialized then all this makes no sense > as we have to do sync IO taking a lot of cycles. also, at cr=3D0 > mballoc doesn't store any avaibale chunk. cr=3D1 also skips groups = using > heuristic based on avg. fragment size. it's more useful to skip such > groups and switch to cr=3D2 where groups will be scanned for available > chunks. >=20 > using sparse image and dm-slow virtual device of 120TB was > simulated. then the image was formatted and filled using debugfs to > mark ~85% of available space as busy. mount process w/o the patch > couldn't complete in half an hour (according to vmstat it would take > ~10-11 hours). With the patch applied mount took ~20 seconds. >=20 > Lustre-bug-id: https://jira.whamcloud.com/browse/LU-12988 > Signed-off-by: Alex Zhuravlev > Reviewed-by: Andreas Dilger > --- > fs/ext4/mballoc.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) >=20 > diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c > index 8a1e6e03c088..172994349bf6 100644 > --- a/fs/ext4/mballoc.c > +++ b/fs/ext4/mballoc.c > @@ -2195,7 +2195,18 @@ static int ext4_mb_good_group_nolock(struct = ext4_allocation_context *ac, >=20 > /* We only do this if the grp has never been initialized */ > if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) { > - ret =3D ext4_mb_init_group(ac->ac_sb, group, GFP_NOFS); > + struct ext4_group_desc *gdp =3D ext4_get_group_desc(sb, = group, > + NULL); > + int ret; > + > + /* cr=3D0/1 is a very optimistic search to find large > + * good chunks almost for free. if buddy data is > + * not ready, then this optimization makes no sense */ > + if (cr < 2 && > + !(ext4_has_group_desc_csum(sb) && > + (gdp->bg_flags & = cpu_to_le16(EXT4_BG_BLOCK_UNINIT)))) > + return 0; > + ret =3D ext4_mb_init_group(sb, group, GFP_NOFS); > if (ret) > return ret; > } > --=20 > 2.24.1 >=20