From patchwork Fri Apr 21 01:47:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Goldstein X-Patchwork-Id: 86101 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp755978vqo; Thu, 20 Apr 2023 19:04:38 -0700 (PDT) X-Google-Smtp-Source: AKy350ZWHAadCBofoc32amjIEdpU5Vrp4nr/ywhWODNsjGmP+kgKS/Y7Lt4l6vnXP3jc4Dp+2ODG X-Received: by 2002:a17:902:f693:b0:1a2:58f1:5e1d with SMTP id l19-20020a170902f69300b001a258f15e1dmr4363002plg.36.1682042678111; Thu, 20 Apr 2023 19:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682042678; cv=none; d=google.com; s=arc-20160816; b=nFRB0XugY70CDkSYLKMNWuCdkQq9e4c7p9XBBF3hjlU0mwy/IgeJ8Zd0jRClUkr6E4 4pqcryPfUno9BQjWEEPxOGGCWvUP0j5h3ZwScMJtdn8epHCaP31V157XyQ85558n8VJQ UBRBFGF/Ea1MlsXvUYBL3hBiRHCnDr4xPxYs7Ab812UKMLrP/uatF3MRLKLYwhYlYa8Y XoHCKyVkfhvruM63n/dmsy6U8nhF0VUdOhwlbm9n9XPqEJZZb3X3cOME5O75UdC2BOp3 y1R4O6NBgJ2WKSkflpItLcPGMNFHwAQzZ1MsIBSgv78Rltkn38rdfKx1U0F6s3WaiUCL r4AQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n11-20020a170902d2cb00b0019f3064da41si3406939plc.383.2023.04.20.19.04.22; Thu, 20 Apr 2023 19:04:38 -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 S233278AbjDUBsF (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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763749583239180399?= X-GMAIL-MSGID: =?utf-8?q?1763749583239180399?= `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 Reviewed-by: Jan Kara --- 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);