Message ID | 20230523074535.249802-20-hch@lst.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1963311vqo; Tue, 23 May 2023 00:49:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5GFIcVEqX5V7MIj5CuWtPq+iL/qo3gV0zGVXJCJ1ZYF+JC/3ngiQh2UBtovaxd/KndmvXn X-Received: by 2002:a05:6a20:7493:b0:104:7a4c:6ca6 with SMTP id p19-20020a056a20749300b001047a4c6ca6mr12924454pzd.13.1684828141237; Tue, 23 May 2023 00:49:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684828141; cv=none; d=google.com; s=arc-20160816; b=bmgEaWNJl/5Umngc1bN2jUP2dQzVFHtUhjOnbc+BUfrNEvfJXCgVpxk08b5IxxCegp EvGdl/qDIK1LdQyEeaBoEImcxkgd8trgH6viPu0REI4yUs+AoqnF662pr83yABCKNTZ/ LlCtz0ubYu2j+GrsWtoyqFnZ3Q2xiKpH9NRopxP5keVhPxZzO7UvbWfy/q/fAVbVWkbr 6I6CkXlPIUq4DUDfg9fx5Td2d3HrUZuiih+41RzSp0efRA9DncrW9kGeSc1llzFtAYnC xSjr76jhadZ+ucCfCCaEAhGnKegJt4NvSAtUS6MnELg0jDdIzgL9l1e/1O+UAxgg4gL1 IFFw== 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=V2F5GAusl5v7Z9/ExFrBk16K4LK9JB6Nzuc1XGdQbDM=; b=sXMJM10l3N8UPnb8b56+E6GAlUyAHJH0JnY2Yq7NvKqRH62KAjhR/a+j2EdVY24DHe 8l3+ox0h8OUDFaQn4sMc9lB8oJx8Y/RyRXrhluaRl1SzemHva7XMxjbdShMmnY4nzE9L FfDsR8XbRgtCYPt6Em167ExAjp+13SsVELbUYR6xy2dnSMH6bilQ+Ot03WxYlI14NGoR UXv1Xnj3En/9RSlGsU6/7gwgxdW/PK7xAukoQSElpp8LXUZDlTzPNri3sN8T7jK5U7y3 AVqcAcyNbwI4mM+jk3C+h/UOOtemKtbjdcpbB+0Tjb6tVna6RBNFop8S6uzeTO0YHrEw Tiug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="q/awHJ0U"; 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 x19-20020a17090aca1300b00246d164fd7asi6045648pjt.159.2023.05.23.00.48.45; Tue, 23 May 2023 00:49:01 -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="q/awHJ0U"; 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 S235604AbjEWHru (ORCPT <rfc822;ahmedalshaiji.dev@gmail.com> + 99 others); Tue, 23 May 2023 03:47:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235618AbjEWHqx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 23 May 2023 03:46:53 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D28318B; Tue, 23 May 2023 00:46:39 -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=V2F5GAusl5v7Z9/ExFrBk16K4LK9JB6Nzuc1XGdQbDM=; b=q/awHJ0UGEBFLhqS/Kem21dFO8 UrqUe7X6+VcibSuQ3U/6iaJ4woeliYVvU0gW2bL/94CXeRxfA3EXW5LhqQb+MK1hK5Dbt/TlbF9SF Nd2c35vTILMWnyNRiYbVXTocVbw+/PIrVmFw/srfaU9oPOWlYa2zrHdfdWhp/2Beb9tFARP4ORdYg g728oGvlQXRZj/YuOp2rdn62vjBOElOLy4m/EEgNW9Mocbiti4f2V0yQ0Z+Lr//+t3PcFQSxYjyti +ifFE8gU2xVLNYMCH1shCmOQEulB/a3q4Zep9xvhE9LzmaDehvFq5ME3AusCR0JZle+QNJ3/qCAom KVt7hBeQ==; Received: from [2001:4bb8:188:23b2:6ade:85c9:530f:6eb0] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1q1Mj1-009HBv-1X; Tue, 23 May 2023 07:46:31 +0000 From: Christoph Hellwig <hch@lst.de> To: Jens Axboe <axboe@kernel.dk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rafael@kernel.org>, Mike Snitzer <snitzer@kernel.org>, Joern Engel <joern@lazybastard.org>, Miquel Raynal <miquel.raynal@bootlin.com>, Richard Weinberger <richard@nod.at>, Vignesh Raghavendra <vigneshr@ti.com>, Pavel Machek <pavel@ucw.cz>, 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: Tue, 23 May 2023 09:45:30 +0200 Message-Id: <20230523074535.249802-20-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230523074535.249802-1-hch@lst.de> References: <20230523074535.249802-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from <hch@infradead.org> 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766670353321724829?= X-GMAIL-MSGID: =?utf-8?q?1766670353321724829?= |
Series |
[01/24] driver core: return bool from driver_probe_done
|
|
Commit Message
Christoph Hellwig
May 23, 2023, 7:45 a.m. UTC
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 <hch@lst.de>
---
drivers/md/dm-table.c | 20 ++++----------------
include/linux/device-mapper.h | 2 --
2 files changed, 4 insertions(+), 18 deletions(-)
Comments
On Tue, May 23 2023 at 3:45P -0400, Christoph Hellwig <hch@lst.de> wrote: > 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 <hch@lst.de> > --- > drivers/md/dm-table.c | 20 ++++---------------- > include/linux/device-mapper.h | 2 -- > 2 files changed, 4 insertions(+), 18 deletions(-) > > diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c > index 05aa16da43b0d5..e997f4322a9967 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,8 +345,10 @@ 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) > + r = lookup_bdev(path, &dev); > + if (r) > + r = early_lookup_bdev(path, &dev); > + if (r) > return -ENODEV; > } > if (dev == disk_devt(t->md->disk)) OK, but you aren't actually propagating the exact error code. Did you intend to change the return from -ENODEV to r? Mike
On Tue, May 23, 2023 at 12:49:16PM -0400, Mike Snitzer wrote: > > - dev = dm_get_dev_t(path); > > - if (!dev) > > + r = lookup_bdev(path, &dev); > > + if (r) > > + r = early_lookup_bdev(path, &dev); > > + if (r) > > return -ENODEV; > > } > > if (dev == disk_devt(t->md->disk)) > > OK, but you aren't actually propagating the exact error code. Did > you intend to change the return from -ENODEV to r? Yes, thanks.
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 05aa16da43b0d5..e997f4322a9967 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,8 +345,10 @@ 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) + r = lookup_bdev(path, &dev); + if (r) + r = early_lookup_bdev(path, &dev); + if (r) return -ENODEV; } if (dev == disk_devt(t->md->disk)) 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.