diff mbox

mmc_block: Increase max_devices

Message ID 1415244909.3398.51.camel@decadent.org.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Hutchings Nov. 6, 2014, 3:35 a.m. UTC
Currently the driver imposes a limit of 256 total minor numbers,
apparently based on the historic Unix/Linux limit.  This is quite
restrictive, particularly if we raise the maximum number of
partitions per card to 256 to match sd.

In order to make the full minor number space available we would
have to replace the static dev_use and name_use arrays with struct
ida.  But we can at least allow use of 256 cards rather than just
256 minors, with only a small change.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/mmc/card/block.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Ulf Hansson Nov. 19, 2014, 10:30 a.m. UTC | #1
On 6 November 2014 04:35, Ben Hutchings <ben@decadent.org.uk> wrote:
> Currently the driver imposes a limit of 256 total minor numbers,
> apparently based on the historic Unix/Linux limit.  This is quite
> restrictive, particularly if we raise the maximum number of
> partitions per card to 256 to match sd.
>
> In order to make the full minor number space available we would
> have to replace the static dev_use and name_use arrays with struct
> ida.  But we can at least allow use of 256 cards rather than just
> 256 minors, with only a small change.
>
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

Thanks! Applied for next.

Kind regards
Uffe

> ---
>  drivers/mmc/card/block.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index 1fa4c80..d9783da 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -78,13 +78,16 @@ static int perdev_minors = CONFIG_MMC_BLOCK_MINORS;
>
>  /*
>   * We've only got one major, so number of mmcblk devices is
> - * limited to 256 / number of minors per device.
> + * limited to (1 << 20) / number of minors per device.  It is also
> + * currently limited by the size of the static bitmaps below.
>   */
>  static int max_devices;
>
> -/* 256 minors, so at most 256 separate devices */
> -static DECLARE_BITMAP(dev_use, 256);
> -static DECLARE_BITMAP(name_use, 256);
> +#define MAX_DEVICES 256
> +
> +/* TODO: Replace these with struct ida */
> +static DECLARE_BITMAP(dev_use, MAX_DEVICES);
> +static DECLARE_BITMAP(name_use, MAX_DEVICES);
>
>  /*
>   * There is one mmc_blk_data per slot.
> @@ -2563,7 +2566,7 @@ static int __init mmc_blk_init(void)
>         if (perdev_minors != CONFIG_MMC_BLOCK_MINORS)
>                 pr_info("mmcblk: using %d minors per device\n", perdev_minors);
>
> -       max_devices = 256 / perdev_minors;
> +       max_devices = min(MAX_DEVICES, (1 << MINORBITS) / perdev_minors);
>
>         res = register_blkdev(MMC_BLOCK_MAJOR, "mmc");
>         if (res)
>
> --
> Ben Hutchings
> Beware of programmers who carry screwdrivers. - Leonard Brandwein
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 1fa4c80..d9783da 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -78,13 +78,16 @@  static int perdev_minors = CONFIG_MMC_BLOCK_MINORS;
 
 /*
  * We've only got one major, so number of mmcblk devices is
- * limited to 256 / number of minors per device.
+ * limited to (1 << 20) / number of minors per device.  It is also
+ * currently limited by the size of the static bitmaps below.
  */
 static int max_devices;
 
-/* 256 minors, so at most 256 separate devices */
-static DECLARE_BITMAP(dev_use, 256);
-static DECLARE_BITMAP(name_use, 256);
+#define MAX_DEVICES 256
+
+/* TODO: Replace these with struct ida */
+static DECLARE_BITMAP(dev_use, MAX_DEVICES);
+static DECLARE_BITMAP(name_use, MAX_DEVICES);
 
 /*
  * There is one mmc_blk_data per slot.
@@ -2563,7 +2566,7 @@  static int __init mmc_blk_init(void)
 	if (perdev_minors != CONFIG_MMC_BLOCK_MINORS)
 		pr_info("mmcblk: using %d minors per device\n", perdev_minors);
 
-	max_devices = 256 / perdev_minors;
+	max_devices = min(MAX_DEVICES, (1 << MINORBITS) / perdev_minors);
 
 	res = register_blkdev(MMC_BLOCK_MAJOR, "mmc");
 	if (res)