Skip to content

Commit

Permalink
zram: remove max_num_devices limitation
Browse files Browse the repository at this point in the history
Limiting the number of zram devices to 32 (default max_num_devices value)
is confusing, let's drop it.  A user with 2TB or 4TB of RAM, for example,
can request as many devices as he can handle.

Signed-off-by: Sergey Senozhatsky <[email protected]>
Acked-by: Minchan Kim <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
sergey-senozhatsky authored and torvalds committed Jun 26, 2015
1 parent 522698d commit c3cdb40
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
4 changes: 3 additions & 1 deletion Documentation/blockdev/zram.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ Following shows a typical sequence of steps for using zram.
1) Load Module:
modprobe zram num_devices=4
This creates 4 devices: /dev/zram{0,1,2,3}
(num_devices parameter is optional. Default: 1)

num_devices parameter is optional and tells zram how many devices should be
pre-created. Default: 1.

2) Set max number of compression streams
Compression backend may use up to max_comp_streams compression streams,
Expand Down
8 changes: 1 addition & 7 deletions drivers/block/zram/zram_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1287,12 +1287,6 @@ static int __init zram_init(void)
{
int ret, dev_id;

if (num_devices > max_num_devices) {
pr_warn("Invalid value for num_devices: %u\n",
num_devices);
return -EINVAL;
}

zram_major = register_blkdev(0, "zram");
if (zram_major <= 0) {
pr_warn("Unable to get major number\n");
Expand Down Expand Up @@ -1322,7 +1316,7 @@ module_init(zram_init);
module_exit(zram_exit);

module_param(num_devices, uint, 0);
MODULE_PARM_DESC(num_devices, "Number of zram devices");
MODULE_PARM_DESC(num_devices, "Number of pre-created zram devices");

MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("Nitin Gupta <[email protected]>");
Expand Down
6 changes: 0 additions & 6 deletions drivers/block/zram/zram_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@

#include "zcomp.h"

/*
* Some arbitrary value. This is just to catch
* invalid value for num_devices module parameter.
*/
static const unsigned max_num_devices = 32;

/*-- Configurable parameters */

/*
Expand Down

0 comments on commit c3cdb40

Please sign in to comment.