Message ID | 1303520502-32171-3-git-send-email-john.stultz@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Saturday 23 April 2011, John Stultz wrote: > From: Colin Cross <ccross@android.com> > > Set the GENHD_FL_EXT_DEVT flag, which will allocate minor numbers > in major 259 for partitions past disk->minors. > > Also remove 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: Chris Ball <cjb@laptop.org> > CC: Arnd Bergmann <arnd@arndb.de> > CC: Dima Zavin <dima@android.com> > Signed-off-by: Colin Cross <ccross@android.com> > Signed-off-by: John Stultz <john.stultz@linaro.org> The new code looks reasonable, but wouldn't changing this be incompatible with existing root file systems that contain static device nodes? Arnd -- 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
On Tue, Apr 26, 2011 at 6:22 AM, Arnd Bergmann <arnd@arndb.de> wrote: > On Saturday 23 April 2011, John Stultz wrote: >> From: Colin Cross <ccross@android.com> >> >> Set the GENHD_FL_EXT_DEVT flag, which will allocate minor numbers >> in major 259 for partitions past disk->minors. >> >> Also remove 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: Chris Ball <cjb@laptop.org> >> CC: Arnd Bergmann <arnd@arndb.de> >> CC: Dima Zavin <dima@android.com> >> Signed-off-by: Colin Cross <ccross@android.com> >> Signed-off-by: John Stultz <john.stultz@linaro.org> > > The new code looks reasonable, but wouldn't changing this be incompatible > with existing root file systems that contain static device nodes? I don't think so. Without this change, /dev/mmcblk0p1 will be (179, 1), /dev/mmcblk0p7 will be (179, 7), and /dev/mmcblk0p8 will be dropped. After this change, /dev/mmcblk0p1-7 will be the same, but /dev/mmcblk0p8 will be (259, <random number>). A root file system with static inodes will still have access to partitions 1-7, and will still not have access to dynamically-assigned partition 8. -- 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
On Tuesday 26 April 2011, Colin Cross wrote: > On Tue, Apr 26, 2011 at 6:22 AM, Arnd Bergmann <arnd@arndb.de> wrote: > > On Saturday 23 April 2011, John Stultz wrote: > >> From: Colin Cross <ccross@android.com> > >> > >> Set the GENHD_FL_EXT_DEVT flag, which will allocate minor numbers > >> in major 259 for partitions past disk->minors. > >> > >> Also remove 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: Chris Ball <cjb@laptop.org> > >> CC: Arnd Bergmann <arnd@arndb.de> > >> CC: Dima Zavin <dima@android.com> > >> Signed-off-by: Colin Cross <ccross@android.com> > >> Signed-off-by: John Stultz <john.stultz@linaro.org> > > > > The new code looks reasonable, but wouldn't changing this be incompatible > > with existing root file systems that contain static device nodes? > > I don't think so. Without this change, /dev/mmcblk0p1 will be (179, > 1), /dev/mmcblk0p7 will be (179, 7), and /dev/mmcblk0p8 will be > dropped. After this change, /dev/mmcblk0p1-7 will be the same, but > /dev/mmcblk0p8 will be (259, <random number>). A root file system > with static inodes will still have access to partitions 1-7, and will > still not have access to dynamically-assigned partition 8. Ah, I see. The patch looks good to me then. Arnd -- 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 --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index edac9ac..f69f948 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -102,11 +102,7 @@ static void mmc_blk_put(struct mmc_blk_data *md) mutex_lock(&open_lock); md->usage--; if (md->usage == 0) { - int devmaj = MAJOR(disk_devt(md->disk)); - int devidx = MINOR(disk_devt(md->disk)) / perdev_minors; - - if (!devmaj) - devidx = md->disk->first_minor / perdev_minors; + int devidx = md->disk->first_minor / perdev_minors; blk_cleanup_queue(md->queue.queue); @@ -623,6 +619,7 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) md->disk->private_data = md; md->disk->queue = md->queue.queue; md->disk->driverfs_dev = &card->dev; + md->disk->flags = GENHD_FL_EXT_DEVT; set_disk_ro(md->disk, md->read_only); /*