Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1611048rwr; Thu, 20 Apr 2023 18:49:36 -0700 (PDT) X-Google-Smtp-Source: AKy350bkVzLSI5V8Cowiv+P9hUiMgTRaPdmGwcB5CNFT0MkvYBRX1IRNeXT8jt7AAOAx+x8Jchh9 X-Received: by 2002:a17:903:41d2:b0:1a9:2f0f:6780 with SMTP id u18-20020a17090341d200b001a92f0f6780mr3947213ple.14.1682041776027; Thu, 20 Apr 2023 18:49:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682041776; cv=none; d=google.com; s=arc-20160816; b=HdjRJW3qWHbvFkwgIKyedZ04+dzH4YKuif5/LEbKovjww8qYX6nf/1txqiQ5OCYMxx FMjh9fcB5frTJpaQjBYAIQQRE5aiMm7GwdQgqBr2/yr3+M6TkxnFRueqKs+tdqnkxr+E 64C+IZ5c/9ubdvPfKdV7TmA509Mj3ASi5lFpEoKwM3hFlx5SOeIjmt1TU31U3AVDAVhe T6A1UCEekO3ETB3iHQBh8rgzjTzu9rzNkSZhV4q//SYmz0pdNhMukFb6rx9YBEb3dx32 q49I0bavRg+/RmNC424Eu6+JNMHGSyDjBIyHDfi2KaaL9FL6bPbz1Wiz1oHWEUR6JgNk kDlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=eDYwHq82vKxTxcR5vuod/O4FBcL/Rgh8EGKnuklb1g4=; b=iijep/kWEKNweWB1NgyO2tuG9zySbs0DiJWB4k/mmR0yvHVDprvXGB+cS8BjFhK+ze z5wfiCgvY1TkPwbvc6GV6swqIQsXltlsGVR482vQtG4ymtpFdZrWSjWBDIdDzH4UIK4c R1OkF6f4m5RIB54ucj7rwEi0QYdTrPKXAyYMr5nV3lyulTwM6Ae8nNNNx35nmuBJuEKa +OZwH1QHDU/PLzROjkYqjE55VRQkvTPF8omNrfjd9Y4QkZwnxm+D8Vj3Dfnwlk1KqDvX naBmRhVL5C0Cy4Xh1kJiWYaBeO2SkS0PyAmvM5gubnYgc3HGIdJj8Un37TY2DtNX5ZA+ DgCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=R40+Jy8S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a17090301c600b001a1e0fd406csi3620331plh.217.2023.04.20.18.49.24; Thu, 20 Apr 2023 18:49:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@gmail.com header.s=20221208 header.b=R40+Jy8S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S233260AbjDUBsF (ORCPT + 99 others); Thu, 20 Apr 2023 21:48:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233247AbjDUBsE (ORCPT ); Thu, 20 Apr 2023 21:48:04 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E0CD4C06; Thu, 20 Apr 2023 18:47:58 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-94f6c285d92so167294966b.3; Thu, 20 Apr 2023 18:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682041676; x=1684633676; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=eDYwHq82vKxTxcR5vuod/O4FBcL/Rgh8EGKnuklb1g4=; b=R40+Jy8SDgI3HrxPyBTBVOGaQ2VHSsvgrrxK7ynsRm2caaOVXl4Dm5aFqLDhXZ0uF8 v2kh/jcbjBqnxJRhmcqg0646lUmIJi/6NTySnm3BfC0Yi4xGVRtwARF6crfOiXQf2/8W FN0gVnMa2TYmlWHrwABnmnQvfx0YYoz2jrd8FDb1dgyBcvl2Odrt3L//KSZz11o6rsXS UVJAschNdkZQx7P4LJk9PaeQrbUwlrvBsHK9V2uJcPbEFFLg+TtzfsTCCHBNgttE+lvN wEhShnQFfwwZXceuy8LmYTZU73RaAASTy5L59mnRJys2IH2FM3J/gIWsXQeBn63fliLn +rDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682041676; x=1684633676; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=eDYwHq82vKxTxcR5vuod/O4FBcL/Rgh8EGKnuklb1g4=; b=T9Fqt4QBC6mXEevtGVtqYPz1cXwqE1XfVn64bmwM6b+q2hzU0f1bIa1QmUYupTw1+p jtm7B3pCK6JU9oRJulh4Smpe9691Xu9lbrZJcrH2UX9kOSTvHC1LPLjs5hQWzEoiHVvd si1zIJybK0qOikf37dH5mcg1PF7W1DGYNPJPG9ungodQ25RYAXjwvnDd8K5azJuIOckn SOYjx1DKaldeb+7++6Sq5uIaQsYCXLjqnuEFniETWD8nkNwE0owLW7Uhnvv3EXx6w/wq +DSNDeOAHbQ3sPu5VsfQZRcFz2XyYESX/BqnYL37anpSBJwcIHowtvl+UAzoxwSHdD14 AUrw== X-Gm-Message-State: AAQBX9cIyJ8SMqOmeyYXMmVdMyq2bPDpl9/fEYPDEe8+M4YWKIarS2qJ +CvnFjK1RdHvDBEstmD2La6iPJsHlqc= X-Received: by 2002:a17:907:3c11:b0:88a:1ea9:a5ea with SMTP id gh17-20020a1709073c1100b0088a1ea9a5eamr629559ejc.65.1682041676309; Thu, 20 Apr 2023 18:47:56 -0700 (PDT) Received: from noahgold-desk.intel.com ([2600:1010:b044:5553:d1a3:a9c6:1560:d322]) by smtp.gmail.com with ESMTPSA id z26-20020a170906715a00b0094f0237c32bsm1360932ejj.208.2023.04.20.18.47.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 18:47:56 -0700 (PDT) From: Noah Goldstein To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, adilger.kernel@dilger.ca, linux-kernel@vger.kernel.org, Noah Goldstein Subject: [PATCH v1] ext4: move `ext4_count_free` to ext4.h so it can be easily inlined Date: Thu, 20 Apr 2023 20:47:49 -0500 Message-Id: <20230421014750.2315938-1-goldstein.w.n@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-kernel@vger.kernel.org `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 --- 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