]> git.baikalelectronics.ru Git - kernel.git/commit
Staging: zram: Remove need for explicit device initialization
authorNitin Gupta <ngupta@vflare.org>
Mon, 9 Aug 2010 17:26:48 +0000 (22:56 +0530)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 31 Aug 2010 22:36:36 +0000 (15:36 -0700)
commite777f71c412d804309b67e108484fad967195aa8
tree803fcaee49e52441fe3812f49e11d004769eccbf
parentd947308e01370cc07d0a26db1f3e160553cbb06e
Staging: zram: Remove need for explicit device initialization

Currently, the user has to explicitly write a positive value to
initstate sysfs node before the device can be used. This event
triggers allocation of per-device metadata like memory pool,
table array and so on.

We do not pre-initialize all zram devices since the 'table' array,
mapping disk blocks to compressed chunks, takes considerable amount
of memory (8 bytes per page). So, pre-initializing all devices will
be quite wasteful if only few or none of the devices are actually
used.

This explicit device initialization from user is an odd requirement and
can be easily avoided. We now initialize the device when first write is
done to the device.

Signed-off-by: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/zram/zram_drv.c
drivers/staging/zram/zram_drv.h
drivers/staging/zram/zram_sysfs.c