writeback_limit_enable RW show and set writeback_limit feature
writeback_batch_size RW show and set maximum number of in-flight
writeback operations
-writeback_compressed RW show and set compressed writeback feature
+compressed_writeback RW show and set compressed writeback feature
comp_algorithm RW show and change the compression algorithm
algorithm_params WO setup compression algorithm parameters
compact WO trigger memory compaction
By default zram stores written back pages in decompressed (raw) form, which
means that writeback operation involves decompression of the page before
writing it to the backing device. This behavior can be changed by enabling
-`writeback_compressed` feature, which causes zram to write compressed pages
+`compressed_writeback` feature, which causes zram to write compressed pages
to the backing device, thus avoiding decompression overhead. To enable
this feature, execute::
- $ echo yes > /sys/block/zramX/writeback_compressed
+ $ echo yes > /sys/block/zramX/compressed_writeback
Note that this feature should be configured before the `zramX` device is
initialized.
return ret;
}
-static ssize_t writeback_compressed_store(struct device *dev,
+static ssize_t compressed_writeback_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{
return -EBUSY;
}
- zram->wb_compressed = val;
+ zram->compressed_wb = val;
return len;
}
-static ssize_t writeback_compressed_show(struct device *dev,
+static ssize_t compressed_writeback_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct zram *zram = dev_to_zram(dev);
guard(rwsem_read)(&zram->dev_lock);
- val = zram->wb_compressed;
+ val = zram->compressed_wb;
return sysfs_emit(buf, "%d\n", val);
}
goto out;
}
- if (zram->wb_compressed) {
+ if (zram->compressed_wb) {
/*
* ZRAM_WB slots get freed, we need to preserve data required
* for read decompression.
set_slot_flag(zram, index, ZRAM_WB);
set_slot_handle(zram, index, req->blk_idx);
- if (zram->wb_compressed) {
+ if (zram->compressed_wb) {
if (huge)
set_slot_flag(zram, index, ZRAM_HUGE);
set_slot_size(zram, index, size);
*/
if (!test_slot_flag(zram, index, ZRAM_PP_SLOT))
goto next;
- if (zram->wb_compressed)
+ if (zram->compressed_wb)
err = read_from_zspool_raw(zram, req->page, index);
else
err = read_from_zspool(zram, req->page, index);
*
* Keep the existing behavior for now.
*/
- if (zram->wb_compressed == false) {
+ if (zram->compressed_wb == false) {
/* No decompression needed, complete the parent IO */
bio_endio(req->parent);
bio_put(bio);
flush_work(&req.work);
destroy_work_on_stack(&req.work);
- if (req.error || zram->wb_compressed == false)
+ if (req.error || zram->compressed_wb == false)
return req.error;
return decompress_bdev_page(zram, page, index);
static DEVICE_ATTR_RW(writeback_limit);
static DEVICE_ATTR_RW(writeback_limit_enable);
static DEVICE_ATTR_RW(writeback_batch_size);
-static DEVICE_ATTR_RW(writeback_compressed);
+static DEVICE_ATTR_RW(compressed_writeback);
#endif
#ifdef CONFIG_ZRAM_MULTI_COMP
static DEVICE_ATTR_RW(recomp_algorithm);
&dev_attr_writeback_limit.attr,
&dev_attr_writeback_limit_enable.attr,
&dev_attr_writeback_batch_size.attr,
- &dev_attr_writeback_compressed.attr,
+ &dev_attr_compressed_writeback.attr,
#endif
&dev_attr_io_stat.attr,
&dev_attr_mm_stat.attr,
init_rwsem(&zram->dev_lock);
#ifdef CONFIG_ZRAM_WRITEBACK
zram->wb_batch_size = 32;
- zram->wb_compressed = false;
+ zram->compressed_wb = false;
#endif
/* gendisk structure */