mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
zram: remove obsolete sysfs attrs
We had a deprecated_attr_warn() warning for 2 years and now the time has come and we finally can do the cleanup. The plan was as follows: : per-stat sysfs attributes are considered to be deprecated. : The basic strategy is: : -- the existing RW nodes will be downgraded to WO nodes (in linux 4.11) : -- deprecated RO sysfs nodes will eventually be removed (in linux 4.11) : : The list of deprecated attributes can be found here: : Documentation/ABI/obsolete/sysfs-block-zram : : Basically, every attribute that has its own read accessible sysfs : node (e.g. num_reads) *AND* is accessible via one of the stat files : (zram<id>/stat or zram<id>/io_stat or zram<id>/mm_stat) is considered : to be deprecated. The patch also removes `obsolete/sysfs-block-zram', clean ups `testing/sysfs-block-zram' and tweaks zram.txt files. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Sergey Senozhatsky <[email protected]> Acked-by: Minchan Kim <[email protected]> Cc: Jonathan Corbet <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
5d63f81c9e
commit
c87d1655c2
4 changed files with 42 additions and 353 deletions
|
|
@ -45,27 +45,6 @@ static const char *default_compressor = "lzo";
|
|||
/* Module params (documentation at end) */
|
||||
static unsigned int num_devices = 1;
|
||||
|
||||
static inline void deprecated_attr_warn(const char *name)
|
||||
{
|
||||
pr_warn_once("%d (%s) Attribute %s (and others) will be removed. %s\n",
|
||||
task_pid_nr(current),
|
||||
current->comm,
|
||||
name,
|
||||
"See zram documentation.");
|
||||
}
|
||||
|
||||
#define ZRAM_ATTR_RO(name) \
|
||||
static ssize_t name##_show(struct device *d, \
|
||||
struct device_attribute *attr, char *b) \
|
||||
{ \
|
||||
struct zram *zram = dev_to_zram(d); \
|
||||
\
|
||||
deprecated_attr_warn(__stringify(name)); \
|
||||
return scnprintf(b, PAGE_SIZE, "%llu\n", \
|
||||
(u64)atomic64_read(&zram->stats.name)); \
|
||||
} \
|
||||
static DEVICE_ATTR_RO(name);
|
||||
|
||||
static inline bool init_done(struct zram *zram)
|
||||
{
|
||||
return zram->disksize;
|
||||
|
|
@ -218,47 +197,6 @@ static ssize_t disksize_show(struct device *dev,
|
|||
return scnprintf(buf, PAGE_SIZE, "%llu\n", zram->disksize);
|
||||
}
|
||||
|
||||
static ssize_t orig_data_size_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct zram *zram = dev_to_zram(dev);
|
||||
|
||||
deprecated_attr_warn("orig_data_size");
|
||||
return scnprintf(buf, PAGE_SIZE, "%llu\n",
|
||||
(u64)(atomic64_read(&zram->stats.pages_stored)) << PAGE_SHIFT);
|
||||
}
|
||||
|
||||
static ssize_t mem_used_total_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
u64 val = 0;
|
||||
struct zram *zram = dev_to_zram(dev);
|
||||
|
||||
deprecated_attr_warn("mem_used_total");
|
||||
down_read(&zram->init_lock);
|
||||
if (init_done(zram)) {
|
||||
struct zram_meta *meta = zram->meta;
|
||||
val = zs_get_total_pages(meta->mem_pool);
|
||||
}
|
||||
up_read(&zram->init_lock);
|
||||
|
||||
return scnprintf(buf, PAGE_SIZE, "%llu\n", val << PAGE_SHIFT);
|
||||
}
|
||||
|
||||
static ssize_t mem_limit_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
u64 val;
|
||||
struct zram *zram = dev_to_zram(dev);
|
||||
|
||||
deprecated_attr_warn("mem_limit");
|
||||
down_read(&zram->init_lock);
|
||||
val = zram->limit_pages;
|
||||
up_read(&zram->init_lock);
|
||||
|
||||
return scnprintf(buf, PAGE_SIZE, "%llu\n", val << PAGE_SHIFT);
|
||||
}
|
||||
|
||||
static ssize_t mem_limit_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t len)
|
||||
{
|
||||
|
|
@ -277,21 +215,6 @@ static ssize_t mem_limit_store(struct device *dev,
|
|||
return len;
|
||||
}
|
||||
|
||||
static ssize_t mem_used_max_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
u64 val = 0;
|
||||
struct zram *zram = dev_to_zram(dev);
|
||||
|
||||
deprecated_attr_warn("mem_used_max");
|
||||
down_read(&zram->init_lock);
|
||||
if (init_done(zram))
|
||||
val = atomic_long_read(&zram->stats.max_used_pages);
|
||||
up_read(&zram->init_lock);
|
||||
|
||||
return scnprintf(buf, PAGE_SIZE, "%llu\n", val << PAGE_SHIFT);
|
||||
}
|
||||
|
||||
static ssize_t mem_used_max_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t len)
|
||||
{
|
||||
|
|
@ -467,14 +390,6 @@ static ssize_t debug_stat_show(struct device *dev,
|
|||
static DEVICE_ATTR_RO(io_stat);
|
||||
static DEVICE_ATTR_RO(mm_stat);
|
||||
static DEVICE_ATTR_RO(debug_stat);
|
||||
ZRAM_ATTR_RO(num_reads);
|
||||
ZRAM_ATTR_RO(num_writes);
|
||||
ZRAM_ATTR_RO(failed_reads);
|
||||
ZRAM_ATTR_RO(failed_writes);
|
||||
ZRAM_ATTR_RO(invalid_io);
|
||||
ZRAM_ATTR_RO(notify_free);
|
||||
ZRAM_ATTR_RO(zero_pages);
|
||||
ZRAM_ATTR_RO(compr_data_size);
|
||||
|
||||
static inline bool zram_meta_get(struct zram *zram)
|
||||
{
|
||||
|
|
@ -1188,10 +1103,8 @@ static DEVICE_ATTR_WO(compact);
|
|||
static DEVICE_ATTR_RW(disksize);
|
||||
static DEVICE_ATTR_RO(initstate);
|
||||
static DEVICE_ATTR_WO(reset);
|
||||
static DEVICE_ATTR_RO(orig_data_size);
|
||||
static DEVICE_ATTR_RO(mem_used_total);
|
||||
static DEVICE_ATTR_RW(mem_limit);
|
||||
static DEVICE_ATTR_RW(mem_used_max);
|
||||
static DEVICE_ATTR_WO(mem_limit);
|
||||
static DEVICE_ATTR_WO(mem_used_max);
|
||||
static DEVICE_ATTR_RW(max_comp_streams);
|
||||
static DEVICE_ATTR_RW(comp_algorithm);
|
||||
|
||||
|
|
@ -1199,17 +1112,7 @@ static struct attribute *zram_disk_attrs[] = {
|
|||
&dev_attr_disksize.attr,
|
||||
&dev_attr_initstate.attr,
|
||||
&dev_attr_reset.attr,
|
||||
&dev_attr_num_reads.attr,
|
||||
&dev_attr_num_writes.attr,
|
||||
&dev_attr_failed_reads.attr,
|
||||
&dev_attr_failed_writes.attr,
|
||||
&dev_attr_compact.attr,
|
||||
&dev_attr_invalid_io.attr,
|
||||
&dev_attr_notify_free.attr,
|
||||
&dev_attr_zero_pages.attr,
|
||||
&dev_attr_orig_data_size.attr,
|
||||
&dev_attr_compr_data_size.attr,
|
||||
&dev_attr_mem_used_total.attr,
|
||||
&dev_attr_mem_limit.attr,
|
||||
&dev_attr_mem_used_max.attr,
|
||||
&dev_attr_max_comp_streams.attr,
|
||||
|
|
|
|||
Loading…
Reference in a new issue