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: 55446 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 9B01820581 for ; Thu, 22 Oct 2015 17:00:54 +0000 (UTC) Received: by wikv3 with SMTP id v3sf37336790wik.1 for ; Thu, 22 Oct 2015 10:00:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=z/UU+ZfGH6ps/4P2Wo69UET1USzCz98ot7xJ+7AEPXo=; b=TfJ+gQbCyMKFuDjr+85O7N+0hYqIGgWl6/OujkEX7GFYL05KuNbLwue1BQBj9F6SjQ 84/pML7rAGkFMs3J6BEBa2S6E6ScEdWIVZfTZBJiEk5rlPD/B4jSwMFiP60puaHsQF/a 6Nha6RBjC4lxGtynAdLEGF0DAWJrIrPiS6UcSCa+xmoALRqrdaCFNAZlgSIsK3I2FJ3z mD77puJF50IdThMmUVIrltqi6lLD3ZBtxgMbojoYA8G6p4q5HkjXIyzsxa7TfXPANv9q nB+pLorm3V4RVCkAzeHSTRJfhuzKIFEwNo9mdMtJMlyqdqHbmgmeBmFmIcZ6OjMZYxIx PCJQ== X-Gm-Message-State: ALoCoQmbQfEzmOEc63tZ0wb+0Nz/IB4zL/Tk66lv/+bfFmLKkuOJeV9eW8E8iyYS/TDTEus5XdkQ X-Received: by 10.112.209.73 with SMTP id mk9mr3940870lbc.14.1445533253850; Thu, 22 Oct 2015 10:00:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.80.140 with SMTP id e134ls394053lfb.42.gmail; Thu, 22 Oct 2015 10:00:53 -0700 (PDT) X-Received: by 10.112.62.194 with SMTP id a2mr9122055lbs.80.1445533253571; Thu, 22 Oct 2015 10:00:53 -0700 (PDT) Received: from mail-lf0-x231.google.com (mail-lf0-x231.google.com. [2a00:1450:4010:c07::231]) by mx.google.com with ESMTPS id h20si10177992lbo.151.2015.10.22.10.00.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2015 10:00:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c07::231 as permitted sender) client-ip=2a00:1450:4010:c07::231; Received: by lfaz124 with SMTP id z124so55549239lfa.1 for ; Thu, 22 Oct 2015 10:00:53 -0700 (PDT) X-Received: by 10.112.202.35 with SMTP id kf3mr9156863lbc.19.1445533253276; Thu, 22 Oct 2015 10:00:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.59.35 with SMTP id w3csp719494lbq; Thu, 22 Oct 2015 10:00:51 -0700 (PDT) X-Received: by 10.107.155.16 with SMTP id d16mr6086713ioe.38.1445533251655; Thu, 22 Oct 2015 10:00:51 -0700 (PDT) Received: from mail-pa0-x22f.google.com (mail-pa0-x22f.google.com. [2607:f8b0:400e:c03::22f]) by mx.google.com with ESMTPS id i12si2940648ioe.71.2015.10.22.10.00.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2015 10:00:51 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c03::22f as permitted sender) client-ip=2607:f8b0:400e:c03::22f; Received: by pabrc13 with SMTP id rc13so91322098pab.0 for ; Thu, 22 Oct 2015 10:00:51 -0700 (PDT) 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 X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c07::231 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@linaro_org.20150623.gappssmtp.com Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;