aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/zram/zcomp.h
diff options
context:
space:
mode:
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>2014-04-07 18:38:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-07 19:36:01 -0400
commitfe8eb122c82b2049c460fc6df6e8583a2f935cff (patch)
treebb01a02e6c451d96f379846195346bfde70baba7 /drivers/block/zram/zcomp.h
parentbeca3ec71fe5490ee9237dc42400f50402baf83e (diff)
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/zcomp.h')
-rw-r--r--drivers/block/zram/zcomp.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/block/zram/zcomp.h b/drivers/block/zram/zcomp.h
index 2a3684446160..bd11d59c5dd1 100644
--- a/drivers/block/zram/zcomp.h
+++ b/drivers/block/zram/zcomp.h
@@ -46,6 +46,7 @@ struct zcomp {
46 46
47 struct zcomp_strm *(*strm_find)(struct zcomp *comp); 47 struct zcomp_strm *(*strm_find)(struct zcomp *comp);
48 void (*strm_release)(struct zcomp *comp, struct zcomp_strm *zstrm); 48 void (*strm_release)(struct zcomp *comp, struct zcomp_strm *zstrm);
49 int (*set_max_streams)(struct zcomp *comp, int num_strm);
49 void (*destroy)(struct zcomp *comp); 50 void (*destroy)(struct zcomp *comp);
50}; 51};
51 52
@@ -60,4 +61,6 @@ int zcomp_compress(struct zcomp *comp, struct zcomp_strm *zstrm,
60 61
61int zcomp_decompress(struct zcomp *comp, const unsigned char *src, 62int zcomp_decompress(struct zcomp *comp, const unsigned char *src,
62 size_t src_len, unsigned char *dst); 63 size_t src_len, unsigned char *dst);
64
65int zcomp_set_max_streams(struct zcomp *comp, int num_strm);
63#endif /* _ZCOMP_H_ */ 66#endif /* _ZCOMP_H_ */