linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
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	[thread overview]
Message-ID: <20170823171032.30529-6-hch@lst.de> (raw)
In-Reply-To: <20170823171032.30529-1-hch@lst.de>

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 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;
-- 
2.11.0


  parent reply	other threads:[~2017-08-23 17:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23 17:10 don't require a struct block_device to submit a bio Christoph Hellwig
2017-08-23 17:10 ` [PATCH 1/6] btrfs: index check-integrity state hash by a dev_t Christoph Hellwig
2017-08-23 17:45   ` Liu Bo
2017-08-23 17:10 ` [PATCH 2/6] raid5: remove a call to get_start_sect Christoph Hellwig
2017-08-23 18:23   ` Shaohua Li
2017-08-24  9:18     ` Christoph Hellwig
2017-08-23 17:10 ` [PATCH 3/6] block: reject attempts to allocate more than DISK_MAX_PARTS partitions Christoph Hellwig
2017-08-23 17:10 ` [PATCH 4/6] block: add a __disk_get_part helper Christoph Hellwig
2017-08-23 17:10 ` Christoph Hellwig [this message]
2017-08-23 18:01 ` don't require a struct block_device to submit a bio Christoph Hellwig
2017-08-23 18:04 ` Jens Axboe
2017-08-23 18:50 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170823171032.30529-6-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).