From patchwork Thu Nov 26 13:04:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 1406644 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=WlGwWgEk; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=E7cmj+ad; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Chdg9076sz9sVT for ; Fri, 27 Nov 2020 00:20:52 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=t/N08XTwudl6U+EwiReT/2/fnpLgaq5qXQv7AJiOzXM=; b=WlGwWgEkd928569juvppQ+q6z UK2GLUkVWRYN4nc5+PRxG+48pMzjBWYlpkEbOcVcymLbIHVbr6jRa18sG49TuF1X+8d2jcLH6Z5hg vwaqdGV55WgPogs7xKDJCEjcSElJcSuFUJs2kmSwhNbVccHzoTS0euqiyoFV19xVqE6IhT9Z6yujk m8cGGdLoxwZBRRnWG7ikcIlrpGm6Gd/LTsAGZsshtSIpmX1k2+lZtvaWTF/e5bNrh/vgdTvVL7W2J +OXrSAJsKJXzOS/CAHyvGSwbphS80CyxiQRQwV43ohTlJts0XK3oyNhXjahaSQTI/Burcgk6qWZAQ ymkd0QIWw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kiHBu-0003YO-DS; Thu, 26 Nov 2020 13:20:06 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kiGzl-0008Jp-8o for linux-mtd@merlin.infradead.org; Thu, 26 Nov 2020 13:07:33 +0000 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=Or9n44gA396OJLT8EEZLiQKS7/tv37Y03iSNpZhQnrs=; b=E7cmj+adi6Gs4NLjJjQlTWmBz8 UC24t7cF1SHXmezfannkht9zSOKEW7WmMA8h3i2u6iGn3T8b2Hl5pTOWWBS1g/t+vUyVsFq155ThO Shrl3bMtt02TcdHBDXGtxBCkjf3eZX+aQt9MvPfSWI3gt6BVbCnb2wBS+Hva/tQqHCJIdftFPRU3X XYrdOHvpjaaFtFSB20obXJMIznxmVJreYe1Nd6mVa+4XgP+SiaKB2qKB0gEWPLE40M9JtEVnaSbYX CHNGKySOT8iuktACMNyRymDkUCWzSP+6kon5pMxfUzKZOr9zE3ib3FyzSMjzp9v9929XCo9QyGGby u6mgVKQw==; Received: from [2001:4bb8:18c:1dd6:27b8:b8a1:c13e:ceb1] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kiGzj-0004BW-RG; Thu, 26 Nov 2020 13:07:32 +0000 From: Christoph Hellwig To: Jens Axboe Subject: [PATCH 40/44] block: pass a block_device to invalidate_partition Date: Thu, 26 Nov 2020 14:04:18 +0100 Message-Id: <20201126130422.92945-41-hch@lst.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201126130422.92945-1-hch@lst.de> References: <20201126130422.92945-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-bcache@vger.kernel.org, Jan Kara , Mike Snitzer , linux-mm@kvack.org, Greg Kroah-Hartman , Jan Kara , Josef Bacik , Coly Li , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, linux-mtd@lists.infradead.org, Johannes Thumshirn , Tejun Heo Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Pass the block_device actually needed instead of looking it up using bdget_disk. Signed-off-by: Christoph Hellwig Reviewed-by: Jan Kara --- block/genhd.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 89cd0ba8e3b84a..28299b24173be1 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -792,14 +792,8 @@ void device_add_disk_no_queue_reg(struct device *parent, struct gendisk *disk) } EXPORT_SYMBOL(device_add_disk_no_queue_reg); -static void invalidate_partition(struct gendisk *disk, int partno) +static void invalidate_partition(struct block_device *bdev) { - struct block_device *bdev; - - bdev = bdget_disk(disk, partno); - if (!bdev) - return; - fsync_bdev(bdev); __invalidate_device(bdev, true); @@ -808,7 +802,6 @@ static void invalidate_partition(struct gendisk *disk, int partno) * up any more even if openers still hold references to it. */ remove_inode_hash(bdev->bd_inode); - bdput(bdev); } /** @@ -853,12 +846,12 @@ void del_gendisk(struct gendisk *disk) disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY | DISK_PITER_REVERSE); while ((part = disk_part_iter_next(&piter))) { - invalidate_partition(disk, part->bdev->bd_partno); + invalidate_partition(part->bdev); delete_partition(part); } disk_part_iter_exit(&piter); - invalidate_partition(disk, 0); + invalidate_partition(disk->part0); set_capacity(disk, 0); disk->flags &= ~GENHD_FL_UP; up_write(&bdev_lookup_sem);