diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-15 19:39:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-15 19:39:15 -0400 |
commit | eea3a00264cf243a28e4331566ce67b86059339d (patch) | |
tree | 487f16389e0dfa32e9caa7604d1274a7dcda8f04 /drivers/block | |
parent | e7c82412433a8039616c7314533a0a1c025d99bf (diff) | |
parent | e693d73c20ffdb06840c9378f367bad849ac0d5d (diff) |
Merge branch 'akpm' (patches from Andrew)
Merge second patchbomb from Andrew Morton:
- the rest of MM
- various misc bits
- add ability to run /sbin/reboot at reboot time
- printk/vsprintf changes
- fiddle with seq_printf() return value
* akpm: (114 commits)
parisc: remove use of seq_printf return value
lru_cache: remove use of seq_printf return value
tracing: remove use of seq_printf return value
cgroup: remove use of seq_printf return value
proc: remove use of seq_printf return value
s390: remove use of seq_printf return value
cris fasttimer: remove use of seq_printf return value
cris: remove use of seq_printf return value
openrisc: remove use of seq_printf return value
ARM: plat-pxa: remove use of seq_printf return value
nios2: cpuinfo: remove use of seq_printf return value
microblaze: mb: remove use of seq_printf return value
ipc: remove use of seq_printf return value
rtc: remove use of seq_printf return value
power: wakeup: remove use of seq_printf return value
x86: mtrr: if: remove use of seq_printf return value
linux/bitmap.h: improve BITMAP_{LAST,FIRST}_WORD_MASK
MAINTAINERS: CREDITS: remove Stefano Brivio from B43
.mailmap: add Ricardo Ribalda
CREDITS: add Ricardo Ribalda Delgado
...
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/paride/pg.c | 4 | ||||
-rw-r--r-- | drivers/block/zram/zram_drv.c | 73 | ||||
-rw-r--r-- | drivers/block/zram/zram_drv.h | 1 |
3 files changed, 76 insertions, 2 deletions
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index 2ce3dfd7e6b9..876d0c3eaf58 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c | |||
@@ -137,7 +137,7 @@ | |||
137 | 137 | ||
138 | */ | 138 | */ |
139 | 139 | ||
140 | static bool verbose = 0; | 140 | static int verbose; |
141 | static int major = PG_MAJOR; | 141 | static int major = PG_MAJOR; |
142 | static char *name = PG_NAME; | 142 | static char *name = PG_NAME; |
143 | static int disable = 0; | 143 | static int disable = 0; |
@@ -168,7 +168,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY}; | |||
168 | 168 | ||
169 | #include <asm/uaccess.h> | 169 | #include <asm/uaccess.h> |
170 | 170 | ||
171 | module_param(verbose, bool, 0644); | 171 | module_param(verbose, int, 0644); |
172 | module_param(major, int, 0); | 172 | module_param(major, int, 0); |
173 | module_param(name, charp, 0); | 173 | module_param(name, charp, 0); |
174 | module_param_array(drive0, int, NULL, 0); | 174 | module_param_array(drive0, int, NULL, 0); |
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 871bd3550cb0..c94386aa563d 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
@@ -43,11 +43,22 @@ static const char *default_compressor = "lzo"; | |||
43 | /* Module params (documentation at end) */ | 43 | /* Module params (documentation at end) */ |
44 | static unsigned int num_devices = 1; | 44 | static unsigned int num_devices = 1; |
45 | 45 | ||
46 | static inline void deprecated_attr_warn(const char *name) | ||
47 | { | ||
48 | pr_warn_once("%d (%s) Attribute %s (and others) will be removed. %s\n", | ||
49 | task_pid_nr(current), | ||
50 | current->comm, | ||
51 | name, | ||
52 | "See zram documentation."); | ||
53 | } | ||
54 | |||
46 | #define ZRAM_ATTR_RO(name) \ | 55 | #define ZRAM_ATTR_RO(name) \ |
47 | static ssize_t name##_show(struct device *d, \ | 56 | static ssize_t name##_show(struct device *d, \ |
48 | struct device_attribute *attr, char *b) \ | 57 | struct device_attribute *attr, char *b) \ |
49 | { \ | 58 | { \ |
50 | struct zram *zram = dev_to_zram(d); \ | 59 | struct zram *zram = dev_to_zram(d); \ |
60 | \ | ||
61 | deprecated_attr_warn(__stringify(name)); \ | ||
51 | return scnprintf(b, PAGE_SIZE, "%llu\n", \ | 62 | return scnprintf(b, PAGE_SIZE, "%llu\n", \ |
52 | (u64)atomic64_read(&zram->stats.name)); \ | 63 | (u64)atomic64_read(&zram->stats.name)); \ |
53 | } \ | 64 | } \ |
@@ -89,6 +100,7 @@ static ssize_t orig_data_size_show(struct device *dev, | |||
89 | { | 100 | { |
90 | struct zram *zram = dev_to_zram(dev); | 101 | struct zram *zram = dev_to_zram(dev); |
91 | 102 | ||
103 | deprecated_attr_warn("orig_data_size"); | ||
92 | return scnprintf(buf, PAGE_SIZE, "%llu\n", | 104 | return scnprintf(buf, PAGE_SIZE, "%llu\n", |
93 | (u64)(atomic64_read(&zram->stats.pages_stored)) << PAGE_SHIFT); | 105 | (u64)(atomic64_read(&zram->stats.pages_stored)) << PAGE_SHIFT); |
94 | } | 106 | } |
@@ -99,6 +111,7 @@ static ssize_t mem_used_total_show(struct device *dev, | |||
99 | u64 val = 0; | 111 | u64 val = 0; |
100 | struct zram *zram = dev_to_zram(dev); | 112 | struct zram *zram = dev_to_zram(dev); |
101 | 113 | ||
114 | deprecated_attr_warn("mem_used_total"); | ||
102 | down_read(&zram->init_lock); | 115 | down_read(&zram->init_lock); |
103 | if (init_done(zram)) { | 116 | if (init_done(zram)) { |
104 | struct zram_meta *meta = zram->meta; | 117 | struct zram_meta *meta = zram->meta; |
@@ -128,6 +141,7 @@ static ssize_t mem_limit_show(struct device *dev, | |||
128 | u64 val; | 141 | u64 val; |
129 | struct zram *zram = dev_to_zram(dev); | 142 | struct zram *zram = dev_to_zram(dev); |
130 | 143 | ||
144 | deprecated_attr_warn("mem_limit"); | ||
131 | down_read(&zram->init_lock); | 145 | down_read(&zram->init_lock); |
132 | val = zram->limit_pages; | 146 | val = zram->limit_pages; |
133 | up_read(&zram->init_lock); | 147 | up_read(&zram->init_lock); |
@@ -159,6 +173,7 @@ static ssize_t mem_used_max_show(struct device *dev, | |||
159 | u64 val = 0; | 173 | u64 val = 0; |
160 | struct zram *zram = dev_to_zram(dev); | 174 | struct zram *zram = dev_to_zram(dev); |
161 | 175 | ||
176 | deprecated_attr_warn("mem_used_max"); | ||
162 | down_read(&zram->init_lock); | 177 | down_read(&zram->init_lock); |
163 | if (init_done(zram)) | 178 | if (init_done(zram)) |
164 | val = atomic_long_read(&zram->stats.max_used_pages); | 179 | val = atomic_long_read(&zram->stats.max_used_pages); |
@@ -670,8 +685,12 @@ out: | |||
670 | static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index, | 685 | static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index, |
671 | int offset, int rw) | 686 | int offset, int rw) |
672 | { | 687 | { |
688 | unsigned long start_time = jiffies; | ||
673 | int ret; | 689 | int ret; |
674 | 690 | ||
691 | generic_start_io_acct(rw, bvec->bv_len >> SECTOR_SHIFT, | ||
692 | &zram->disk->part0); | ||
693 | |||
675 | if (rw == READ) { | 694 | if (rw == READ) { |
676 | atomic64_inc(&zram->stats.num_reads); | 695 | atomic64_inc(&zram->stats.num_reads); |
677 | ret = zram_bvec_read(zram, bvec, index, offset); | 696 | ret = zram_bvec_read(zram, bvec, index, offset); |
@@ -680,6 +699,8 @@ static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index, | |||
680 | ret = zram_bvec_write(zram, bvec, index, offset); | 699 | ret = zram_bvec_write(zram, bvec, index, offset); |
681 | } | 700 | } |
682 | 701 | ||
702 | generic_end_io_acct(rw, &zram->disk->part0, start_time); | ||
703 | |||
683 | if (unlikely(ret)) { | 704 | if (unlikely(ret)) { |
684 | if (rw == READ) | 705 | if (rw == READ) |
685 | atomic64_inc(&zram->stats.failed_reads); | 706 | atomic64_inc(&zram->stats.failed_reads); |
@@ -1027,6 +1048,55 @@ static DEVICE_ATTR_RW(mem_used_max); | |||
1027 | static DEVICE_ATTR_RW(max_comp_streams); | 1048 | static DEVICE_ATTR_RW(max_comp_streams); |
1028 | static DEVICE_ATTR_RW(comp_algorithm); | 1049 | static DEVICE_ATTR_RW(comp_algorithm); |
1029 | 1050 | ||
1051 | static ssize_t io_stat_show(struct device *dev, | ||
1052 | struct device_attribute *attr, char *buf) | ||
1053 | { | ||
1054 | struct zram *zram = dev_to_zram(dev); | ||
1055 | ssize_t ret; | ||
1056 | |||
1057 | down_read(&zram->init_lock); | ||
1058 | ret = scnprintf(buf, PAGE_SIZE, | ||
1059 | "%8llu %8llu %8llu %8llu\n", | ||
1060 | (u64)atomic64_read(&zram->stats.failed_reads), | ||
1061 | (u64)atomic64_read(&zram->stats.failed_writes), | ||
1062 | (u64)atomic64_read(&zram->stats.invalid_io), | ||
1063 | (u64)atomic64_read(&zram->stats.notify_free)); | ||
1064 | up_read(&zram->init_lock); | ||
1065 | |||
1066 | return ret; | ||
1067 | } | ||
1068 | |||
1069 | static ssize_t mm_stat_show(struct device *dev, | ||
1070 | struct device_attribute *attr, char *buf) | ||
1071 | { | ||
1072 | struct zram *zram = dev_to_zram(dev); | ||
1073 | u64 orig_size, mem_used = 0; | ||
1074 | long max_used; | ||
1075 | ssize_t ret; | ||
1076 | |||
1077 | down_read(&zram->init_lock); | ||
1078 | if (init_done(zram)) | ||
1079 | mem_used = zs_get_total_pages(zram->meta->mem_pool); | ||
1080 | |||
1081 | orig_size = atomic64_read(&zram->stats.pages_stored); | ||
1082 | max_used = atomic_long_read(&zram->stats.max_used_pages); | ||
1083 | |||
1084 | ret = scnprintf(buf, PAGE_SIZE, | ||
1085 | "%8llu %8llu %8llu %8lu %8ld %8llu %8llu\n", | ||
1086 | orig_size << PAGE_SHIFT, | ||
1087 | (u64)atomic64_read(&zram->stats.compr_data_size), | ||
1088 | mem_used << PAGE_SHIFT, | ||
1089 | zram->limit_pages << PAGE_SHIFT, | ||
1090 | max_used << PAGE_SHIFT, | ||
1091 | (u64)atomic64_read(&zram->stats.zero_pages), | ||
1092 | (u64)atomic64_read(&zram->stats.num_migrated)); | ||
1093 | up_read(&zram->init_lock); | ||
1094 | |||
1095 | return ret; | ||
1096 | } | ||
1097 | |||
1098 | static DEVICE_ATTR_RO(io_stat); | ||
1099 | static DEVICE_ATTR_RO(mm_stat); | ||
1030 | ZRAM_ATTR_RO(num_reads); | 1100 | ZRAM_ATTR_RO(num_reads); |
1031 | ZRAM_ATTR_RO(num_writes); | 1101 | ZRAM_ATTR_RO(num_writes); |
1032 | ZRAM_ATTR_RO(failed_reads); | 1102 | ZRAM_ATTR_RO(failed_reads); |
@@ -1054,6 +1124,8 @@ static struct attribute *zram_disk_attrs[] = { | |||
1054 | &dev_attr_mem_used_max.attr, | 1124 | &dev_attr_mem_used_max.attr, |
1055 | &dev_attr_max_comp_streams.attr, | 1125 | &dev_attr_max_comp_streams.attr, |
1056 | &dev_attr_comp_algorithm.attr, | 1126 | &dev_attr_comp_algorithm.attr, |
1127 | &dev_attr_io_stat.attr, | ||
1128 | &dev_attr_mm_stat.attr, | ||
1057 | NULL, | 1129 | NULL, |
1058 | }; | 1130 | }; |
1059 | 1131 | ||
@@ -1082,6 +1154,7 @@ static int create_device(struct zram *zram, int device_id) | |||
1082 | if (!zram->disk) { | 1154 | if (!zram->disk) { |
1083 | pr_warn("Error allocating disk structure for device %d\n", | 1155 | pr_warn("Error allocating disk structure for device %d\n", |
1084 | device_id); | 1156 | device_id); |
1157 | ret = -ENOMEM; | ||
1085 | goto out_free_queue; | 1158 | goto out_free_queue; |
1086 | } | 1159 | } |
1087 | 1160 | ||
diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h index 17056e589146..570c598f4ce9 100644 --- a/drivers/block/zram/zram_drv.h +++ b/drivers/block/zram/zram_drv.h | |||
@@ -84,6 +84,7 @@ struct zram_stats { | |||
84 | atomic64_t compr_data_size; /* compressed size of pages stored */ | 84 | atomic64_t compr_data_size; /* compressed size of pages stored */ |
85 | atomic64_t num_reads; /* failed + successful */ | 85 | atomic64_t num_reads; /* failed + successful */ |
86 | atomic64_t num_writes; /* --do-- */ | 86 | atomic64_t num_writes; /* --do-- */ |
87 | atomic64_t num_migrated; /* no. of migrated object */ | ||
87 | atomic64_t failed_reads; /* can happen when memory is too low */ | 88 | atomic64_t failed_reads; /* can happen when memory is too low */ |
88 | atomic64_t failed_writes; /* can happen when memory is too low */ | 89 | atomic64_t failed_writes; /* can happen when memory is too low */ |
89 | atomic64_t invalid_io; /* non-page-aligned I/O requests */ | 90 | atomic64_t invalid_io; /* non-page-aligned I/O requests */ |