@@ -50,12 +50,6 @@ static const char *default_comp_algs[ZRAM_MAX_ZCOMPS] = {
/* Module params (documentation at end) */
static unsigned int num_devices = 1;
-/*
- * Pages that compress to sizes equals or greater than this are stored
- * uncompressed in memory.
- */
-static size_t huge_class_size;
-
static const struct block_device_operations zram_devops;
static void zram_free_page(struct zram *zram, size_t index);
@@ -1259,8 +1253,7 @@ static bool zram_meta_alloc(struct zram *zram, u64 disksize)
return false;
}
- if (!huge_class_size)
- huge_class_size = zs_huge_class_size(zram->mem_pool);
+ zram->huge_class_size = zs_huge_class_size(zram->mem_pool);
return true;
}
@@ -1488,7 +1481,7 @@ static int __zram_bvec_write(struct zram *zram, struct bio_vec *bvec,
return ret;
}
- if (comp_len >= huge_class_size)
+ if (comp_len >= zram->huge_class_size)
comp_len = PAGE_SIZE;
/*
* handle allocation has 2 paths:
@@ -1665,7 +1658,7 @@ static int zram_recompress(struct zram *zram, u32 index, struct page *page,
* in a way that will save us memory. Mark the object so that we
* don't attempt to re-compress it again (RECOMP_SKIP).
*/
- if (comp_len_next >= huge_class_size ||
+ if (comp_len_next >= zram->huge_class_size ||
comp_len_next >= comp_len_prev ||
class_index_next >= class_index_prev ||
ret) {
@@ -120,6 +120,11 @@ struct zram {
*/
u64 disksize; /* bytes */
const char *comp_algs[ZRAM_MAX_ZCOMPS];
+ /*
+ * Pages that compress to sizes equal or greater than this are stored
+ * uncompressed in memory.
+ */
+ size_t huge_class_size;
/*
* zram is claimed so open request will be failed
*/
ZRAM will pass pool specific limit on number of pages per-zspages which will affect pool's characteristics. Namely huge size class watermark value. Move huge_class_size to struct zram, because this value now can be unique to the pool (zram device). Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org> --- drivers/block/zram/zram_drv.c | 13 +++---------- drivers/block/zram/zram_drv.h | 5 +++++ 2 files changed, 8 insertions(+), 10 deletions(-)