mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
zram: rename writeback_compressed device attr
Rename writeback_compressed attr to compressed_writeback to avoid possible
confusion and have more natural naming. writeback_compressed may look
like an alternative version of writeback while in fact
writeback_compressed only sets a writeback property. Make this
distinction more clear with a new compressed_writeback name.
This updates a feature which is new in 7.0-rcX.
Link: https://lkml.kernel.org/r/20260226025429.1042083-1-senozhatsky@chromium.org
Fixes: 4c1d61389e ("zram: introduce writeback_compressed device attribute")
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Suggested-by: Minchan Kim <minchan@kernel.org>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Brian Geffon <bgeffon@google.com>
Cc: Richard Chang <richardycc@google.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: "Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
5548dd7fa8
commit
ba4c3698e6
@@ -151,11 +151,11 @@ Description:
|
||||
The algorithm_params file is write-only and is used to setup
|
||||
compression algorithm parameters.
|
||||
|
||||
What: /sys/block/zram<id>/writeback_compressed
|
||||
What: /sys/block/zram<id>/compressed_writeback
|
||||
Date: Decemeber 2025
|
||||
Contact: Richard Chang <richardycc@google.com>
|
||||
Description:
|
||||
The writeback_compressed device atrribute toggles compressed
|
||||
The compressed_writeback device atrribute toggles compressed
|
||||
writeback feature.
|
||||
|
||||
What: /sys/block/zram<id>/writeback_batch_size
|
||||
|
||||
@@ -216,7 +216,7 @@ writeback_limit WO specifies the maximum amount of write IO zram
|
||||
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
|
||||
@@ -439,11 +439,11 @@ budget in next setting is user's job.
|
||||
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.
|
||||
|
||||
@@ -549,7 +549,7 @@ static ssize_t bd_stat_show(struct device *dev, struct device_attribute *attr,
|
||||
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)
|
||||
{
|
||||
@@ -564,12 +564,12 @@ static ssize_t writeback_compressed_store(struct device *dev,
|
||||
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)
|
||||
{
|
||||
@@ -577,7 +577,7 @@ static ssize_t writeback_compressed_show(struct device *dev,
|
||||
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);
|
||||
}
|
||||
@@ -946,7 +946,7 @@ static int zram_writeback_complete(struct zram *zram, struct zram_wb_req *req)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (zram->wb_compressed) {
|
||||
if (zram->compressed_wb) {
|
||||
/*
|
||||
* ZRAM_WB slots get freed, we need to preserve data required
|
||||
* for read decompression.
|
||||
@@ -960,7 +960,7 @@ static int zram_writeback_complete(struct zram *zram, struct zram_wb_req *req)
|
||||
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);
|
||||
@@ -1100,7 +1100,7 @@ static int zram_writeback_slots(struct zram *zram,
|
||||
*/
|
||||
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);
|
||||
@@ -1429,7 +1429,7 @@ static void zram_async_read_endio(struct bio *bio)
|
||||
*
|
||||
* 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);
|
||||
@@ -1508,7 +1508,7 @@ static int read_from_bdev_sync(struct zram *zram, struct page *page, u32 index,
|
||||
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);
|
||||
@@ -3007,7 +3007,7 @@ static DEVICE_ATTR_WO(writeback);
|
||||
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);
|
||||
@@ -3031,7 +3031,7 @@ static struct attribute *zram_disk_attrs[] = {
|
||||
&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,
|
||||
@@ -3091,7 +3091,7 @@ static int zram_add(void)
|
||||
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 */
|
||||
|
||||
@@ -133,7 +133,7 @@ struct zram {
|
||||
#ifdef CONFIG_ZRAM_WRITEBACK
|
||||
struct file *backing_dev;
|
||||
bool wb_limit_enable;
|
||||
bool wb_compressed;
|
||||
bool compressed_wb;
|
||||
u32 wb_batch_size;
|
||||
u64 bd_wb_limit;
|
||||
struct block_device *bdev;
|
||||
|
||||
Reference in New Issue
Block a user