Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp20796682rwd; Thu, 29 Jun 2023 07:10:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4+12ar6RWQS5x3L/+2aydO5G6SdjQseDZTzXUCOi5E93I9l1mGxh2tOWT3FhtytvXAa2O/ X-Received: by 2002:a17:903:244d:b0:1b7:dfbd:4df0 with SMTP id l13-20020a170903244d00b001b7dfbd4df0mr13948816pls.45.1688047840730; Thu, 29 Jun 2023 07:10:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688047840; cv=none; d=google.com; s=arc-20160816; b=ngQW9EHCyitpNoM68QMqG339uGVSnNC/K2X68CKNYyTJUIqZjubJpXhuPc56U5mcQv 5SA5uEu1B3rtjI7UUQEsLAAjSfkdJtahuQtpjrPaJNbuA7SIswrwsvut+zbSX9b7CHim hKekzfCxNjvtvqDEB5JIKD6jNnp56l0ZMBp0SfFvIji7xSCJ20uefigRz861LJBUIWzu Ts3A/hKQ1vEAt5EenJDAt8ih8/4RIbKWEvx1mqVxqqPqORavVBV2M2g7zDG73mkglvug h+6TdgQAdLDhkWZQOzBuhmRfN2a2/a/XvshqjtXSlrn0kIw+9nT7o0HKMGNb2wNAKmd8 DX/g== 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:dkim-signature :dkim-signature; bh=3XvzUQu801FzKs3iHBW/hsxqJwuXABN8gyB4Y3gdE7o=; fh=ize+VmTKD+MepwShPyY8ndKy8HZ84iAf9p8FnOHJS9A=; b=NAd4/MLL04pchuggR2Dnm93Hzh7JwT0REZDCMosj5GU2woUAGfNZhkvFnK4BgUL2O4 mSOf8oMeorUyqY/ngVHxxOtnvkuzUYCuje4hOk/pIVMF6EPy7GdMh/OfTI9yCfQpdGRB pjuiCciCPz7QMFEzU2KGlk0lbdRzwRUo4xDn+sIfO+Utwf+UMDKplJaXILdKGoy2cvnf Nyi/4jKUH/YhUuvR9guv8Wu8ydp9KWH4aohQ1ij4F2+b8aXrmZlooOOx6YlLPO8lXDSf RASZU0lzPgdgTsDQP4jSha5fHSSugEP7PG2SXYA1ghLjR+qygJR3YVAyIq3kBp7JJf6c qq2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ppZd0acw; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d17-20020a170902e15100b001ac5896c746si3592143pla.329.2023.06.29.07.10.07; Thu, 29 Jun 2023 07:10:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ppZd0acw; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231208AbjF2OAX (ORCPT + 99 others); Thu, 29 Jun 2023 10:00:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230284AbjF2OAW (ORCPT ); Thu, 29 Jun 2023 10:00:22 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1EBE19B5; Thu, 29 Jun 2023 07:00:20 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 667F721836; Thu, 29 Jun 2023 14:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1688047219; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3XvzUQu801FzKs3iHBW/hsxqJwuXABN8gyB4Y3gdE7o=; b=ppZd0acwCMJhuiNjBA5IXPFF7rbhySCTrty7M/XTzecktoCJmNfc7k5k8PcFvgpicaXH2M NGnLwA7kEvKl9Q3OhWDYOh0zqSkKBGZjXcTgCW0usXlPtudZncoH2Uu8voxtAsTxin04TU 8uezYNtjJxzVsfOcU4kklvp9qkHpYFk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1688047219; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3XvzUQu801FzKs3iHBW/hsxqJwuXABN8gyB4Y3gdE7o=; b=Lidt5ltBK3XiQ+0j4+ksxbTNrvY3zSJfovpUuD/y8/54xO/2/8B9RvS/NSGoj3C2aN71zC X1XnggrnvIE/08CQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5772A13905; Thu, 29 Jun 2023 14:00:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8IJNFXOOnWQ/CQAAMHmgww (envelope-from ); Thu, 29 Jun 2023 14:00:19 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id E5210A0722; Thu, 29 Jun 2023 16:00:18 +0200 (CEST) Date: Thu, 29 Jun 2023 16:00:18 +0200 From: Jan Kara To: Ojaswin Mujoo Cc: linux-ext4@vger.kernel.org, Theodore Ts'o , Ritesh Harjani , linux-kernel@vger.kernel.org, Jan Kara , Kemeng Shi Subject: Re: [PATCH] ext4: Replace CR_FAST macro with inline function for readability Message-ID: <20230629140018.duaaxqnxe55yfvqq@quack3> References: <20230629134719.108104-1-ojaswin@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230629134719.108104-1-ojaswin@linux.ibm.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu 29-06-23 19:17:19, Ojaswin Mujoo wrote: > Replace CR_FAST with ext4_mb_cr_expensive() inline function for better > readability. This function returns true if the criteria is one of the > expensive/slower ones where lots of disk IO/prefetching is acceptable. > > No functional changes are intended in this patch. > > Signed-off-by: Ojaswin Mujoo Thanks for this cleanup! Feel free to add: Reviewed-by: Jan Kara Just one suggestion for consideration below: > @@ -2630,7 +2630,7 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac, > free = grp->bb_free; > if (free == 0) > goto out; > - if (cr <= CR_FAST && free < ac->ac_g_ex.fe_len) > + if (cr <= CR_GOAL_LEN_SLOW && free < ac->ac_g_ex.fe_len) Maybe this could be (!ext4_mb_cr_expensive(cr) || cr == CR_GOAL_LEN_SLOW)? Or maybe more explanatory would be (cr < CR_ANY_FREE) because AFAIU that's the only scan where we bother scanning groups that have no chance of satisfying the full allocation? Anyway a short comment explaining this might be useful. And in either case we can get rid of a bit confusing CR_FAST define. Honza -- Jan Kara SUSE Labs, CR