aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/zram
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Staging: zram: work around oops due to startup ordering snafu"Nitin Gupta2010-12-301-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 7e24cce38a99f373450db67bf576fe73e8168d66 because it was never appropriate for mainline. Do not check for init flag before starting I/O - zram module is unusable without this fix. The oops mentioned in the reverted commit message was actually a problem only with the zram version as present in project's own repository where we allocate struct zram_stats_cpu upon device initialization. OTOH, In mainline/staging version of zram, we allocate struct stats upfront, so this oops cannot happen in mainline version. Checking for init_done flag in zram_make_request() results in a *no-op* for any I/O operation since we simply always return success. This flag is actually set when the first write occurs on a zram disk which triggers its initialization. Bug report: https://bugzilla.kernel.org/show_bug.cgi?id=25722 Reported-by: Dennis Jansen <dennis.jansen@web.de> Signed-off-by: Nitin Gupta <ngupta@vflare.org> Cc: Anton Blanchard <anton@samba.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Staging: zram: fix up my fixup for some sysfs attribute permissionsGreg Kroah-Hartman2010-11-181-2/+2
| | | | | | | | | | | 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>
* Staging: zram: fix up some sysfs attribute permissionsGreg Kroah-Hartman2010-11-161-2/+2
| | | | | | | | | | 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>
* Merge 'staging-next' to Linus's treeGreg Kroah-Hartman2010-10-287-262/+351
|\ | | | | | | | | | | | | | | This merges the staging-next tree to Linus's tree and resolves some conflicts that were present due to changes in other trees that were affected by files here. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| * Staging: zram: Makefile: replace the use of <module>-objs with <module>-yTracey Dent2010-10-081-1/+1
| | | | | | | | | | | | | | Changed <module>-objs to <module>-y in Makefile. Signed-off-by: Tracey Dent <tdent48227@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| * Staging: zram: work around oops due to startup ordering snafuAnton Blanchard2010-10-051-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm getting an oops when running mkfs on zram: NIP [d0000000030e0340] .zram_inc_stat+0x58/0x84 [zram] [c00000006d58f720] [d0000000030e091c] .zram_make_request+0xa8/0x6a0 [zram] [c00000006d58f840] [c00000000035795c] .generic_make_request+0x390/0x434 [c00000006d58f950] [c000000000357b14] .submit_bio+0x114/0x140 [c00000006d58fa20] [c000000000361778] .blkdev_issue_discard+0x1ac/0x250 [c00000006d58fb10] [c000000000361f68] .blkdev_ioctl+0x358/0x7fc [c00000006d58fbd0] [c0000000001c1c1c] .block_ioctl+0x6c/0x90 [c00000006d58fc70] [c0000000001984c4] .do_vfs_ioctl+0x660/0x6d4 [c00000006d58fd70] [c0000000001985a0] .SyS_ioctl+0x68/0xb0 Since disksize no longer starts as 0 it looks like we can call zram_make_request before the device has been initialised. The patch below fixes the immediate problem but this would go away if we move the initialisation function elsewhere (as suggested in another thread). Signed-off-by: Anton Blanchard <anton@samba.org> Cc: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| * Staging: zram: Update zram documentationNitin Gupta2010-08-311-22/+36
| | | | | | | | | | | | | | | | Update zram documentation to reflect transition form ioctl to sysfs interface. Signed-off-by: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| * Staging: zram: Remove need for explicit device initializationNitin Gupta2010-08-313-34/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Staging: zram: Replace ioctls with sysfs interfaceNitin Gupta2010-08-316-232/+306
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Staging: zram: free device memory when init failsShahar Havivi2010-09-031-0/+1
|/ | | | | | Signed-off-by: Shahar Havivi <shaharh@redhat.com> Cc: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: zram: fix build errors, depends on BLOCKRandy Dunlap2010-06-242-0/+2
| | | | | | | | | | | | | | | | | | Fix 49 zram build errors in one swoop. Examples: drivers/staging/zram/zram_drv.c:225: error: dereferencing pointer to incomplete type drivers/staging/zram/zram_drv.c:226: error: implicit declaration of function 'bio_for_each_segment' drivers/staging/zram/zram_drv.c:226: error: expected ';' before '{' token drivers/staging/zram/zram_drv.c:281: error: implicit declaration of function 'bio_endio' drivers/staging/zram/zram_drv.c:285: error: implicit declaration of function 'bio_io_error' drivers/staging/zram/zram_drv.c:545: error: implicit declaration of function 'set_capacity' drivers/staging/zram/zram_drv.c:548: error: implicit declaration of function 'queue_flag_set_unlocked' drivers/staging/zram/zram_drv.c:548: error: 'QUEUE_FLAG_NONROT' undeclared (first use in this function) drivers/staging/zram/zram_drv.c:548: error: dereferencing pointer to incomplete type Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Cc: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: zram: Rename ramzswap to zram in documentationNitin Gupta2010-06-181-20/+31
| | | | | | | | | | | | Related changes: - Included example to show usage as generic (non-swap) disk with ext4 filesystem. - Renamed rzscontrol to zramconfig to match with new device naming. Signed-off-by: Nitin Gupta <ngupta@vflare.org> Acked-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: zram: Rename ramzswap to zram in codeNitin Gupta2010-06-183-262/+256
| | | | | | | | | | | | | | Automated renames in code: - rzs* -> zram* - RZS* -> ZRAM* - ramzswap* -> zram* Manual changes: - Edited comments/messages mentioning "swap" Signed-off-by: Nitin Gupta <ngupta@vflare.org> Acked-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: Rename ramzswap files to zramNitin Gupta2010-06-189-0/+1720
Related changes: - Modify revelant Kconfig and Makefile accordingly. - Change include filenames in code. - Remove dependency on CONFIG_SWAP in Kconfig as zram usage is no longer limited to swap disks. Signed-off-by: Nitin Gupta <ngupta@vflare.org> Acked-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>