Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5829690rwr; Mon, 24 Apr 2023 09:30:44 -0700 (PDT) X-Google-Smtp-Source: AKy350YMqtY8PAlGgIR2tDslUrVi2DNbbvnXAuDLRKn7rfEsMpTGxEH+lV9fqePsNR1HK92uQpxZ X-Received: by 2002:a05:6a20:a123:b0:f2:5b9f:fe73 with SMTP id q35-20020a056a20a12300b000f25b9ffe73mr12542964pzk.28.1682353844582; Mon, 24 Apr 2023 09:30:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682353844; cv=none; d=google.com; s=arc-20160816; b=Fn5UKNcNIsNjpKFL1peVMRKZnqJZs34M/rM3SfuwDqBpHzDPCwUf6Ka1qEaVA6YH6M N+bxvAwNN8SDRM1YWDsG7nlHCf0FtuQ7vmPiqBIdh9wqEbTL1xsiYXw2tD64OFWGFVFp dEyrRHFCVtHfXeCYON739BR004HJtKtaXojtn6ihp7xLbxXlIzlj2P42HpDocBbHoBLZ NZ5wLDjABgb9/29okHNEy9nV6Dy8DeoOWyf1/cRCfacplaDRw9kdu+L6l7tDm49JYVOu jUjWTtBn/Wph9oq299Ia1yf3nObXY6GFptcxcCcb6pLR1uYdpXDOYl6p3t1gRi6BMBkH mPFg== 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=XIFqtj5gWVCy/HqqFdgfpfyyCQW7DaFAKwITl1QkuR4=; b=T57G+2a8pgS82KMrr3+3nBf80qByl8CyyFlQrk7ilcr6p4QTnGAaaQZ4LuqU6AiInc TYPz4NWKTnn9Qb2bgcRfVEQxCNFShMe4aiI0RHNo18OJZjSrAtS26qAuHucxY07hEId4 fr596jqdRxV60LMXAc6nDBeIMETgot+XSZW6wkqOWUwvzERYT7sGjYezCYzxAw98DnB3 aveAYKfYTWR1faXFR+EsDq6qw35dju9wlWsyh+a4KHtFKn3l/WTGYcig/evBM+3bUTrF rboXzP3F1ai+VuYZxwBDSQOxB5nua1GHbMZffLDOvDtPzSttyChOdEnbYDhspT5idFqC td/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=VOYamucX; dkim=neutral (no key) header.i=@suse.cz header.b=SKMV1crk; 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 f16-20020a63f110000000b00524da606617si8110907pgi.233.2023.04.24.09.30.26; Mon, 24 Apr 2023 09:30:44 -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=VOYamucX; dkim=neutral (no key) header.i=@suse.cz header.b=SKMV1crk; 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 S231137AbjDXQYS (ORCPT + 99 others); Mon, 24 Apr 2023 12:24:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230500AbjDXQYR (ORCPT ); Mon, 24 Apr 2023 12:24:17 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25B91E69; Mon, 24 Apr 2023 09:24:17 -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-out2.suse.de (Postfix) with ESMTPS id D6BE01FD93; Mon, 24 Apr 2023 16:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1682353455; 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=XIFqtj5gWVCy/HqqFdgfpfyyCQW7DaFAKwITl1QkuR4=; b=VOYamucX0CJArl2ahuhvzM9fXrWNkaKLzeVVSnDDCqFBvlcmJKanheYyk8g8FyFA4dACtZ HpCx7hdwoznSwbPjdbaxYRDfu4QPnnsargqUCwvp1O1GMA1MHKE0VD250HxvPXkoBput8M xhcG7FG2R2uhbagAKFEGZomgfbIGRGE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1682353455; 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=XIFqtj5gWVCy/HqqFdgfpfyyCQW7DaFAKwITl1QkuR4=; b=SKMV1crk5umBOeseM6cGEBBzSTkerVgIRJcoRySIKZudmJauOBmC6FFuIX9AOyfEO8J2QH iMp0FfxDZ8nYrhAA== 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 BC94413780; Mon, 24 Apr 2023 16:24:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mj0ELi+tRmRCCAAAMHmgww (envelope-from ); Mon, 24 Apr 2023 16:24:15 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id EFD9DA0729; Mon, 24 Apr 2023 18:24:13 +0200 (CEST) Date: Mon, 24 Apr 2023 18:24:13 +0200 From: Jan Kara To: Noah Goldstein Cc: linux-ext4@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] ext4: move `ext4_count_free` to ext4.h so it can be easily inlined Message-ID: <20230424162413.hiimozuw44fhht4a@quack3> References: <20230421014750.2315938-1-goldstein.w.n@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230421014750.2315938-1-goldstein.w.n@gmail.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 20-04-23 20:47:49, Noah Goldstein wrote: > `ext4_count_free` is a one-line helper that is clearly better off > being inlined. This saves a handful instructions in `vmlinux` on x86. > > Instruction estimates use `wc -l` on `objdump` > Before: 8539271 > After : 8539248 > > So saves roughly 20 instructions > > Signed-off-by: Noah Goldstein Looks fine. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/ext4/bitmap.c | 5 ----- > fs/ext4/ext4.h | 6 +++++- > 2 files changed, 5 insertions(+), 6 deletions(-) > > diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c > index f63e028c638c..c3cd2b878bbd 100644 > --- a/fs/ext4/bitmap.c > +++ b/fs/ext4/bitmap.c > @@ -11,11 +11,6 @@ > #include > #include "ext4.h" > > -unsigned int ext4_count_free(char *bitmap, unsigned int numchars) > -{ > - return numchars * BITS_PER_BYTE - memweight(bitmap, numchars); > -} > - > int ext4_inode_bitmap_csum_verify(struct super_block *sb, ext4_group_t group, > struct ext4_group_desc *gdp, > struct buffer_head *bh, int sz) > diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h > index 08b29c289da4..6e1d3c175a70 100644 > --- a/fs/ext4/ext4.h > +++ b/fs/ext4/ext4.h > @@ -2675,7 +2675,11 @@ struct mmpd_data { > # define NORET_AND noreturn, > > /* bitmap.c */ > -extern unsigned int ext4_count_free(char *bitmap, unsigned numchars); > +static inline unsigned int ext4_count_free(char *bitmap, unsigned int numchars) > +{ > + return numchars * BITS_PER_BYTE - memweight(bitmap, numchars); > +} > + > void ext4_inode_bitmap_csum_set(struct super_block *sb, ext4_group_t group, > struct ext4_group_desc *gdp, > struct buffer_head *bh, int sz); > -- > 2.34.1 > -- Jan Kara SUSE Labs, CR