aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/zram/zram_drv.h
diff options
context:
space:
mode:
authorNitin Gupta <ngupta@vflare.org>2010-08-09 22:56:48 +0530
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-31 15:36:36 -0700
commit484875adbc473041b7cf4ef0cb3f56a2ae44a448 (patch)
tree803fcaee49e52441fe3812f49e11d004769eccbf /drivers/staging/zram/zram_drv.h
parente98419c23b1a189c932775f7833e94cb5230a16b (diff)
downloadkernel_samsung_smdk4412-484875adbc473041b7cf4ef0cb3f56a2ae44a448.zip
kernel_samsung_smdk4412-484875adbc473041b7cf4ef0cb3f56a2ae44a448.tar.gz
kernel_samsung_smdk4412-484875adbc473041b7cf4ef0cb3f56a2ae44a448.tar.bz2
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>
Diffstat (limited to 'drivers/staging/zram/zram_drv.h')
-rw-r--r--drivers/staging/zram/zram_drv.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/zram/zram_drv.h b/drivers/staging/zram/zram_drv.h
index 2ef93cc..a481551 100644
--- a/drivers/staging/zram/zram_drv.h
+++ b/drivers/staging/zram/zram_drv.h
@@ -108,6 +108,8 @@ struct zram {
struct request_queue *queue;
struct gendisk *disk;
int init_done;
+ /* Prevent concurrent execution of device init and reset */
+ struct mutex init_lock;
/*
* This is the limit on amount of *uncompressed* worth of data
* we can store in a disk.