Linux-mmc Archive on
 help / color / Atom feed
* [PATCH 3.16 24/63] mmc: block: Allow more than 8 partitions per card
       [not found] <>
@ 2020-01-08 19:43 ` Ben Hutchings
  0 siblings, 0 replies; only message in thread
From: Ben Hutchings @ 2020-01-08 19:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Denis Kirjanov, Colin Cross, Arnd Bergmann, John Stultz,
	Ulf Hansson, Shawn Lin, Adrian Hunter, linux-mmc,
	Android Kernel Team, Austin S Hemmelgarn, Chuanxiao Dong

3.16.81-rc1 review patch.  If anyone has any objections, please let me know.


From: Colin Cross <>

commit 382c55f88ffeb218c446bf0c46d0fc25d2795fe2 upstream.

It is quite common for Android devices to utilize more
then 8 partitions on internal eMMC storage.

The vanilla kernel can support this via
CONFIG_MMC_BLOCK_MINORS, however that solution caps the
system to 256 minors total, which limits the number of
mmc cards the system can support.

This patch, which has been carried for quite awhile in
the AOSP common tree, provides an alternative solution
that doesn't seem to limit the total card count. So I
wanted to submit it for consideration upstream.

This patch sets the GENHD_FL_EXT_DEVT flag, which will
allocate minor number in major 259 for partitions past

It also removes the use of disk_devt to determine devidx
from md->disk. md->disk->first_minor is always initialized
from devidx and can always be used to recover it.

Cc: Ulf Hansson <>
Cc: Adrian Hunter <>
Cc: Ben Hutchings <>
Cc: Chuanxiao Dong <>
Cc: Shawn Lin <>
Cc: Austin S Hemmelgarn <>
Cc: Arnd Bergmann <>
Cc: Android Kernel Team <>
Signed-off-by: Colin Cross <>
[jstultz: Added context to commit message]
Signed-off-by: John Stultz <>
Signed-off-by: Ulf Hansson <>
Cc: Arnd Bergmann <>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <>
 drivers/mmc/card/block.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -168,11 +168,7 @@ static struct mmc_blk_data *mmc_blk_get(
 static inline int mmc_get_devidx(struct gendisk *disk)
-	int devmaj = MAJOR(disk_devt(disk));
-	int devidx = MINOR(disk_devt(disk)) / perdev_minors;
-	if (!devmaj)
-		devidx = disk->first_minor / perdev_minors;
+	int devidx = disk->first_minor / perdev_minors;
 	return devidx;
@@ -2169,6 +2165,7 @@ static struct mmc_blk_data *mmc_blk_allo
 	md->disk->queue = md->queue.queue;
 	md->disk->driverfs_dev = parent;
 	set_disk_ro(md->disk, md->read_only || default_ro);
+	md->disk->flags = GENHD_FL_EXT_DEVT;
 	if (area_type & MMC_BLK_DATA_AREA_RPMB)
 		md->disk->flags |= GENHD_FL_NO_PART_SCAN;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <>
2020-01-08 19:43 ` [PATCH 3.16 24/63] mmc: block: Allow more than 8 partitions per card Ben Hutchings

Linux-mmc Archive on

Archives are clonable:
	git clone --mirror linux-mmc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mmc linux-mmc/ \
	public-inbox-index linux-mmc

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone