From patchwork Thu Oct 22 17:00:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 7466021 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A9B219F1C3 for ; Thu, 22 Oct 2015 17:01:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A2AF72052F for ; Thu, 22 Oct 2015 17:00:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5643220527 for ; Thu, 22 Oct 2015 17:00:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965355AbbJVRA4 (ORCPT ); Thu, 22 Oct 2015 13:00:56 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:33491 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965285AbbJVRAv (ORCPT ); Thu, 22 Oct 2015 13:00:51 -0400 Received: by pabrc13 with SMTP id rc13so91322090pab.0 for ; Thu, 22 Oct 2015 10:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=z/UU+ZfGH6ps/4P2Wo69UET1USzCz98ot7xJ+7AEPXo=; b=UZPHL2kcFJVD4BY/Rf72W57MrvJ5E8ElYeSdQYjyStOc3gdIF+qpAJAnA7FPpuTchO q4IonB28BusBgodPOD2PABq9ApVSlR57IfljE7coCY5pCacYp2xVVJBVjB6e1LaWR6NR 8nIDInczf1T9G0+c8DK+g61x83rs6ef42wr4+iDpiyXKZQpdedoXM983353IB8AHpb+7 iv1J4kqW/MlyqQYGz6tU8+XahSNJJNIOl1+wtkdY4an/Cgu5FMQh1RdLGjOmJ2x2kprr CgaqFFcfzA6L9uhL89dCJ2MX2SUB0pDR3xhqI87Z9y4g+8PuclTXBWcHBbgvp8HT1KFB kr1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=z/UU+ZfGH6ps/4P2Wo69UET1USzCz98ot7xJ+7AEPXo=; b=OrH9TcLmsAMW5NsJS3u+A2sUmQ3VtMRqASMmQuOqBMkVULLQFrGrz5IPzGNq2sE0we QmHLnkF0KnpRWuvgwecwW4FEAIA3OStRwIMlOkaejX1Tf48R2ygIp/492mVHc+JT3IYS PnKHrW8tX1RCv9O7tlfrl9/0qSZxGtpLe4XdWM/wiceG0mYlw9aNRYVP98T2onBVNLdp RKCRUIhBozh1SxJ3cnyQRarn+lGYgy81U017fMKTWJamZcQc9YBY1qy8R3nwg+rTJdAR JPYMz25wYPAY4nyMivGgGWgaHuAnwcXgvUE9xVGzNhqWNXCCL5P7VggfVidZaGn7rjO4 69lQ== X-Gm-Message-State: ALoCoQlnbFddMkuDZbFJZrCLebOSpCN2rmAzNAmgYB7XdZRiHtTG+20jBgIQYwat+uiwqs9VYhel X-Received: by 10.66.221.193 with SMTP id qg1mr18978873pac.103.1445533251078; Thu, 22 Oct 2015 10:00:51 -0700 (PDT) Received: from localhost.localdomain (c-76-115-103-22.hsd1.or.comcast.net. [76.115.103.22]) by smtp.gmail.com with ESMTPSA id xs2sm14714172pbb.75.2015.10.22.10.00.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Oct 2015 10:00:50 -0700 (PDT) From: John Stultz To: linux-kernel@vger.kernel.org Cc: Colin Cross , Ulf Hansson , Adrian Hunter , Ben Hutchings , Chuanxiao Dong , Shawn Lin , Austin S Hemmelgarn , Arnd Bergmann , Android Kernel Team , linux-mmc@vger.kernel.org, John Stultz Subject: [RFC][PATCH v2] mmc_block: Allow more than 8 partitions per card Date: Thu, 22 Oct 2015 10:00:41 -0700 Message-Id: <1445533241-10292-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Colin Cross 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 Cc: Adrian Hunter Cc: Ben Hutchings Cc: Chuanxiao Dong Cc: Shawn Lin Cc: Austin S Hemmelgarn Cc: Arnd Bergmann Cc: Android Kernel Team Cc: linux-mmc@vger.kernel.org Signed-off-by: Colin Cross [jstultz: Added context to commit message] Signed-off-by: John Stultz --- 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;