aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/zram/zram_drv.c
diff options
context:
space:
mode:
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>2014-04-07 15:38:15 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-07 16:36:01 -0700
commitfe8eb122c82b2049c460fc6df6e8583a2f935cff (patch)
treebb01a02e6c451d96f379846195346bfde70baba7 /drivers/block/zram/zram_drv.c
parentzram: add multi stream functionality (diff)
downloadlinux-dev-fe8eb122c82b2049c460fc6df6e8583a2f935cff.tar.xz
linux-dev-fe8eb122c82b2049c460fc6df6e8583a2f935cff.zip
zram: add set_max_streams knob
This patch allows to change max_comp_streams on initialised zcomp. Introduce zcomp set_max_streams() knob, zcomp_strm_multi_set_max_streams() and zcomp_strm_single_set_max_streams() callbacks to change streams limit for zcomp_strm_multi and zcomp_strm_single, accordingly. set_max_streams for single steam zcomp does nothing. If user has lowered the limit, then zcomp_strm_multi_set_max_streams() attempts to immediately free extra streams (as much as it can, depending on idle streams availability). Note, this patch does not allow to change stream 'policy' from single to multi stream (or vice versa) on already initialised compression backend. Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Acked-by: Minchan Kim <minchan@kernel.org> Cc: Jerome Marchand <jmarchan@redhat.com> Cc: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block/zram/zram_drv.c')
-rw-r--r--drivers/block/zram/zram_drv.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index bdc7eb8c6df7..3a5f24c341dc 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -133,9 +133,8 @@ static ssize_t max_comp_streams_store(struct device *dev,
return -EINVAL;
down_write(&zram->init_lock);
if (init_done(zram)) {
- up_write(&zram->init_lock);
- pr_info("Can't set max_comp_streams for initialized device\n");
- return -EBUSY;
+ if (zcomp_set_max_streams(zram->comp, num))
+ pr_info("Cannot change max compression streams\n");
}
zram->max_comp_streams = num;
up_write(&zram->init_lock);