Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1980179ybh; Tue, 14 Jul 2020 12:11:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxq4lWk8D7UD7CW7yHk2jWf9ZWpBc/McjwH/JP+qv/sblnwoprN9oGLcrpMNXcK36r7lTg1 X-Received: by 2002:a17:906:46cd:: with SMTP id k13mr5855167ejs.312.1594753890056; Tue, 14 Jul 2020 12:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594753890; cv=none; d=google.com; s=arc-20160816; b=BKPMLXP8uR0OF8rEcsZyL7iu6jG0k5yTZp1V6/N1PJPES/G5rRCkd6FcVW12gh9gDC XdkkM9QD59V3bblVOdi5LadEzZBm2rj6mz3JC8scYWVw/ePH6DP0nRD3zh7rtdySYWfd NbiZKjKDsu/fR0tNdgYDEFrGZ/yqrJwW9h7ZHPwVQnIqbyF+GHKc5hdrd5Y1eKY2+GUX uSDPXcjhlchX/noFD05N1eB6fGRzf8r3XcwWvBmU+wD1pEOHhv+KBX2lfvHmaIi66pLX 2+6E6UA1iQeaK+qSJ1jcS7T8oFxAWBf2eArt3K9hGJUoRNvDYu69a9VbDZtjUo+DUvxO b9kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WcArS13+FuVWgZpBq2jD9+35A9Hbd1u8/3A+t12Vw84=; b=tEoKD4iL6wUIAleNvHZj8Aw5QLcC9jhzvNl2oI0XKPgCT525aw3nqyEQcGVD2LYAsU zOsA/sti24fz6Yi8fq4iwN/IFRdMgp23gMlWH8x1eG8ulLp6fG7qyi8kKFPQi08QGWgs jtHSWbeYAwcW79pWBLTPUAPgkxcu1zrB5C7ZwmWnF/CmhNlsHzfE7nfCJd2gexl1lxdQ l7P8JQYS134g+H7kjEMeIyi8uRxrOnUmEq04Z9hIOG711gQOqh/zmE6K2hxCITk5b+7r YfkGi2SAHmnB79OjwoA4deiBYL0lEUzdWMORNpXpwNfGBt4VRTvjlTANu3k97ii7AY9J NCPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=ib8dutrA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v15si13194859edl.205.2020.07.14.12.11.06; Tue, 14 Jul 2020 12:11:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=ib8dutrA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730574AbgGNTJB (ORCPT + 99 others); Tue, 14 Jul 2020 15:09:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730228AbgGNTIy (ORCPT ); Tue, 14 Jul 2020 15:08:54 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A9B1C08C5C1; Tue, 14 Jul 2020 12:08:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=WcArS13+FuVWgZpBq2jD9+35A9Hbd1u8/3A+t12Vw84=; b=ib8dutrASdxq5ixAa2izcpGDd8 E5vpjYNb9eM60YYK0LOg8AhUipNgP6uicqKfI0QWjHtLTK41cTGU94dQnEfFzRkgSizIPRX6jEP+s Hw5ez6AwNdcM1gEvNntnm63w7oq3csfsoFpRkRWxL5yqwxWJ3iJRXYQbf5rR/RAWuJGGCFhfXoMwT SPJKm4nFVE42oCfwCmXwODGnJLeeF4a9F6JJI/OHiVnKdYBdPNGhbQDaJ3xdji/uoYgzDRGo6BanF gHJwGZsTKBDgMVTm1igR4FmT5CexBsZnr3Hr4CB6oKyQDmubOvvbg3XFbdOC1Bq7yaDJLZRdD5F4d gkncjQ0Q==; Received: from [2001:4bb8:188:5f50:f037:8cfe:627e:7028] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvQIO-0005pN-He; Tue, 14 Jul 2020 19:08:52 +0000 From: Christoph Hellwig To: linux-kernel@vger.kernel.org Cc: "H. Peter Anvin" , Song Liu , Al Viro , Linus Torvalds , linux-raid@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 03/23] init: remove the bstat helper Date: Tue, 14 Jul 2020 21:04:07 +0200 Message-Id: <20200714190427.4332-4-hch@lst.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200714190427.4332-1-hch@lst.de> References: <20200714190427.4332-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The only caller of the bstat function becomes cleaner and simpler when open coding the function. Signed-off-by: Christoph Hellwig Acked-by: Song Liu --- init/do_mounts.h | 10 ---------- init/do_mounts_md.c | 8 ++++---- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/init/do_mounts.h b/init/do_mounts.h index 0bb0806de4ce2c..7513d1c14d13fe 100644 --- a/init/do_mounts.h +++ b/init/do_mounts.h @@ -20,16 +20,6 @@ static inline int create_dev(char *name, dev_t dev) return ksys_mknod(name, S_IFBLK|0600, new_encode_dev(dev)); } -static inline u32 bstat(char *name) -{ - struct kstat stat; - if (vfs_stat(name, &stat) != 0) - return 0; - if (!S_ISBLK(stat.mode)) - return 0; - return stat.rdev; -} - #ifdef CONFIG_BLK_DEV_RAM int __init rd_load_disk(int n); diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c index b84031528dd446..359363e85ccd0b 100644 --- a/init/do_mounts_md.c +++ b/init/do_mounts_md.c @@ -138,9 +138,9 @@ static void __init md_setup_drive(void) dev = MKDEV(MD_MAJOR, minor); create_dev(name, dev); for (i = 0; i < MD_SB_DISKS && devname != NULL; i++) { + struct kstat stat; char *p; char comp_name[64]; - u32 rdev; p = strchr(devname, ','); if (p) @@ -150,9 +150,9 @@ static void __init md_setup_drive(void) if (strncmp(devname, "/dev/", 5) == 0) devname += 5; snprintf(comp_name, 63, "/dev/%s", devname); - rdev = bstat(comp_name); - if (rdev) - dev = new_decode_dev(rdev); + if (vfs_stat(comp_name, &stat) == 0 && + S_ISBLK(stat.mode)) + dev = new_decode_dev(stat.rdev); if (!dev) { printk(KERN_WARNING "md: Unknown device name: %s\n", devname); break; -- 2.27.0