diff options
author | Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> | 2017-02-22 18:46:45 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-22 19:41:30 -0500 |
commit | c87d1655c29500b459fb135258a93f8309ada9c7 (patch) | |
tree | c96057875589eb1e11bda89b8947c7631a10de92 /drivers | |
parent | 5d63f81c9e495e1f38fa36208bdcbbe2d2e72960 (diff) |
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/20170118035838.11090-1-sergey.senozhatsky@gmail.com
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/zram/zram_drv.c | 101 |
1 files changed, 2 insertions, 99 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 3cd7856156b4..c73fede582f7 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
@@ -45,27 +45,6 @@ static const char *default_compressor = "lzo"; | |||
45 | /* Module params (documentation at end) */ | 45 | /* Module params (documentation at end) */ |
46 | static unsigned int num_devices = 1; | 46 | static unsigned int num_devices = 1; |
47 | 47 | ||
48 | static inline void deprecated_attr_warn(const char *name) | ||
49 | { | ||
50 | pr_warn_once("%d (%s) Attribute %s (and others) will be removed. %s\n", | ||
51 | task_pid_nr(current), | ||
52 | current->comm, | ||
53 | name, | ||
54 | "See zram documentation."); | ||
55 | } | ||
56 | |||
57 | #define ZRAM_ATTR_RO(name) \ | ||
58 | static ssize_t name##_show(struct device *d, \ | ||
59 | struct device_attribute *attr, char *b) \ | ||
60 | { \ | ||
61 | struct zram *zram = dev_to_zram(d); \ | ||
62 | \ | ||
63 | deprecated_attr_warn(__stringify(name)); \ | ||
64 | return scnprintf(b, PAGE_SIZE, "%llu\n", \ | ||
65 | (u64)atomic64_read(&zram->stats.name)); \ | ||
66 | } \ | ||
67 | static DEVICE_ATTR_RO(name); | ||
68 | |||
69 | static inline bool init_done(struct zram *zram) | 48 | static inline bool init_done(struct zram *zram) |
70 | { | 49 | { |
71 | return zram->disksize; | 50 | return zram->disksize; |
@@ -218,47 +197,6 @@ static ssize_t disksize_show(struct device *dev, | |||
218 | return scnprintf(buf, PAGE_SIZE, "%llu\n", zram->disksize); | 197 | return scnprintf(buf, PAGE_SIZE, "%llu\n", zram->disksize); |
219 | } | 198 | } |
220 | 199 | ||
221 | static ssize_t orig_data_size_show(struct device *dev, | ||
222 | struct device_attribute *attr, char *buf) | ||
223 | { | ||
224 | struct zram *zram = dev_to_zram(dev); | ||
225 | |||
226 | deprecated_attr_warn("orig_data_size"); | ||
227 | return scnprintf(buf, PAGE_SIZE, "%llu\n", | ||
228 | (u64)(atomic64_read(&zram->stats.pages_stored)) << PAGE_SHIFT); | ||
229 | } | ||
230 | |||
231 | static ssize_t mem_used_total_show(struct device *dev, | ||
232 | struct device_attribute *attr, char *buf) | ||
233 | { | ||
234 | u64 val = 0; | ||
235 | struct zram *zram = dev_to_zram(dev); | ||
236 | |||
237 | deprecated_attr_warn("mem_used_total"); | ||
238 | down_read(&zram->init_lock); | ||
239 | if (init_done(zram)) { | ||
240 | struct zram_meta *meta = zram->meta; | ||
241 | val = zs_get_total_pages(meta->mem_pool); | ||
242 | } | ||
243 | up_read(&zram->init_lock); | ||
244 | |||
245 | return scnprintf(buf, PAGE_SIZE, "%llu\n", val << PAGE_SHIFT); | ||
246 | } | ||
247 | |||
248 | static ssize_t mem_limit_show(struct device *dev, | ||
249 | struct device_attribute *attr, char *buf) | ||
250 | { | ||
251 | u64 val; | ||
252 | struct zram *zram = dev_to_zram(dev); | ||
253 | |||
254 | deprecated_attr_warn("mem_limit"); | ||
255 | down_read(&zram->init_lock); | ||
256 | val = zram->limit_pages; | ||
257 | up_read(&zram->init_lock); | ||
258 | |||
259 | return scnprintf(buf, PAGE_SIZE, "%llu\n", val << PAGE_SHIFT); | ||
260 | } | ||
261 | |||
262 | static ssize_t mem_limit_store(struct device *dev, | 200 | static ssize_t mem_limit_store(struct device *dev, |
263 | struct device_attribute *attr, const char *buf, size_t len) | 201 | struct device_attribute *attr, const char *buf, size_t len) |
264 | { | 202 | { |
@@ -277,21 +215,6 @@ static ssize_t mem_limit_store(struct device *dev, | |||
277 | return len; | 215 | return len; |
278 | } | 216 | } |
279 | 217 | ||
280 | static ssize_t mem_used_max_show(struct device *dev, | ||
281 | struct device_attribute *attr, char *buf) | ||
282 | { | ||
283 | u64 val = 0; | ||
284 | struct zram *zram = dev_to_zram(dev); | ||
285 | |||
286 | deprecated_attr_warn("mem_used_max"); | ||
287 | down_read(&zram->init_lock); | ||
288 | if (init_done(zram)) | ||
289 | val = atomic_long_read(&zram->stats.max_used_pages); | ||
290 | up_read(&zram->init_lock); | ||
291 | |||
292 | return scnprintf(buf, PAGE_SIZE, "%llu\n", val << PAGE_SHIFT); | ||
293 | } | ||
294 | |||
295 | static ssize_t mem_used_max_store(struct device *dev, | 218 | static ssize_t mem_used_max_store(struct device *dev, |
296 | struct device_attribute *attr, const char *buf, size_t len) | 219 | struct device_attribute *attr, const char *buf, size_t len) |
297 | { | 220 | { |
@@ -467,14 +390,6 @@ static ssize_t debug_stat_show(struct device *dev, | |||
467 | static DEVICE_ATTR_RO(io_stat); | 390 | static DEVICE_ATTR_RO(io_stat); |
468 | static DEVICE_ATTR_RO(mm_stat); | 391 | static DEVICE_ATTR_RO(mm_stat); |
469 | static DEVICE_ATTR_RO(debug_stat); | 392 | static DEVICE_ATTR_RO(debug_stat); |
470 | ZRAM_ATTR_RO(num_reads); | ||
471 | ZRAM_ATTR_RO(num_writes); | ||
472 | ZRAM_ATTR_RO(failed_reads); | ||
473 | ZRAM_ATTR_RO(failed_writes); | ||
474 | ZRAM_ATTR_RO(invalid_io); | ||
475 | ZRAM_ATTR_RO(notify_free); | ||
476 | ZRAM_ATTR_RO(zero_pages); | ||
477 | ZRAM_ATTR_RO(compr_data_size); | ||
478 | 393 | ||
479 | static inline bool zram_meta_get(struct zram *zram) | 394 | static inline bool zram_meta_get(struct zram *zram) |
480 | { | 395 | { |
@@ -1188,10 +1103,8 @@ static DEVICE_ATTR_WO(compact); | |||
1188 | static DEVICE_ATTR_RW(disksize); | 1103 | static DEVICE_ATTR_RW(disksize); |
1189 | static DEVICE_ATTR_RO(initstate); | 1104 | static DEVICE_ATTR_RO(initstate); |
1190 | static DEVICE_ATTR_WO(reset); | 1105 | static DEVICE_ATTR_WO(reset); |
1191 | static DEVICE_ATTR_RO(orig_data_size); | 1106 | static DEVICE_ATTR_WO(mem_limit); |
1192 | static DEVICE_ATTR_RO(mem_used_total); | 1107 | static DEVICE_ATTR_WO(mem_used_max); |
1193 | static DEVICE_ATTR_RW(mem_limit); | ||
1194 | static DEVICE_ATTR_RW(mem_used_max); | ||
1195 | static DEVICE_ATTR_RW(max_comp_streams); | 1108 | static DEVICE_ATTR_RW(max_comp_streams); |
1196 | static DEVICE_ATTR_RW(comp_algorithm); | 1109 | static DEVICE_ATTR_RW(comp_algorithm); |
1197 | 1110 | ||
@@ -1199,17 +1112,7 @@ static struct attribute *zram_disk_attrs[] = { | |||
1199 | &dev_attr_disksize.attr, | 1112 | &dev_attr_disksize.attr, |
1200 | &dev_attr_initstate.attr, | 1113 | &dev_attr_initstate.attr, |
1201 | &dev_attr_reset.attr, | 1114 | &dev_attr_reset.attr, |
1202 | &dev_attr_num_reads.attr, | ||
1203 | &dev_attr_num_writes.attr, | ||
1204 | &dev_attr_failed_reads.attr, | ||
1205 | &dev_attr_failed_writes.attr, | ||
1206 | &dev_attr_compact.attr, | 1115 | &dev_attr_compact.attr, |
1207 | &dev_attr_invalid_io.attr, | ||
1208 | &dev_attr_notify_free.attr, | ||
1209 | &dev_attr_zero_pages.attr, | ||
1210 | &dev_attr_orig_data_size.attr, | ||
1211 | &dev_attr_compr_data_size.attr, | ||
1212 | &dev_attr_mem_used_total.attr, | ||
1213 | &dev_attr_mem_limit.attr, | 1116 | &dev_attr_mem_limit.attr, |
1214 | &dev_attr_mem_used_max.attr, | 1117 | &dev_attr_mem_used_max.attr, |
1215 | &dev_attr_max_comp_streams.attr, | 1118 | &dev_attr_max_comp_streams.attr, |