From patchwork Wed Aug 23 17:10:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9917923 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 64410608B9 for ; Wed, 23 Aug 2017 17:11:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CA35286D5 for ; Wed, 23 Aug 2017 17:11:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4113F289E9; Wed, 23 Aug 2017 17:11:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09A09288BD for ; Wed, 23 Aug 2017 17:11:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932433AbdHWRKz (ORCPT ); Wed, 23 Aug 2017 13:10:55 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:45886 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932413AbdHWRKw (ORCPT ); Wed, 23 Aug 2017 13:10:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=VJf3Syz1h8A5ls8UBdhrbXHZn1r3qCezPTzwwRxwLRo=; b=GaXrR5x0NkShV50ZVLnls3FRR xYxBtqDomMbAAPcxDcah1prKx5k/2TrbggdHr+MYTK+v2u+xOTDnAoShtrJQYIShqqjGnLGOOEyjw JuTi0KbzQMyjSlY1zIeMiFwbLTzVg6YdL4lXXqz66v7hU2eMcPqZyXIKV7S2ishKPBUpFm6LyeZd+ h0AHah6pDnYKpM3pj6otkzsoDEr3+ykEC/hksO71TtixQnDiT0Wj5dRXVuWHbRcZj+KzcKb/8P2Rg TiFof35savBlzUkoqUkB2riacuktwpRSVq7FOD4Fwcg8vCeZBTC/bQTEsGn6Dgb8pfEsjlpmNcKOw odvB86YZg==; Received: from clnet-p099-196.ikbnet.co.at ([83.175.99.196] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1dkZB6-0007rB-3E; Wed, 23 Aug 2017 17:10:52 +0000 From: Christoph Hellwig To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-raid@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [PATCH 5/6] block: cache the partition index in struct block_device Date: Wed, 23 Aug 2017 19:10:31 +0200 Message-Id: <20170823171032.30529-6-hch@lst.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170823171032.30529-1-hch@lst.de> References: <20170823171032.30529-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Christoph Hellwig --- fs/block_dev.c | 1 + include/linux/fs.h | 1 + 2 files changed, 2 insertions(+) diff --git a/fs/block_dev.c b/fs/block_dev.c index 9941dc8342df..d29d1c70f833 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1451,6 +1451,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) bdev->bd_disk = disk; bdev->bd_queue = disk->queue; bdev->bd_contains = bdev; + bdev->bd_partno = partno; if (!partno) { ret = -ENXIO; diff --git a/include/linux/fs.h b/include/linux/fs.h index 6e1fd5d21248..706dd3a972d2 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -427,6 +427,7 @@ struct block_device { #endif struct block_device * bd_contains; unsigned bd_block_size; + u8 bd_partno; struct hd_struct * bd_part; /* number of times partitions within this device have been opened. */ unsigned bd_part_count;