[lkml]   [2015]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[PATCHv2 00/10] cleaned up on-demand device creation

resending on-demand device creation patch set. sadly, I managed to create a
mess; so here is my take to clean it up, fold patches and, hopefully, see
them in 4.1.

this mess will not happen again.

Andrew picked up some of the commits lined up for 4.1, which required manual
editing. sorry for that inconvenience.

unfortunately, commit c72c6160d967ed26a0b136dbab337f821d233509
Author: Sergey Senozhatsky <>
Date: Wed Apr 15 16:15:55 2015 -0700

zram: move compact_store() to sysfs functions area

ended up to be different: from a cosmetic change it has transformed into
a functional change.

I fix it in 0001-zram-enable-compaction-support-in-zram.patch.

the rest is functionally identical to what we had in linux-next and mmotm for
quite some time: in linux-next since Wed Apr 8 09:44:43 2015 +1000
(commit 273b0791dae2f0b).

it would be nice to see it in 4.1, if possible.

no functional change in zram_drv.c file, compared to zram_drv.c from
linux-next-20150415 (yes, actually checked). just a couple of additional
comment tweaks.


-/* allocate and initialize new zram device. the function returns
- * '>= 0' device_id upon success, and negative value otherwise. */
+ * Allocate and initialize new zram device. the function returns
+ * '>= 0' device_id upon success, and negative value otherwise.
+ */


* First, make ->disksize device attr RO, closing
- * ZRAM_CTL_REMOVE vs disksize_store() race window
+ * zram_remove() vs disksize_store() race window

I also picked up the remaining part of Julia Lawall's
<> ("zram: fix error return code") commit.

Documentation is identical to linux-next-20150415 version.


We currently don't support zram on-demand device creation. The only way
to have N zram devices is to specify num_devices module parameter (default
value 1). That means that if, for some reason, at some point, user wants
to have N + 1 devies he/she must umount all the existing devices, unload
the module, load the module passing num_devices equals to N + 1. And do
this again, if needed.

This patchset introduces zram-control sysfs class, which has two sysfs

- zram_add -- add a new zram device
- zram_remove -- remove a specific (device_id) zram device

Usage example:
# add a new specific zram device
cat /sys/class/zram-control/zram_add

# remove a specific zram device
echo 4 > /sys/class/zram-control/zram_remove

The patchset also does some cleanups and huge code reorganization.


Sergey Senozhatsky (10):
zram: enable compaction support in zram
zram: cosmetic ZRAM_ATTR_RO code formatting tweak
zram: use idr instead of `zram_devices' array
zram: factor out device reset from reset_store()
zram: reorganize code layout
zram: remove max_num_devices limitation
zram: report every added and removed device
zram: trivial: correct flag operations comment
zram: return zram device_id value from zram_add()
zram: add dynamic device add/remove functionality

Documentation/ABI/testing/sysfs-class-zram | 24 +
Documentation/blockdev/zram.txt | 31 +-
drivers/block/zram/zram_drv.c | 939 +++++++++++++++++------------
drivers/block/zram/zram_drv.h | 6 -
4 files changed, 597 insertions(+), 403 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-class-zram


 \ /
  Last update: 2015-04-16 14:21    [W:0.178 / U:25.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site