Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 253020
b: refs/heads/master
c: 5988ce2
h: refs/heads/master
v: v3
  • Loading branch information
Namhyung Kim authored and Jens Axboe committed May 28, 2011
1 parent 7684720 commit 7605b92
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 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: 3b2710824e00d238554c13b5add347e6c701ab1a
refs/heads/master: 5988ce239682854d4e632fb58bff000700830394
13 changes: 12 additions & 1 deletion trunk/drivers/block/nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,9 +754,20 @@ static int __init nbd_init(void)
return -ENOMEM;

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 know the max number of
* partition kernel should be able to manage.
*
* 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 7605b92

Please sign in to comment.