All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH v2] mmc_block: Allow more than 8 partitions per card
@ 2015-10-22 17:00 John Stultz
  2015-10-22 18:07 ` Ben Hutchings
  2015-12-15 15:11 ` Ulf Hansson
  0 siblings, 2 replies; 4+ messages in thread
From: John Stultz @ 2015-10-22 17:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Colin Cross, Ulf Hansson, Adrian Hunter, Ben Hutchings,
	Chuanxiao Dong, Shawn Lin, Austin S Hemmelgarn, Arnd Bergmann,
	Android Kernel Team, linux-mmc, John Stultz

From: Colin Cross <ccross@android.com>

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
disk->minors.

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.

Thoughts or feedback would be greatly appreciated.

Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Chuanxiao Dong <chuanxiao.dong@intel.com>
Cc: Shawn Lin <shawn.lin@rock-chips.com>
Cc: Austin S Hemmelgarn <ahferroin7@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Android Kernel Team <kernel-team@android.com>
Cc: linux-mmc@vger.kernel.org
Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: Added context to commit message]
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
v2: Added context to commit message about CONFIG_MMC_BLOCK_MINORS
    and its limitations.

 drivers/mmc/card/block.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index c742cfd..564436e 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -172,11 +172,7 @@ static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk)
 
 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;
 }
 
@@ -2162,6 +2158,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
 	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 | MMC_BLK_DATA_AREA_BOOT))
 		md->disk->flags |= GENHD_FL_NO_PART_SCAN;
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC][PATCH v2] mmc_block: Allow more than 8 partitions per card
  2015-10-22 17:00 [RFC][PATCH v2] mmc_block: Allow more than 8 partitions per card John Stultz
@ 2015-10-22 18:07 ` Ben Hutchings
  2015-10-22 18:13   ` Ben Hutchings
  2015-12-15 15:11 ` Ulf Hansson
  1 sibling, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2015-10-22 18:07 UTC (permalink / raw)
  To: John Stultz, Colin Cross
  Cc: Ulf Hansson, Adrian Hunter, Chuanxiao Dong, Shawn Lin,
	Austin S Hemmelgarn, Arnd Bergmann, Android Kernel Team,
	linux-mmc, LKML

[-- Attachment #1: Type: text/plain, Size: 1021 bytes --]

On Thu, 2015-10-22 at 10:00 -0700, John Stultz wrote:
> From: Colin Cross <ccross@android.com>
> 
> 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 commit was intended to allow support for 256 cards with any number
of partitions:

commit a26eba614afff0e39594101bcb73014a9a22fb33
Author: Ben Hutchings <ben@decadent.org.uk>
Date:   Thu Nov 6 03:35:09 2014 +0000

    mmc: block: Increase max_devices

I don't think the new patch is sufficient or necessary to increase the
limit further.

Do you have a compatibility requirement to retain the numbering of the
first 7 partitions?

Ben.

-- 
Ben Hutchings
Q.  Which is the greater problem in the world today, ignorance or apathy?
A.  I don't know and I couldn't care less.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC][PATCH v2] mmc_block: Allow more than 8 partitions per card
  2015-10-22 18:07 ` Ben Hutchings
@ 2015-10-22 18:13   ` Ben Hutchings
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Hutchings @ 2015-10-22 18:13 UTC (permalink / raw)
  To: John Stultz, Colin Cross
  Cc: Ulf Hansson, Adrian Hunter, Chuanxiao Dong, Shawn Lin,
	Austin S Hemmelgarn, Arnd Bergmann, Android Kernel Team,
	linux-mmc, LKML

[-- Attachment #1: Type: text/plain, Size: 1341 bytes --]

On Thu, 2015-10-22 at 19:07 +0100, Ben Hutchings wrote:
> On Thu, 2015-10-22 at 10:00 -0700, John Stultz wrote:
> > From: Colin Cross <ccross@android.com>
> > 
> > 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 commit was intended to allow support for 256 cards with any number
> of partitions:
> 
> commit a26eba614afff0e39594101bcb73014a9a22fb33
> Author: Ben Hutchings <ben@decadent.org.uk>
> Date:   Thu Nov 6 03:35:09 2014 +0000
> 
>     mmc: block: Increase max_devices
> 
> I don't think the new patch is sufficient or necessary to increase the
> limit further.

Of course, this does allow use of more than any predefined number of
partitions per card, the same as sd can.  So it still has some
usefulness, though the commit message seems to overstate that.

Ben.

> Do you have a compatibility requirement to retain the numbering of the
> first 7 partitions?
> 
> Ben.
> 
-- 
Ben Hutchings
Q.  Which is the greater problem in the world today, ignorance or apathy?
A.  I don't know and I couldn't care less.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC][PATCH v2] mmc_block: Allow more than 8 partitions per card
  2015-10-22 17:00 [RFC][PATCH v2] mmc_block: Allow more than 8 partitions per card John Stultz
  2015-10-22 18:07 ` Ben Hutchings
@ 2015-12-15 15:11 ` Ulf Hansson
  1 sibling, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2015-12-15 15:11 UTC (permalink / raw)
  To: John Stultz
  Cc: linux-kernel, Colin Cross, Adrian Hunter, Ben Hutchings,
	Chuanxiao Dong, Shawn Lin, Austin S Hemmelgarn, Arnd Bergmann,
	Android Kernel Team, linux-mmc

On 22 October 2015 at 19:00, John Stultz <john.stultz@linaro.org> wrote:
> From: Colin Cross <ccross@android.com>
>
> 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
> disk->minors.
>
> 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.
>
> Thoughts or feedback would be greatly appreciated.
>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Ben Hutchings <ben@decadent.org.uk>
> Cc: Chuanxiao Dong <chuanxiao.dong@intel.com>
> Cc: Shawn Lin <shawn.lin@rock-chips.com>
> Cc: Austin S Hemmelgarn <ahferroin7@gmail.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Android Kernel Team <kernel-team@android.com>
> Cc: linux-mmc@vger.kernel.org
> Signed-off-by: Colin Cross <ccross@android.com>
> [jstultz: Added context to commit message]
> Signed-off-by: John Stultz <john.stultz@linaro.org>

Thanks, applied for next!

I did some minor changes to the change-log, and updated the prefix of
the commit msg header.

Kind regards
Uffe

> ---
> v2: Added context to commit message about CONFIG_MMC_BLOCK_MINORS
>     and its limitations.
>
>  drivers/mmc/card/block.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index c742cfd..564436e 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -172,11 +172,7 @@ static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk)
>
>  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;
>  }
>
> @@ -2162,6 +2158,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
>         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 | MMC_BLK_DATA_AREA_BOOT))
>                 md->disk->flags |= GENHD_FL_NO_PART_SCAN;
>
> --
> 1.9.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-15 15:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-22 17:00 [RFC][PATCH v2] mmc_block: Allow more than 8 partitions per card John Stultz
2015-10-22 18:07 ` Ben Hutchings
2015-10-22 18:13   ` Ben Hutchings
2015-12-15 15:11 ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.