History log of /drivers/staging/zram/zram_sysfs.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
5fa5a90116be97cd15deac3f45b602c2e5c5fb58 13-Feb-2012 Nitin Gupta <ngupta@vflare.org> staging: zram: Rename module parameter

zram accepts number of devices to be created
as a module parameter. This was renamed from
num_devices to zram_num_devices (without updating
the documentation!) since num_devices was declared
as a non-static global variable, polluting the global
namespace. Now, we declare it as a static variable
and revert back the name change.

The documentation (zram.txt) already mentions
num_devices as the module parameter name.

Signed-off-by: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
/drivers/staging/zram/zram_sysfs.c
fd1a30dea194002c061503af8425688dcc6f3970 09-Jan-2012 Nitin Gupta <ngupta@vflare.org> staging: zram: replace xvmalloc with zsmalloc

Replaces xvmalloc with zsmalloc as the compressed page allocator
for zram

Signed-off-by: Nitin Gupta <ngupta@vflare.org>
Acked-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
/drivers/staging/zram/zram_sysfs.c
04e7bbad44c1a0c449719f90d507d13e015f1444 07-Dec-2011 Sergey Datsevich <snsedats@faui49man4.informatik.uni-erlangen.de> Staging: zram/zram_sysfs.c: Fixed call of obsolete function strict_strtoX

As reported by checkpatch.pl strict_strtoX is obsolet and should be
replaced by kstrtoX.

Signed-off-by: Sergey Datsevich <srgdts@gmail.com>
Signed-off-by: Bjoern Meier <bjoernmeier@hotmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/staging/zram/zram_sysfs.c
0900beae178a84e653d9088979cf3014babc097e 06-Sep-2011 Jerome Marchand <jmarchan@redhat.com> staging: zram: fix zram locking

Currently init_lock only prevents concurrent execution of zram_init_device()
and zram_reset_device() but not zram_make_request() nor sysfs store functions.

This patch changes init_lock into a rw_semaphore. A write lock is taken by
init, reset and store functions, a read lock is taken by zram_make_request().
Also, avoids to release the lock before calling __zram_reset_device() for
cleaning after a failed init, thus preventing any concurrent task to see an
inconsistent state of zram.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/staging/zram/zram_sysfs.c
efd54f4375982a3f8bef3cce610955f4cc37d5cb 21-Jul-2011 Noah Watkins <noahwatkins@gmail.com> staging: zram: make global var "num_devices" use unique name

The global variable "num_devices" is too general to be
global. This patch switches the name to be "zram_num_devices".

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/staging/zram/zram_sysfs.c
43801f6e4ee269cd76f601c2b1d79897ea4a892f 21-Jul-2011 Noah Watkins <noahwatkins@gmail.com> staging: zram: make global var "devices" use unique name

The global variable "devices" is too general to be global.
This patch switches the name to be "zram_devices".

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/staging/zram/zram_sysfs.c
f2da98739da4e20e907f8317d513868764002d31 17-Dec-2010 Jerome Marchand <jmarchan@redhat.com> Staging: zram: round up the disk size provided by user

Currently disksize_store() round down the disk size provided by user.
This is probably not what one would expect, so round up instead.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/staging/zram/zram_sysfs.c
2b152873469d2b0751e8b726df6415f05e37632e 17-Dec-2010 Jerome Marchand <jmarchan@redhat.com> Staging: zram: make ZRAM depends on SYSFS

We can not configure zram device without sysfs anyway, so make zram
depends on it.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/staging/zram/zram_sysfs.c
a3d13107012ea614184d3c58bb7b579905d5da11 18-Nov-2010 Greg Kroah-Hartman <gregkh@suse.de> Staging: zram: fix up my fixup for some sysfs attribute permissions

They should be writable by root, not readable.
Doh, stupid me with the wrong flags.

Reported-by: Jonathan Cameron <jic23@cam.ac.uk>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/staging/zram/zram_sysfs.c
0281b490dd7b96990724f4a15842c55657699aed 16-Nov-2010 Greg Kroah-Hartman <gregkh@suse.de> Staging: zram: fix up some sysfs attribute permissions

They should not be writable by any user

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/staging/zram/zram_sysfs.c
484875adbc473041b7cf4ef0cb3f56a2ae44a448 09-Aug-2010 Nitin Gupta <ngupta@vflare.org> 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_sysfs.c
33863c21e69e9bd988b63580ada0b729c1d90215 09-Aug-2010 Nitin Gupta <ngupta@vflare.org> Staging: zram: Replace ioctls with sysfs interface

Creates per-device sysfs nodes in /sys/block/zram<id>/
Currently following stats are exported:
- disksize
- num_reads
- num_writes
- invalid_io
- zero_pages
- orig_data_size
- compr_data_size
- mem_used_total

By default, disksize is set to 0. So, to start using
a zram device, fist write a disksize value and then
initialize device by writing any positive value to
initstate. For example:

# initialize /dev/zram0 with 50MB disksize
echo 50*1024*1024 | bc > /sys/block/zram0/disksize
echo 1 > /sys/block/zram0/initstate

When done using a disk, issue reset to free its memory
by writing any positive value to reset node:

echo 1 > /sys/block/zram0/reset

This change also obviates the need for 'rzscontrol' utility.

Signed-off-by: Nitin Gupta <ngupta@vflare.org>
Acked-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/staging/zram/zram_sysfs.c