Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 252257
b: refs/heads/master
c: ac04fee
h: refs/heads/master
i:
  252255: 6b907d3
v: v3
  • Loading branch information
Namhyung Kim authored and Jens Axboe committed May 27, 2011
1 parent 04af92d commit 53d5d38
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d86e0e83b32bc84600adb0b6ea1fce389b266682
refs/heads/master: ac04fee0b5c55bbac0858727a4154110b55d3f5a
17 changes: 14 additions & 3 deletions trunk/drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1540,9 +1540,9 @@ static const struct block_device_operations lo_fops = {
* And now the modules code and kernel interface.
*/
static int max_loop;
module_param(max_loop, int, 0);
module_param(max_loop, int, S_IRUGO);
MODULE_PARM_DESC(max_loop, "Maximum number of loop devices");
module_param(max_part, int, 0);
module_param(max_part, int, S_IRUGO);
MODULE_PARM_DESC(max_part, "Maximum number of partitions per loop device");
MODULE_LICENSE("GPL");
MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR);
Expand Down Expand Up @@ -1688,9 +1688,20 @@ static int __init loop_init(void)
*/

part_shift = 0;
if (max_part > 0)
if (max_part > 0) {
part_shift = fls(max_part);

/*
* Adjust max_part according to part_shift as it is exported
* to user space so that user can decide correct minor number
* if [s]he want to create more devices.
*
* Note that -1 is required because partition 0 is reserved
* for the whole disk.
*/
max_part = (1UL << part_shift) - 1;
}

if ((1UL << part_shift) > DISK_MAX_PARTS)
return -EINVAL;

Expand Down

0 comments on commit 53d5d38

Please sign in to comment.