From patchwork Wed May 31 12:55:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 687601 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B2A1C77B7A for ; Wed, 31 May 2023 13:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236256AbjEaNAf (ORCPT ); Wed, 31 May 2023 09:00:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236283AbjEaNAI (ORCPT ); Wed, 31 May 2023 09:00:08 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 916CDE73; Wed, 31 May 2023 05:59:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=9vvI1AUorLQX7yuH8SxiM1nPFtzNxSoz91Bb7WO0EOA=; b=v46e4CgcdUsuY4CDwDmGm5EKg6 3bGlULuSfKZKIBYkIgIzxLRHtiYCtTzVfTBMmhf+TyhbwwYbiqbKd0tMfSc1soLSBfLKGiPJZyDIM 1VSHGnLv8rwHfUzF3+go/i1m4W7T37ihfXNILXRjjy0m9SVCIVW/WCrDxkCqrqwSyzkHw2lkzfdJ1 pyVNvrXRGVIwewOVBbfOYrWrhjclD7+jVGCUCulRURX4eCKcfhlA1ZAbXRpHsLILAGMnEfU2+YCaW Nkwg8kJdJgzuVCEPzDqt/uoqIF35X0DIsOnylhabB/yJQtpImjZeeCc+z8C9VIJ6or8zbwnWYt424 QAz8yI9A==; Received: from [2001:4bb8:182:6d06:2e49:a56:513a:92ee] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1q4LOV-00HSJ1-14; Wed, 31 May 2023 12:57:40 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Mike Snitzer , Joern Engel , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Pavel Machek , Loic Poulain , dm-devel@redhat.com, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-mtd@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH 24/24] block: mark early_lookup_bdev as __init Date: Wed, 31 May 2023 14:55:35 +0200 Message-Id: <20230531125535.676098-25-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230531125535.676098-1-hch@lst.de> References: <20230531125535.676098-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org early_lookup_bdev is now only used during the early boot code as it should, so mark it __init to not waste run time memory on it. Signed-off-by: Christoph Hellwig --- block/early-lookup.c | 19 +++++++++---------- include/linux/blkdev.h | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/block/early-lookup.c b/block/early-lookup.c index 6016e781b6a0e2..3ff0d2e4dcbfb8 100644 --- a/block/early-lookup.c +++ b/block/early-lookup.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Code for looking up block devices in the early boot code before mounting the - * root file system. Unfortunately currently also abused in a few other places. + * root file system. */ #include #include @@ -18,7 +18,7 @@ struct uuidcmp { * * Returns 1 if the device matches, and 0 otherwise. */ -static int match_dev_by_uuid(struct device *dev, const void *data) +static int __init match_dev_by_uuid(struct device *dev, const void *data) { struct block_device *bdev = dev_to_bdev(dev); const struct uuidcmp *cmp = data; @@ -42,7 +42,7 @@ static int match_dev_by_uuid(struct device *dev, const void *data) * * Returns the matching dev_t on success or 0 on failure. */ -static int devt_from_partuuid(const char *uuid_str, dev_t *devt) +static int __init devt_from_partuuid(const char *uuid_str, dev_t *devt) { struct uuidcmp cmp; struct device *dev = NULL; @@ -98,7 +98,7 @@ static int devt_from_partuuid(const char *uuid_str, dev_t *devt) * * Returns 1 if the device matches, and 0 otherwise. */ -static int match_dev_by_label(struct device *dev, const void *data) +static int __init match_dev_by_label(struct device *dev, const void *data) { struct block_device *bdev = dev_to_bdev(dev); const char *label = data; @@ -108,7 +108,7 @@ static int match_dev_by_label(struct device *dev, const void *data) return 1; } -static int devt_from_partlabel(const char *label, dev_t *devt) +static int __init devt_from_partlabel(const char *label, dev_t *devt) { struct device *dev; @@ -120,7 +120,7 @@ static int devt_from_partlabel(const char *label, dev_t *devt) return 0; } -static dev_t blk_lookup_devt(const char *name, int partno) +static dev_t __init blk_lookup_devt(const char *name, int partno) { dev_t devt = MKDEV(0, 0); struct class_dev_iter iter; @@ -149,7 +149,7 @@ static dev_t blk_lookup_devt(const char *name, int partno) return devt; } -static int devt_from_devname(const char *name, dev_t *devt) +static int __init devt_from_devname(const char *name, dev_t *devt) { int part; char s[32]; @@ -193,7 +193,7 @@ static int devt_from_devname(const char *name, dev_t *devt) return -EINVAL; } -static int devt_from_devnum(const char *name, dev_t *devt) +static int __init devt_from_devnum(const char *name, dev_t *devt) { unsigned maj, min, offset; char *p, dummy; @@ -240,7 +240,7 @@ static int devt_from_devnum(const char *name, dev_t *devt) * name contains slashes, the device name has them replaced with * bangs. */ -int early_lookup_bdev(const char *name, dev_t *devt) +int __init early_lookup_bdev(const char *name, dev_t *devt) { if (strncmp(name, "PARTUUID=", 9) == 0) return devt_from_partuuid(name + 9, devt); @@ -250,7 +250,6 @@ int early_lookup_bdev(const char *name, dev_t *devt) return devt_from_devname(name + 5, devt); return devt_from_devnum(name, devt); } -EXPORT_SYMBOL_GPL(early_lookup_bdev); static char __init *bdevt_str(dev_t devt, char *buf) { diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 0ce09ecfa3a7af..ca84a135ddc80f 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1494,7 +1494,7 @@ int sync_blockdev_nowait(struct block_device *bdev); void sync_bdevs(bool wait); void bdev_statx_dioalign(struct inode *inode, struct kstat *stat); void printk_all_partitions(void); -int early_lookup_bdev(const char *pathname, dev_t *dev); +int __init early_lookup_bdev(const char *pathname, dev_t *dev); #else static inline void invalidate_bdev(struct block_device *bdev) {