[PATCHv2 00/10] cleaned up on-demand device creation

From: Sergey Senozhatsky
Date: Thu Apr 16 2015 - 07:55:59 EST


Hello,

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 <sergey.senozhatsky@xxxxxxxxx>
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.

like:

-/* 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.
+ */

or

/*
* 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
<Julia.Lawall@xxxxxxx> ("zram: fix error return code") commit.

Documentation is identical to linux-next-20150415 version.


8<-------

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
attrs:

- 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
1

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

The patchset also does some cleanups and huge code reorganization.


-ss


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

--
2.4.0.rc1.29.gecc46a1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/