aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/loop.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-27 13:24:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-27 13:24:40 -0400
commitbdf7cf1c83872a0586ce4c4da6889103cc36dbd3 (patch)
tree9311bbcf8b9ffbe7207eba5cca557275f8151ae7 /drivers/block/loop.c
parent40efeb4d0bb1993c3c10baff9b7d86839f99171e (diff)
parentac04fee0b5c55bbac0858727a4154110b55d3f5a (diff)
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block: loop: export module parameters block: export blk_{get,put}_queue() block: remove unused variable in bio_attempt_front_merge() block: always allocate genhd->ev if check_events is implemented brd: export module parameters brd: fix comment on initial device creation brd: handle on-demand devices correctly brd: limit 'max_part' module param to DISK_MAX_PARTS brd: get rid of unused members from struct brd_device block: fix oops on !disk->queue and sysfs discard alignment display
Diffstat (limited to 'drivers/block/loop.c')
-rw-r--r--drivers/block/loop.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index c59a672a3de0..76c8da78212b 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1540,9 +1540,9 @@ static const struct block_device_operations lo_fops = {
1540 * And now the modules code and kernel interface. 1540 * And now the modules code and kernel interface.
1541 */ 1541 */
1542static int max_loop; 1542static int max_loop;
1543module_param(max_loop, int, 0); 1543module_param(max_loop, int, S_IRUGO);
1544MODULE_PARM_DESC(max_loop, "Maximum number of loop devices"); 1544MODULE_PARM_DESC(max_loop, "Maximum number of loop devices");
1545module_param(max_part, int, 0); 1545module_param(max_part, int, S_IRUGO);
1546MODULE_PARM_DESC(max_part, "Maximum number of partitions per loop device"); 1546MODULE_PARM_DESC(max_part, "Maximum number of partitions per loop device");
1547MODULE_LICENSE("GPL"); 1547MODULE_LICENSE("GPL");
1548MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR); 1548MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR);
@@ -1688,9 +1688,20 @@ static int __init loop_init(void)
1688 */ 1688 */
1689 1689
1690 part_shift = 0; 1690 part_shift = 0;
1691 if (max_part > 0) 1691 if (max_part > 0) {
1692 part_shift = fls(max_part); 1692 part_shift = fls(max_part);
1693 1693
1694 /*
1695 * Adjust max_part according to part_shift as it is exported
1696 * to user space so that user can decide correct minor number
1697 * if [s]he want to create more devices.
1698 *
1699 * Note that -1 is required because partition 0 is reserved
1700 * for the whole disk.
1701 */
1702 max_part = (1UL << part_shift) - 1;
1703 }
1704
1694 if ((1UL << part_shift) > DISK_MAX_PARTS) 1705 if ((1UL << part_shift) > DISK_MAX_PARTS)
1695 return -EINVAL; 1706 return -EINVAL;
1696 1707