From patchwork Wed May 31 12:55:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 101441 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2860069vqr; Wed, 31 May 2023 06:02:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5F/BjprXYnRaSg2RvZbfbgKRC+6rlgpGi7TGDvWtpd5zGcARK+5AgOSyhjQZDsCKz5ytIP X-Received: by 2002:a17:902:d883:b0:1b0:113e:1047 with SMTP id b3-20020a170902d88300b001b0113e1047mr3999507plz.62.1685538128141; Wed, 31 May 2023 06:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685538128; cv=none; d=google.com; s=arc-20160816; b=DVeS/GConun9stDEuDteqxqEbSXNtFUYG2YSoJsfxDG92DiJRm1cZMsVXigcRLvuGj b7GQXI0JAkqGquZgmJeoaBI8lj7CAWhJMTFKb5QqU1txWiH6DEBUeohb+em6HHBIX2bu hZLz5jDiH/OnCnYfy8DiLOwQgBCIvgytSqekGAu2UVgfAzeXKRc9P4VSCVWGtRWNWAiQ nERNTQuPxY1T6iFn57SwpnoGQh3lfB1DwBCisSB6BQIv7urU08MSrk1Z4pDleeKGgyhk 7UmDZfane8cQ/1iBTZFlRuMrzFzhvOBMjAH03LZ9nfyCgft9KtOCYL3mNNTncJJXrfXY jsvg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Eb3aGI6n4ytEG8s7b8hrZ+gUQ6cXP36Kx70RBR7HPKY=; b=xsXscr0FN5ggvE/4zVvSoXbBrpfcf8Y81Y1U0jbONQi9lMvu3hxbrf3enWyRUyLfcz 5BEugsc+6+ljf1GWW3YCOIHbgCoIQeyY+l0284FndMJjthSkac08al8AaUrNJ+DEKLWE /p6QCuJ5fdW96ayTlUCm0FZ8vUB66EHJH6/LbZW5yGNoViSoywExeTip2UXkYa3PbYvG 0sXPeeTO/lAPR7gWKfPHTMvRtLTc3exDN/yNNIkGOxL1/A2Z5UJpFXqF8ZK3murPrJZs 3dgXHwbxpMp3aKo3vWEygmhjgKqCRNxeX0UcNRGfV0eLiknbcC1j/S18m1kZOuehh1i2 2goQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=c3P5AWBv; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iw10-20020a170903044a00b001affb5906aasi135312plb.4.2023.05.31.06.01.52; Wed, 31 May 2023 06:02:08 -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=@infradead.org header.s=bombadil.20210309 header.b=c3P5AWBv; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232008AbjEaM7I (ORCPT + 99 others); Wed, 31 May 2023 08:59:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236175AbjEaM6o (ORCPT ); Wed, 31 May 2023 08:58:44 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49F2B124; Wed, 31 May 2023 05:58:06 -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=Eb3aGI6n4ytEG8s7b8hrZ+gUQ6cXP36Kx70RBR7HPKY=; b=c3P5AWBv0AGRi2WjLeefQt8p1U 61YRrFR7iCVpyfZWbW0h1CQKRy7sW+1IywAx74ihcFduGXy9i39NUCsLMrskEEeoaUexPOvgqpi0T PFhbXRwrJJUJo9yVlxTarVQ5/Ov3CO2L5akUzC2OAh5uA5glLLLi/B7yIKzdkUyEs8KLFrOH3KYwu M6pjiF+/Edr97OZxVkjVB3Mtq8SNTChhtw2QYbPitjZQrhKT70iOjn9w06qQYH7TB/ucjVxytCvvX +tOR5D+eLh2tmE0RJNEv+E5v6OdHcl8MyHL606Wup8yyNV4Uv0VmxYojd/mMdWIeWR1d5miOvnH61 gmrjIpRA==; 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 1q4LO9-00HRzk-0U; Wed, 31 May 2023 12:57:17 +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 19/24] dm: remove dm_get_dev_t Date: Wed, 31 May 2023 14:55:30 +0200 Message-Id: <20230531125535.676098-20-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 X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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?1767414828431014241?= X-GMAIL-MSGID: =?utf-8?q?1767414828431014241?= Open code dm_get_dev_t in the only remaining caller, and propagate the exact error code from lookup_bdev and early_lookup_bdev. Signed-off-by: Christoph Hellwig --- drivers/md/dm-table.c | 22 +++++----------------- include/linux/device-mapper.h | 2 -- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 05aa16da43b0d5..1576b408768d4b 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -323,20 +323,6 @@ static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode, return 0; } -/* - * Convert the path to a device - */ -dev_t dm_get_dev_t(const char *path) -{ - dev_t dev; - - if (lookup_bdev(path, &dev) && - early_lookup_bdev(path, &dev)) - return 0; - return dev; -} -EXPORT_SYMBOL_GPL(dm_get_dev_t); - /* * Add a device to the list, or just increment the usage count if * it's already present. @@ -359,9 +345,11 @@ int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, if (MAJOR(dev) != major || MINOR(dev) != minor) return -EOVERFLOW; } else { - dev = dm_get_dev_t(path); - if (!dev) - return -ENODEV; + r = lookup_bdev(path, &dev); + if (r) + r = early_lookup_bdev(path, &dev); + if (r) + return r; } if (dev == disk_devt(t->md->disk)) return -EINVAL; diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index a52d2b9a68460a..c27b84002d8382 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -170,8 +170,6 @@ struct dm_dev { char name[16]; }; -dev_t dm_get_dev_t(const char *path); - /* * Constructors should call these functions to ensure destination devices * are opened/closed correctly.