]> git.karo-electronics.de Git - karo-tx-linux.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)
commit484875adbc473041b7cf4ef0cb3f56a2ae44a448
tree803fcaee49e52441fe3812f49e11d004769eccbf
parente98419c23b1a189c932775f7833e94cb5230a16b
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