Commit | Line | Data |
---|---|---|
b2441318 | 1 | // SPDX-License-Identifier: GPL-2.0 |
8324aa91 JA |
2 | /* |
3 | * Functions related to sysfs handling | |
4 | */ | |
5 | #include <linux/kernel.h> | |
5a0e3ad6 | 6 | #include <linux/slab.h> |
8324aa91 JA |
7 | #include <linux/module.h> |
8 | #include <linux/bio.h> | |
9 | #include <linux/blkdev.h> | |
66114cad | 10 | #include <linux/backing-dev.h> |
8324aa91 | 11 | #include <linux/blktrace_api.h> |
320ae51f | 12 | #include <linux/blk-mq.h> |
eea8f41c | 13 | #include <linux/blk-cgroup.h> |
85e0cbbb | 14 | #include <linux/debugfs.h> |
8324aa91 JA |
15 | |
16 | #include "blk.h" | |
3edcc0ce | 17 | #include "blk-mq.h" |
d173a251 | 18 | #include "blk-mq-debugfs.h" |
2aa7745b | 19 | #include "blk-mq-sched.h" |
87760e5e | 20 | #include "blk-wbt.h" |
a7b36ee6 | 21 | #include "blk-throttle.h" |
8324aa91 JA |
22 | |
23 | struct queue_sysfs_entry { | |
24 | struct attribute attr; | |
25 | ssize_t (*show)(struct request_queue *, char *); | |
26 | ssize_t (*store)(struct request_queue *, const char *, size_t); | |
27 | }; | |
28 | ||
29 | static ssize_t | |
9cb308ce | 30 | queue_var_show(unsigned long var, char *page) |
8324aa91 | 31 | { |
9cb308ce | 32 | return sprintf(page, "%lu\n", var); |
8324aa91 JA |
33 | } |
34 | ||
35 | static ssize_t | |
36 | queue_var_store(unsigned long *var, const char *page, size_t count) | |
37 | { | |
b1f3b64d DR |
38 | int err; |
39 | unsigned long v; | |
40 | ||
ed751e68 | 41 | err = kstrtoul(page, 10, &v); |
b1f3b64d DR |
42 | if (err || v > UINT_MAX) |
43 | return -EINVAL; | |
44 | ||
45 | *var = v; | |
8324aa91 | 46 | |
8324aa91 JA |
47 | return count; |
48 | } | |
49 | ||
80e091d1 | 50 | static ssize_t queue_var_store64(s64 *var, const char *page) |
87760e5e JA |
51 | { |
52 | int err; | |
80e091d1 | 53 | s64 v; |
87760e5e | 54 | |
80e091d1 | 55 | err = kstrtos64(page, 10, &v); |
87760e5e JA |
56 | if (err < 0) |
57 | return err; | |
58 | ||
59 | *var = v; | |
60 | return 0; | |
61 | } | |
62 | ||
8324aa91 JA |
63 | static ssize_t queue_requests_show(struct request_queue *q, char *page) |
64 | { | |
28af7428 | 65 | return queue_var_show(q->nr_requests, page); |
8324aa91 JA |
66 | } |
67 | ||
68 | static ssize_t | |
69 | queue_requests_store(struct request_queue *q, const char *page, size_t count) | |
70 | { | |
8324aa91 | 71 | unsigned long nr; |
e3a2b3f9 | 72 | int ret, err; |
b8a9ae77 | 73 | |
344e9ffc | 74 | if (!queue_is_mq(q)) |
b8a9ae77 JA |
75 | return -EINVAL; |
76 | ||
77 | ret = queue_var_store(&nr, page, count); | |
b1f3b64d DR |
78 | if (ret < 0) |
79 | return ret; | |
80 | ||
8324aa91 JA |
81 | if (nr < BLKDEV_MIN_RQ) |
82 | nr = BLKDEV_MIN_RQ; | |
83 | ||
a1ce35fa | 84 | err = blk_mq_update_nr_requests(q, nr); |
e3a2b3f9 JA |
85 | if (err) |
86 | return err; | |
87 | ||
8324aa91 JA |
88 | return ret; |
89 | } | |
90 | ||
91 | static ssize_t queue_ra_show(struct request_queue *q, char *page) | |
92 | { | |
edb0872f | 93 | unsigned long ra_kb; |
8324aa91 | 94 | |
d152c682 | 95 | if (!q->disk) |
edb0872f | 96 | return -EINVAL; |
d152c682 | 97 | ra_kb = q->disk->bdi->ra_pages << (PAGE_SHIFT - 10); |
8c390ff9 | 98 | return queue_var_show(ra_kb, page); |
8324aa91 JA |
99 | } |
100 | ||
101 | static ssize_t | |
102 | queue_ra_store(struct request_queue *q, const char *page, size_t count) | |
103 | { | |
104 | unsigned long ra_kb; | |
edb0872f | 105 | ssize_t ret; |
8324aa91 | 106 | |
d152c682 | 107 | if (!q->disk) |
edb0872f CH |
108 | return -EINVAL; |
109 | ret = queue_var_store(&ra_kb, page, count); | |
b1f3b64d DR |
110 | if (ret < 0) |
111 | return ret; | |
d152c682 | 112 | q->disk->bdi->ra_pages = ra_kb >> (PAGE_SHIFT - 10); |
8324aa91 JA |
113 | return ret; |
114 | } | |
115 | ||
116 | static ssize_t queue_max_sectors_show(struct request_queue *q, char *page) | |
117 | { | |
ae03bf63 | 118 | int max_sectors_kb = queue_max_sectors(q) >> 1; |
8324aa91 | 119 | |
8c390ff9 | 120 | return queue_var_show(max_sectors_kb, page); |
8324aa91 JA |
121 | } |
122 | ||
c77a5710 MP |
123 | static ssize_t queue_max_segments_show(struct request_queue *q, char *page) |
124 | { | |
8c390ff9 | 125 | return queue_var_show(queue_max_segments(q), page); |
c77a5710 MP |
126 | } |
127 | ||
1e739730 CH |
128 | static ssize_t queue_max_discard_segments_show(struct request_queue *q, |
129 | char *page) | |
130 | { | |
8c390ff9 | 131 | return queue_var_show(queue_max_discard_segments(q), page); |
1e739730 CH |
132 | } |
133 | ||
13f05c8d MP |
134 | static ssize_t queue_max_integrity_segments_show(struct request_queue *q, char *page) |
135 | { | |
8c390ff9 | 136 | return queue_var_show(q->limits.max_integrity_segments, page); |
13f05c8d MP |
137 | } |
138 | ||
c77a5710 MP |
139 | static ssize_t queue_max_segment_size_show(struct request_queue *q, char *page) |
140 | { | |
8c390ff9 | 141 | return queue_var_show(queue_max_segment_size(q), page); |
c77a5710 MP |
142 | } |
143 | ||
e1defc4f | 144 | static ssize_t queue_logical_block_size_show(struct request_queue *q, char *page) |
e68b903c | 145 | { |
e1defc4f | 146 | return queue_var_show(queue_logical_block_size(q), page); |
e68b903c MP |
147 | } |
148 | ||
c72758f3 MP |
149 | static ssize_t queue_physical_block_size_show(struct request_queue *q, char *page) |
150 | { | |
151 | return queue_var_show(queue_physical_block_size(q), page); | |
152 | } | |
153 | ||
87caf97c HR |
154 | static ssize_t queue_chunk_sectors_show(struct request_queue *q, char *page) |
155 | { | |
156 | return queue_var_show(q->limits.chunk_sectors, page); | |
157 | } | |
158 | ||
c72758f3 MP |
159 | static ssize_t queue_io_min_show(struct request_queue *q, char *page) |
160 | { | |
161 | return queue_var_show(queue_io_min(q), page); | |
162 | } | |
163 | ||
164 | static ssize_t queue_io_opt_show(struct request_queue *q, char *page) | |
165 | { | |
166 | return queue_var_show(queue_io_opt(q), page); | |
e68b903c MP |
167 | } |
168 | ||
86b37281 MP |
169 | static ssize_t queue_discard_granularity_show(struct request_queue *q, char *page) |
170 | { | |
171 | return queue_var_show(q->limits.discard_granularity, page); | |
172 | } | |
173 | ||
0034af03 JA |
174 | static ssize_t queue_discard_max_hw_show(struct request_queue *q, char *page) |
175 | { | |
0034af03 | 176 | |
18f922d0 A |
177 | return sprintf(page, "%llu\n", |
178 | (unsigned long long)q->limits.max_hw_discard_sectors << 9); | |
0034af03 JA |
179 | } |
180 | ||
86b37281 MP |
181 | static ssize_t queue_discard_max_show(struct request_queue *q, char *page) |
182 | { | |
a934a00a MP |
183 | return sprintf(page, "%llu\n", |
184 | (unsigned long long)q->limits.max_discard_sectors << 9); | |
86b37281 MP |
185 | } |
186 | ||
0034af03 JA |
187 | static ssize_t queue_discard_max_store(struct request_queue *q, |
188 | const char *page, size_t count) | |
189 | { | |
190 | unsigned long max_discard; | |
191 | ssize_t ret = queue_var_store(&max_discard, page, count); | |
192 | ||
193 | if (ret < 0) | |
194 | return ret; | |
195 | ||
196 | if (max_discard & (q->limits.discard_granularity - 1)) | |
197 | return -EINVAL; | |
198 | ||
199 | max_discard >>= 9; | |
200 | if (max_discard > UINT_MAX) | |
201 | return -EINVAL; | |
202 | ||
203 | if (max_discard > q->limits.max_hw_discard_sectors) | |
204 | max_discard = q->limits.max_hw_discard_sectors; | |
205 | ||
206 | q->limits.max_discard_sectors = max_discard; | |
207 | return ret; | |
208 | } | |
209 | ||
98262f27 MP |
210 | static ssize_t queue_discard_zeroes_data_show(struct request_queue *q, char *page) |
211 | { | |
48920ff2 | 212 | return queue_var_show(0, page); |
98262f27 MP |
213 | } |
214 | ||
4363ac7c MP |
215 | static ssize_t queue_write_same_max_show(struct request_queue *q, char *page) |
216 | { | |
217 | return sprintf(page, "%llu\n", | |
218 | (unsigned long long)q->limits.max_write_same_sectors << 9); | |
219 | } | |
220 | ||
a6f0788e CK |
221 | static ssize_t queue_write_zeroes_max_show(struct request_queue *q, char *page) |
222 | { | |
223 | return sprintf(page, "%llu\n", | |
224 | (unsigned long long)q->limits.max_write_zeroes_sectors << 9); | |
225 | } | |
4363ac7c | 226 | |
a805a4fa DLM |
227 | static ssize_t queue_zone_write_granularity_show(struct request_queue *q, |
228 | char *page) | |
229 | { | |
230 | return queue_var_show(queue_zone_write_granularity(q), page); | |
231 | } | |
232 | ||
0512a75b KB |
233 | static ssize_t queue_zone_append_max_show(struct request_queue *q, char *page) |
234 | { | |
235 | unsigned long long max_sectors = q->limits.max_zone_append_sectors; | |
236 | ||
237 | return sprintf(page, "%llu\n", max_sectors << SECTOR_SHIFT); | |
238 | } | |
239 | ||
8324aa91 JA |
240 | static ssize_t |
241 | queue_max_sectors_store(struct request_queue *q, const char *page, size_t count) | |
242 | { | |
243 | unsigned long max_sectors_kb, | |
ae03bf63 | 244 | max_hw_sectors_kb = queue_max_hw_sectors(q) >> 1, |
09cbfeaf | 245 | page_kb = 1 << (PAGE_SHIFT - 10); |
8324aa91 JA |
246 | ssize_t ret = queue_var_store(&max_sectors_kb, page, count); |
247 | ||
b1f3b64d DR |
248 | if (ret < 0) |
249 | return ret; | |
250 | ||
ca369d51 MP |
251 | max_hw_sectors_kb = min_not_zero(max_hw_sectors_kb, (unsigned long) |
252 | q->limits.max_dev_sectors >> 1); | |
253 | ||
8324aa91 JA |
254 | if (max_sectors_kb > max_hw_sectors_kb || max_sectors_kb < page_kb) |
255 | return -EINVAL; | |
7c239517 | 256 | |
0d945c1f | 257 | spin_lock_irq(&q->queue_lock); |
c295fc05 | 258 | q->limits.max_sectors = max_sectors_kb << 1; |
d152c682 CH |
259 | if (q->disk) |
260 | q->disk->bdi->io_pages = max_sectors_kb >> (PAGE_SHIFT - 10); | |
0d945c1f | 261 | spin_unlock_irq(&q->queue_lock); |
8324aa91 JA |
262 | |
263 | return ret; | |
264 | } | |
265 | ||
266 | static ssize_t queue_max_hw_sectors_show(struct request_queue *q, char *page) | |
267 | { | |
ae03bf63 | 268 | int max_hw_sectors_kb = queue_max_hw_sectors(q) >> 1; |
8324aa91 | 269 | |
8c390ff9 | 270 | return queue_var_show(max_hw_sectors_kb, page); |
8324aa91 JA |
271 | } |
272 | ||
28af7428 MG |
273 | static ssize_t queue_virt_boundary_mask_show(struct request_queue *q, char *page) |
274 | { | |
8c390ff9 | 275 | return queue_var_show(q->limits.virt_boundary_mask, page); |
28af7428 MG |
276 | } |
277 | ||
956bcb7c JA |
278 | #define QUEUE_SYSFS_BIT_FNS(name, flag, neg) \ |
279 | static ssize_t \ | |
fc93fe14 | 280 | queue_##name##_show(struct request_queue *q, char *page) \ |
956bcb7c JA |
281 | { \ |
282 | int bit; \ | |
283 | bit = test_bit(QUEUE_FLAG_##flag, &q->queue_flags); \ | |
284 | return queue_var_show(neg ? !bit : bit, page); \ | |
285 | } \ | |
286 | static ssize_t \ | |
fc93fe14 | 287 | queue_##name##_store(struct request_queue *q, const char *page, size_t count) \ |
956bcb7c JA |
288 | { \ |
289 | unsigned long val; \ | |
290 | ssize_t ret; \ | |
291 | ret = queue_var_store(&val, page, count); \ | |
c678ef52 AB |
292 | if (ret < 0) \ |
293 | return ret; \ | |
956bcb7c JA |
294 | if (neg) \ |
295 | val = !val; \ | |
296 | \ | |
956bcb7c | 297 | if (val) \ |
8814ce8a | 298 | blk_queue_flag_set(QUEUE_FLAG_##flag, q); \ |
956bcb7c | 299 | else \ |
8814ce8a | 300 | blk_queue_flag_clear(QUEUE_FLAG_##flag, q); \ |
956bcb7c | 301 | return ret; \ |
1308835f BZ |
302 | } |
303 | ||
956bcb7c JA |
304 | QUEUE_SYSFS_BIT_FNS(nonrot, NONROT, 1); |
305 | QUEUE_SYSFS_BIT_FNS(random, ADD_RANDOM, 0); | |
306 | QUEUE_SYSFS_BIT_FNS(iostats, IO_STAT, 0); | |
1cb039f3 | 307 | QUEUE_SYSFS_BIT_FNS(stable_writes, STABLE_WRITES, 0); |
956bcb7c | 308 | #undef QUEUE_SYSFS_BIT_FNS |
1308835f | 309 | |
797476b8 DLM |
310 | static ssize_t queue_zoned_show(struct request_queue *q, char *page) |
311 | { | |
312 | switch (blk_queue_zoned_model(q)) { | |
313 | case BLK_ZONED_HA: | |
314 | return sprintf(page, "host-aware\n"); | |
315 | case BLK_ZONED_HM: | |
316 | return sprintf(page, "host-managed\n"); | |
317 | default: | |
318 | return sprintf(page, "none\n"); | |
319 | } | |
320 | } | |
321 | ||
965b652e DLM |
322 | static ssize_t queue_nr_zones_show(struct request_queue *q, char *page) |
323 | { | |
324 | return queue_var_show(blk_queue_nr_zones(q), page); | |
325 | } | |
326 | ||
e15864f8 NC |
327 | static ssize_t queue_max_open_zones_show(struct request_queue *q, char *page) |
328 | { | |
329 | return queue_var_show(queue_max_open_zones(q), page); | |
330 | } | |
331 | ||
659bf827 NC |
332 | static ssize_t queue_max_active_zones_show(struct request_queue *q, char *page) |
333 | { | |
334 | return queue_var_show(queue_max_active_zones(q), page); | |
335 | } | |
336 | ||
ac9fafa1 AB |
337 | static ssize_t queue_nomerges_show(struct request_queue *q, char *page) |
338 | { | |
488991e2 AB |
339 | return queue_var_show((blk_queue_nomerges(q) << 1) | |
340 | blk_queue_noxmerges(q), page); | |
ac9fafa1 AB |
341 | } |
342 | ||
343 | static ssize_t queue_nomerges_store(struct request_queue *q, const char *page, | |
344 | size_t count) | |
345 | { | |
346 | unsigned long nm; | |
347 | ssize_t ret = queue_var_store(&nm, page, count); | |
348 | ||
b1f3b64d DR |
349 | if (ret < 0) |
350 | return ret; | |
351 | ||
57d74df9 CH |
352 | blk_queue_flag_clear(QUEUE_FLAG_NOMERGES, q); |
353 | blk_queue_flag_clear(QUEUE_FLAG_NOXMERGES, q); | |
488991e2 | 354 | if (nm == 2) |
57d74df9 | 355 | blk_queue_flag_set(QUEUE_FLAG_NOMERGES, q); |
488991e2 | 356 | else if (nm) |
57d74df9 | 357 | blk_queue_flag_set(QUEUE_FLAG_NOXMERGES, q); |
1308835f | 358 | |
ac9fafa1 AB |
359 | return ret; |
360 | } | |
361 | ||
c7c22e4d JA |
362 | static ssize_t queue_rq_affinity_show(struct request_queue *q, char *page) |
363 | { | |
9cb308ce | 364 | bool set = test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags); |
5757a6d7 | 365 | bool force = test_bit(QUEUE_FLAG_SAME_FORCE, &q->queue_flags); |
c7c22e4d | 366 | |
5757a6d7 | 367 | return queue_var_show(set << force, page); |
c7c22e4d JA |
368 | } |
369 | ||
370 | static ssize_t | |
371 | queue_rq_affinity_store(struct request_queue *q, const char *page, size_t count) | |
372 | { | |
373 | ssize_t ret = -EINVAL; | |
0a06ff06 | 374 | #ifdef CONFIG_SMP |
c7c22e4d JA |
375 | unsigned long val; |
376 | ||
377 | ret = queue_var_store(&val, page, count); | |
b1f3b64d DR |
378 | if (ret < 0) |
379 | return ret; | |
380 | ||
e8037d49 | 381 | if (val == 2) { |
57d74df9 CH |
382 | blk_queue_flag_set(QUEUE_FLAG_SAME_COMP, q); |
383 | blk_queue_flag_set(QUEUE_FLAG_SAME_FORCE, q); | |
e8037d49 | 384 | } else if (val == 1) { |
57d74df9 CH |
385 | blk_queue_flag_set(QUEUE_FLAG_SAME_COMP, q); |
386 | blk_queue_flag_clear(QUEUE_FLAG_SAME_FORCE, q); | |
e8037d49 | 387 | } else if (val == 0) { |
57d74df9 CH |
388 | blk_queue_flag_clear(QUEUE_FLAG_SAME_COMP, q); |
389 | blk_queue_flag_clear(QUEUE_FLAG_SAME_FORCE, q); | |
5757a6d7 | 390 | } |
c7c22e4d JA |
391 | #endif |
392 | return ret; | |
393 | } | |
8324aa91 | 394 | |
06426adf JA |
395 | static ssize_t queue_poll_delay_show(struct request_queue *q, char *page) |
396 | { | |
64f1c21e JA |
397 | int val; |
398 | ||
29ece8b4 YY |
399 | if (q->poll_nsec == BLK_MQ_POLL_CLASSIC) |
400 | val = BLK_MQ_POLL_CLASSIC; | |
64f1c21e JA |
401 | else |
402 | val = q->poll_nsec / 1000; | |
403 | ||
404 | return sprintf(page, "%d\n", val); | |
06426adf JA |
405 | } |
406 | ||
407 | static ssize_t queue_poll_delay_store(struct request_queue *q, const char *page, | |
408 | size_t count) | |
409 | { | |
64f1c21e | 410 | int err, val; |
06426adf JA |
411 | |
412 | if (!q->mq_ops || !q->mq_ops->poll) | |
413 | return -EINVAL; | |
414 | ||
64f1c21e JA |
415 | err = kstrtoint(page, 10, &val); |
416 | if (err < 0) | |
417 | return err; | |
06426adf | 418 | |
29ece8b4 YY |
419 | if (val == BLK_MQ_POLL_CLASSIC) |
420 | q->poll_nsec = BLK_MQ_POLL_CLASSIC; | |
421 | else if (val >= 0) | |
64f1c21e | 422 | q->poll_nsec = val * 1000; |
29ece8b4 YY |
423 | else |
424 | return -EINVAL; | |
64f1c21e JA |
425 | |
426 | return count; | |
06426adf JA |
427 | } |
428 | ||
05229bee JA |
429 | static ssize_t queue_poll_show(struct request_queue *q, char *page) |
430 | { | |
431 | return queue_var_show(test_bit(QUEUE_FLAG_POLL, &q->queue_flags), page); | |
432 | } | |
433 | ||
434 | static ssize_t queue_poll_store(struct request_queue *q, const char *page, | |
435 | size_t count) | |
436 | { | |
a614dd22 | 437 | if (!test_bit(QUEUE_FLAG_POLL, &q->queue_flags)) |
05229bee | 438 | return -EINVAL; |
a614dd22 CH |
439 | pr_info_ratelimited("writes to the poll attribute are ignored.\n"); |
440 | pr_info_ratelimited("please use driver specific parameters instead.\n"); | |
441 | return count; | |
05229bee JA |
442 | } |
443 | ||
65cd1d13 WZ |
444 | static ssize_t queue_io_timeout_show(struct request_queue *q, char *page) |
445 | { | |
446 | return sprintf(page, "%u\n", jiffies_to_msecs(q->rq_timeout)); | |
447 | } | |
448 | ||
449 | static ssize_t queue_io_timeout_store(struct request_queue *q, const char *page, | |
450 | size_t count) | |
451 | { | |
452 | unsigned int val; | |
453 | int err; | |
454 | ||
455 | err = kstrtou32(page, 10, &val); | |
456 | if (err || val == 0) | |
457 | return -EINVAL; | |
458 | ||
459 | blk_queue_rq_timeout(q, msecs_to_jiffies(val)); | |
460 | ||
461 | return count; | |
462 | } | |
463 | ||
87760e5e JA |
464 | static ssize_t queue_wb_lat_show(struct request_queue *q, char *page) |
465 | { | |
a7905043 | 466 | if (!wbt_rq_qos(q)) |
87760e5e JA |
467 | return -EINVAL; |
468 | ||
a7905043 | 469 | return sprintf(page, "%llu\n", div_u64(wbt_get_min_lat(q), 1000)); |
87760e5e JA |
470 | } |
471 | ||
472 | static ssize_t queue_wb_lat_store(struct request_queue *q, const char *page, | |
473 | size_t count) | |
474 | { | |
a7905043 | 475 | struct rq_qos *rqos; |
87760e5e | 476 | ssize_t ret; |
80e091d1 | 477 | s64 val; |
87760e5e | 478 | |
87760e5e JA |
479 | ret = queue_var_store64(&val, page); |
480 | if (ret < 0) | |
481 | return ret; | |
d62118b6 JA |
482 | if (val < -1) |
483 | return -EINVAL; | |
484 | ||
a7905043 JB |
485 | rqos = wbt_rq_qos(q); |
486 | if (!rqos) { | |
d62118b6 JA |
487 | ret = wbt_init(q); |
488 | if (ret) | |
489 | return ret; | |
d62118b6 | 490 | } |
87760e5e | 491 | |
80e091d1 | 492 | if (val == -1) |
a7905043 | 493 | val = wbt_default_latency_nsec(q); |
80e091d1 | 494 | else if (val >= 0) |
a7905043 | 495 | val *= 1000ULL; |
d62118b6 | 496 | |
b7143fe6 AZ |
497 | if (wbt_get_min_lat(q) == val) |
498 | return count; | |
499 | ||
c125311d JA |
500 | /* |
501 | * Ensure that the queue is idled, in case the latency update | |
502 | * ends up either enabling or disabling wbt completely. We can't | |
503 | * have IO inflight if that happens. | |
504 | */ | |
a1ce35fa JA |
505 | blk_mq_freeze_queue(q); |
506 | blk_mq_quiesce_queue(q); | |
80e091d1 | 507 | |
c125311d | 508 | wbt_set_min_lat(q, val); |
c125311d | 509 | |
a1ce35fa JA |
510 | blk_mq_unquiesce_queue(q); |
511 | blk_mq_unfreeze_queue(q); | |
c125311d | 512 | |
87760e5e JA |
513 | return count; |
514 | } | |
515 | ||
93e9d8e8 JA |
516 | static ssize_t queue_wc_show(struct request_queue *q, char *page) |
517 | { | |
518 | if (test_bit(QUEUE_FLAG_WC, &q->queue_flags)) | |
519 | return sprintf(page, "write back\n"); | |
520 | ||
521 | return sprintf(page, "write through\n"); | |
522 | } | |
523 | ||
524 | static ssize_t queue_wc_store(struct request_queue *q, const char *page, | |
525 | size_t count) | |
526 | { | |
527 | int set = -1; | |
528 | ||
529 | if (!strncmp(page, "write back", 10)) | |
530 | set = 1; | |
531 | else if (!strncmp(page, "write through", 13) || | |
532 | !strncmp(page, "none", 4)) | |
533 | set = 0; | |
534 | ||
535 | if (set == -1) | |
536 | return -EINVAL; | |
537 | ||
93e9d8e8 | 538 | if (set) |
8814ce8a | 539 | blk_queue_flag_set(QUEUE_FLAG_WC, q); |
93e9d8e8 | 540 | else |
8814ce8a | 541 | blk_queue_flag_clear(QUEUE_FLAG_WC, q); |
93e9d8e8 JA |
542 | |
543 | return count; | |
544 | } | |
545 | ||
6fcefbe5 KO |
546 | static ssize_t queue_fua_show(struct request_queue *q, char *page) |
547 | { | |
548 | return sprintf(page, "%u\n", test_bit(QUEUE_FLAG_FUA, &q->queue_flags)); | |
549 | } | |
550 | ||
ea6ca600 YK |
551 | static ssize_t queue_dax_show(struct request_queue *q, char *page) |
552 | { | |
553 | return queue_var_show(blk_queue_dax(q), page); | |
554 | } | |
555 | ||
35626147 CH |
556 | #define QUEUE_RO_ENTRY(_prefix, _name) \ |
557 | static struct queue_sysfs_entry _prefix##_entry = { \ | |
558 | .attr = { .name = _name, .mode = 0444 }, \ | |
559 | .show = _prefix##_show, \ | |
560 | }; | |
561 | ||
562 | #define QUEUE_RW_ENTRY(_prefix, _name) \ | |
563 | static struct queue_sysfs_entry _prefix##_entry = { \ | |
564 | .attr = { .name = _name, .mode = 0644 }, \ | |
565 | .show = _prefix##_show, \ | |
566 | .store = _prefix##_store, \ | |
567 | }; | |
568 | ||
569 | QUEUE_RW_ENTRY(queue_requests, "nr_requests"); | |
570 | QUEUE_RW_ENTRY(queue_ra, "read_ahead_kb"); | |
571 | QUEUE_RW_ENTRY(queue_max_sectors, "max_sectors_kb"); | |
572 | QUEUE_RO_ENTRY(queue_max_hw_sectors, "max_hw_sectors_kb"); | |
573 | QUEUE_RO_ENTRY(queue_max_segments, "max_segments"); | |
574 | QUEUE_RO_ENTRY(queue_max_integrity_segments, "max_integrity_segments"); | |
575 | QUEUE_RO_ENTRY(queue_max_segment_size, "max_segment_size"); | |
576 | QUEUE_RW_ENTRY(elv_iosched, "scheduler"); | |
577 | ||
578 | QUEUE_RO_ENTRY(queue_logical_block_size, "logical_block_size"); | |
579 | QUEUE_RO_ENTRY(queue_physical_block_size, "physical_block_size"); | |
580 | QUEUE_RO_ENTRY(queue_chunk_sectors, "chunk_sectors"); | |
581 | QUEUE_RO_ENTRY(queue_io_min, "minimum_io_size"); | |
582 | QUEUE_RO_ENTRY(queue_io_opt, "optimal_io_size"); | |
583 | ||
584 | QUEUE_RO_ENTRY(queue_max_discard_segments, "max_discard_segments"); | |
585 | QUEUE_RO_ENTRY(queue_discard_granularity, "discard_granularity"); | |
586 | QUEUE_RO_ENTRY(queue_discard_max_hw, "discard_max_hw_bytes"); | |
587 | QUEUE_RW_ENTRY(queue_discard_max, "discard_max_bytes"); | |
588 | QUEUE_RO_ENTRY(queue_discard_zeroes_data, "discard_zeroes_data"); | |
589 | ||
590 | QUEUE_RO_ENTRY(queue_write_same_max, "write_same_max_bytes"); | |
591 | QUEUE_RO_ENTRY(queue_write_zeroes_max, "write_zeroes_max_bytes"); | |
592 | QUEUE_RO_ENTRY(queue_zone_append_max, "zone_append_max_bytes"); | |
a805a4fa | 593 | QUEUE_RO_ENTRY(queue_zone_write_granularity, "zone_write_granularity"); |
35626147 CH |
594 | |
595 | QUEUE_RO_ENTRY(queue_zoned, "zoned"); | |
596 | QUEUE_RO_ENTRY(queue_nr_zones, "nr_zones"); | |
597 | QUEUE_RO_ENTRY(queue_max_open_zones, "max_open_zones"); | |
598 | QUEUE_RO_ENTRY(queue_max_active_zones, "max_active_zones"); | |
599 | ||
600 | QUEUE_RW_ENTRY(queue_nomerges, "nomerges"); | |
601 | QUEUE_RW_ENTRY(queue_rq_affinity, "rq_affinity"); | |
602 | QUEUE_RW_ENTRY(queue_poll, "io_poll"); | |
603 | QUEUE_RW_ENTRY(queue_poll_delay, "io_poll_delay"); | |
604 | QUEUE_RW_ENTRY(queue_wc, "write_cache"); | |
605 | QUEUE_RO_ENTRY(queue_fua, "fua"); | |
606 | QUEUE_RO_ENTRY(queue_dax, "dax"); | |
607 | QUEUE_RW_ENTRY(queue_io_timeout, "io_timeout"); | |
608 | QUEUE_RW_ENTRY(queue_wb_lat, "wbt_lat_usec"); | |
28af7428 | 609 | QUEUE_RO_ENTRY(queue_virt_boundary_mask, "virt_boundary_mask"); |
8324aa91 | 610 | |
35626147 CH |
611 | #ifdef CONFIG_BLK_DEV_THROTTLING_LOW |
612 | QUEUE_RW_ENTRY(blk_throtl_sample_time, "throttle_sample_time"); | |
613 | #endif | |
8324aa91 | 614 | |
35626147 | 615 | /* legacy alias for logical_block_size: */ |
e68b903c | 616 | static struct queue_sysfs_entry queue_hw_sector_size_entry = { |
5657a819 | 617 | .attr = {.name = "hw_sector_size", .mode = 0444 }, |
e1defc4f MP |
618 | .show = queue_logical_block_size_show, |
619 | }; | |
620 | ||
fc93fe14 CH |
621 | QUEUE_RW_ENTRY(queue_nonrot, "rotational"); |
622 | QUEUE_RW_ENTRY(queue_iostats, "iostats"); | |
623 | QUEUE_RW_ENTRY(queue_random, "add_random"); | |
1cb039f3 | 624 | QUEUE_RW_ENTRY(queue_stable_writes, "stable_writes"); |
e2e1a148 | 625 | |
4d25339e | 626 | static struct attribute *queue_attrs[] = { |
8324aa91 JA |
627 | &queue_requests_entry.attr, |
628 | &queue_ra_entry.attr, | |
629 | &queue_max_hw_sectors_entry.attr, | |
630 | &queue_max_sectors_entry.attr, | |
c77a5710 | 631 | &queue_max_segments_entry.attr, |
1e739730 | 632 | &queue_max_discard_segments_entry.attr, |
13f05c8d | 633 | &queue_max_integrity_segments_entry.attr, |
c77a5710 | 634 | &queue_max_segment_size_entry.attr, |
35626147 | 635 | &elv_iosched_entry.attr, |
e68b903c | 636 | &queue_hw_sector_size_entry.attr, |
e1defc4f | 637 | &queue_logical_block_size_entry.attr, |
c72758f3 | 638 | &queue_physical_block_size_entry.attr, |
87caf97c | 639 | &queue_chunk_sectors_entry.attr, |
c72758f3 MP |
640 | &queue_io_min_entry.attr, |
641 | &queue_io_opt_entry.attr, | |
86b37281 MP |
642 | &queue_discard_granularity_entry.attr, |
643 | &queue_discard_max_entry.attr, | |
0034af03 | 644 | &queue_discard_max_hw_entry.attr, |
98262f27 | 645 | &queue_discard_zeroes_data_entry.attr, |
4363ac7c | 646 | &queue_write_same_max_entry.attr, |
a6f0788e | 647 | &queue_write_zeroes_max_entry.attr, |
0512a75b | 648 | &queue_zone_append_max_entry.attr, |
a805a4fa | 649 | &queue_zone_write_granularity_entry.attr, |
1308835f | 650 | &queue_nonrot_entry.attr, |
797476b8 | 651 | &queue_zoned_entry.attr, |
965b652e | 652 | &queue_nr_zones_entry.attr, |
e15864f8 | 653 | &queue_max_open_zones_entry.attr, |
659bf827 | 654 | &queue_max_active_zones_entry.attr, |
ac9fafa1 | 655 | &queue_nomerges_entry.attr, |
c7c22e4d | 656 | &queue_rq_affinity_entry.attr, |
bc58ba94 | 657 | &queue_iostats_entry.attr, |
1cb039f3 | 658 | &queue_stable_writes_entry.attr, |
e2e1a148 | 659 | &queue_random_entry.attr, |
05229bee | 660 | &queue_poll_entry.attr, |
93e9d8e8 | 661 | &queue_wc_entry.attr, |
6fcefbe5 | 662 | &queue_fua_entry.attr, |
ea6ca600 | 663 | &queue_dax_entry.attr, |
87760e5e | 664 | &queue_wb_lat_entry.attr, |
06426adf | 665 | &queue_poll_delay_entry.attr, |
65cd1d13 | 666 | &queue_io_timeout_entry.attr, |
297e3d85 | 667 | #ifdef CONFIG_BLK_DEV_THROTTLING_LOW |
35626147 | 668 | &blk_throtl_sample_time_entry.attr, |
297e3d85 | 669 | #endif |
28af7428 | 670 | &queue_virt_boundary_mask_entry.attr, |
8324aa91 JA |
671 | NULL, |
672 | }; | |
673 | ||
4d25339e WZ |
674 | static umode_t queue_attr_visible(struct kobject *kobj, struct attribute *attr, |
675 | int n) | |
676 | { | |
677 | struct request_queue *q = | |
678 | container_of(kobj, struct request_queue, kobj); | |
679 | ||
680 | if (attr == &queue_io_timeout_entry.attr && | |
681 | (!q->mq_ops || !q->mq_ops->timeout)) | |
682 | return 0; | |
683 | ||
659bf827 NC |
684 | if ((attr == &queue_max_open_zones_entry.attr || |
685 | attr == &queue_max_active_zones_entry.attr) && | |
e15864f8 NC |
686 | !blk_queue_is_zoned(q)) |
687 | return 0; | |
688 | ||
4d25339e WZ |
689 | return attr->mode; |
690 | } | |
691 | ||
692 | static struct attribute_group queue_attr_group = { | |
693 | .attrs = queue_attrs, | |
694 | .is_visible = queue_attr_visible, | |
695 | }; | |
696 | ||
697 | ||
8324aa91 JA |
698 | #define to_queue(atr) container_of((atr), struct queue_sysfs_entry, attr) |
699 | ||
700 | static ssize_t | |
701 | queue_attr_show(struct kobject *kobj, struct attribute *attr, char *page) | |
702 | { | |
703 | struct queue_sysfs_entry *entry = to_queue(attr); | |
704 | struct request_queue *q = | |
705 | container_of(kobj, struct request_queue, kobj); | |
706 | ssize_t res; | |
707 | ||
708 | if (!entry->show) | |
709 | return -EIO; | |
710 | mutex_lock(&q->sysfs_lock); | |
8324aa91 JA |
711 | res = entry->show(q, page); |
712 | mutex_unlock(&q->sysfs_lock); | |
713 | return res; | |
714 | } | |
715 | ||
716 | static ssize_t | |
717 | queue_attr_store(struct kobject *kobj, struct attribute *attr, | |
718 | const char *page, size_t length) | |
719 | { | |
720 | struct queue_sysfs_entry *entry = to_queue(attr); | |
6728cb0e | 721 | struct request_queue *q; |
8324aa91 JA |
722 | ssize_t res; |
723 | ||
724 | if (!entry->store) | |
725 | return -EIO; | |
6728cb0e JA |
726 | |
727 | q = container_of(kobj, struct request_queue, kobj); | |
8324aa91 | 728 | mutex_lock(&q->sysfs_lock); |
8324aa91 JA |
729 | res = entry->store(q, page, length); |
730 | mutex_unlock(&q->sysfs_lock); | |
731 | return res; | |
732 | } | |
733 | ||
548bc8e1 TH |
734 | static void blk_free_queue_rcu(struct rcu_head *rcu_head) |
735 | { | |
736 | struct request_queue *q = container_of(rcu_head, struct request_queue, | |
737 | rcu_head); | |
704b914f ML |
738 | |
739 | kmem_cache_free(blk_get_queue_kmem_cache(blk_queue_has_srcu(q)), q); | |
548bc8e1 TH |
740 | } |
741 | ||
47cdee29 ML |
742 | /* Unconfigure the I/O scheduler and dissociate from the cgroup controller. */ |
743 | static void blk_exit_queue(struct request_queue *q) | |
744 | { | |
745 | /* | |
746 | * Since the I/O scheduler exit code may access cgroup information, | |
747 | * perform I/O scheduler exit before disassociating from the block | |
748 | * cgroup controller. | |
749 | */ | |
750 | if (q->elevator) { | |
751 | ioc_clear_queue(q); | |
0c6cb3a2 | 752 | elevator_exit(q); |
47cdee29 ML |
753 | } |
754 | ||
755 | /* | |
756 | * Remove all references to @q from the block cgroup controller before | |
757 | * restoring @q->queue_lock to avoid that restoring this pointer causes | |
758 | * e.g. blkcg_print_blkgs() to crash. | |
759 | */ | |
760 | blkcg_exit_queue(q); | |
47cdee29 ML |
761 | } |
762 | ||
8324aa91 | 763 | /** |
e8c7d14a LC |
764 | * blk_release_queue - releases all allocated resources of the request_queue |
765 | * @kobj: pointer to a kobject, whose container is a request_queue | |
766 | * | |
767 | * This function releases all allocated resources of the request queue. | |
768 | * | |
769 | * The struct request_queue refcount is incremented with blk_get_queue() and | |
770 | * decremented with blk_put_queue(). Once the refcount reaches 0 this function | |
771 | * is called. | |
772 | * | |
773 | * For drivers that have a request_queue on a gendisk and added with | |
774 | * __device_add_disk() the refcount to request_queue will reach 0 with | |
775 | * the last put_disk() called by the driver. For drivers which don't use | |
776 | * __device_add_disk() this happens with blk_cleanup_queue(). | |
8324aa91 | 777 | * |
e8c7d14a LC |
778 | * Drivers exist which depend on the release of the request_queue to be |
779 | * synchronous, it should not be deferred. | |
780 | * | |
781 | * Context: can sleep | |
dc9edc44 | 782 | */ |
e8c7d14a | 783 | static void blk_release_queue(struct kobject *kobj) |
8324aa91 | 784 | { |
e8c7d14a LC |
785 | struct request_queue *q = |
786 | container_of(kobj, struct request_queue, kobj); | |
787 | ||
788 | might_sleep(); | |
8324aa91 | 789 | |
48b5c1fb | 790 | if (q->poll_stat) |
34dbad5d OS |
791 | blk_stat_remove_callback(q, q->poll_cb); |
792 | blk_stat_free_callback(q->poll_cb); | |
777eb1bf | 793 | |
37e11c36 ML |
794 | blk_exit_queue(q); |
795 | ||
34dbad5d | 796 | blk_free_queue_stats(q->stats); |
48b5c1fb | 797 | kfree(q->poll_stat); |
34dbad5d | 798 | |
bf505456 DLM |
799 | blk_queue_free_zone_bitmaps(q); |
800 | ||
344e9ffc | 801 | if (queue_is_mq(q)) |
e09aae7e | 802 | blk_mq_release(q); |
18741986 | 803 | |
8324aa91 | 804 | blk_trace_shutdown(q); |
85e0cbbb LC |
805 | mutex_lock(&q->debugfs_mutex); |
806 | debugfs_remove_recursive(q->debugfs_dir); | |
807 | mutex_unlock(&q->debugfs_mutex); | |
8324aa91 | 808 | |
344e9ffc | 809 | if (queue_is_mq(q)) |
62ebce16 OS |
810 | blk_mq_debugfs_unregister(q); |
811 | ||
338aa96d | 812 | bioset_exit(&q->bio_split); |
54efd50b | 813 | |
a73f730d | 814 | ida_simple_remove(&blk_queue_ida, q->id); |
548bc8e1 | 815 | call_rcu(&q->rcu_head, blk_free_queue_rcu); |
8324aa91 JA |
816 | } |
817 | ||
52cf25d0 | 818 | static const struct sysfs_ops queue_sysfs_ops = { |
8324aa91 JA |
819 | .show = queue_attr_show, |
820 | .store = queue_attr_store, | |
821 | }; | |
822 | ||
823 | struct kobj_type blk_queue_ktype = { | |
824 | .sysfs_ops = &queue_sysfs_ops, | |
8324aa91 JA |
825 | .release = blk_release_queue, |
826 | }; | |
827 | ||
2c2086af BVA |
828 | /** |
829 | * blk_register_queue - register a block layer queue with sysfs | |
830 | * @disk: Disk of which the request queue should be registered with sysfs. | |
831 | */ | |
8324aa91 JA |
832 | int blk_register_queue(struct gendisk *disk) |
833 | { | |
834 | int ret; | |
1d54ad6d | 835 | struct device *dev = disk_to_dev(disk); |
8324aa91 JA |
836 | struct request_queue *q = disk->queue; |
837 | ||
1d54ad6d LZ |
838 | ret = blk_trace_init_sysfs(dev); |
839 | if (ret) | |
840 | return ret; | |
841 | ||
cecf5d87 | 842 | mutex_lock(&q->sysfs_dir_lock); |
b410aff2 | 843 | |
c9059598 | 844 | ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue"); |
ed5302d3 LY |
845 | if (ret < 0) { |
846 | blk_trace_remove_sysfs(dev); | |
b410aff2 | 847 | goto unlock; |
ed5302d3 | 848 | } |
8324aa91 | 849 | |
4d25339e WZ |
850 | ret = sysfs_create_group(&q->kobj, &queue_attr_group); |
851 | if (ret) { | |
852 | blk_trace_remove_sysfs(dev); | |
853 | kobject_del(&q->kobj); | |
854 | kobject_put(&dev->kobj); | |
855 | goto unlock; | |
856 | } | |
857 | ||
85e0cbbb LC |
858 | mutex_lock(&q->debugfs_mutex); |
859 | q->debugfs_dir = debugfs_create_dir(kobject_name(q->kobj.parent), | |
860 | blk_debugfs_root); | |
861 | mutex_unlock(&q->debugfs_mutex); | |
862 | ||
344e9ffc | 863 | if (queue_is_mq(q)) { |
2d0364c8 | 864 | __blk_mq_register_dev(dev, q); |
a8ecdd71 BVA |
865 | blk_mq_debugfs_register(q); |
866 | } | |
9c1051aa | 867 | |
b89f625e | 868 | mutex_lock(&q->sysfs_lock); |
a2247f19 DLM |
869 | |
870 | ret = disk_register_independent_access_ranges(disk, NULL); | |
871 | if (ret) | |
872 | goto put_dev; | |
873 | ||
344e9ffc | 874 | if (q->elevator) { |
cecf5d87 | 875 | ret = elv_register_queue(q, false); |
a2247f19 DLM |
876 | if (ret) |
877 | goto put_dev; | |
8324aa91 | 878 | } |
cecf5d87 | 879 | |
cecf5d87 ML |
880 | blk_queue_flag_set(QUEUE_FLAG_REGISTERED, q); |
881 | wbt_enable_default(q); | |
882 | blk_throtl_register_queue(q); | |
883 | ||
884 | /* Now everything is ready and send out KOBJ_ADD uevent */ | |
885 | kobject_uevent(&q->kobj, KOBJ_ADD); | |
0546858c | 886 | if (q->elevator) |
cecf5d87 ML |
887 | kobject_uevent(&q->elevator->kobj, KOBJ_ADD); |
888 | mutex_unlock(&q->sysfs_lock); | |
889 | ||
b410aff2 TE |
890 | ret = 0; |
891 | unlock: | |
cecf5d87 | 892 | mutex_unlock(&q->sysfs_dir_lock); |
a72c374f ML |
893 | |
894 | /* | |
895 | * SCSI probing may synchronously create and destroy a lot of | |
896 | * request_queues for non-existent devices. Shutting down a fully | |
897 | * functional queue takes measureable wallclock time as RCU grace | |
898 | * periods are involved. To avoid excessive latency in these | |
899 | * cases, a request_queue starts out in a degraded mode which is | |
900 | * faster to shut down and is made fully functional here as | |
901 | * request_queues for non-existent devices never get registered. | |
902 | */ | |
903 | if (!blk_queue_init_done(q)) { | |
904 | blk_queue_flag_set(QUEUE_FLAG_INIT_DONE, q); | |
905 | percpu_ref_switch_to_percpu(&q->q_usage_counter); | |
906 | } | |
907 | ||
a2247f19 DLM |
908 | return ret; |
909 | ||
910 | put_dev: | |
911 | disk_unregister_independent_access_ranges(disk); | |
912 | mutex_unlock(&q->sysfs_lock); | |
913 | mutex_unlock(&q->sysfs_dir_lock); | |
914 | kobject_del(&q->kobj); | |
915 | blk_trace_remove_sysfs(dev); | |
916 | kobject_put(&dev->kobj); | |
917 | ||
b410aff2 | 918 | return ret; |
8324aa91 JA |
919 | } |
920 | ||
2c2086af BVA |
921 | /** |
922 | * blk_unregister_queue - counterpart of blk_register_queue() | |
923 | * @disk: Disk of which the request queue should be unregistered from sysfs. | |
924 | * | |
925 | * Note: the caller is responsible for guaranteeing that this function is called | |
926 | * after blk_register_queue() has finished. | |
927 | */ | |
8324aa91 JA |
928 | void blk_unregister_queue(struct gendisk *disk) |
929 | { | |
930 | struct request_queue *q = disk->queue; | |
931 | ||
fb199746 AM |
932 | if (WARN_ON(!q)) |
933 | return; | |
934 | ||
fa70d2e2 | 935 | /* Return early if disk->queue was never registered. */ |
58c898ba | 936 | if (!blk_queue_registered(q)) |
fa70d2e2 MS |
937 | return; |
938 | ||
667257e8 | 939 | /* |
2c2086af BVA |
940 | * Since sysfs_remove_dir() prevents adding new directory entries |
941 | * before removal of existing entries starts, protect against | |
942 | * concurrent elv_iosched_store() calls. | |
667257e8 | 943 | */ |
e9a823fb | 944 | mutex_lock(&q->sysfs_lock); |
8814ce8a | 945 | blk_queue_flag_clear(QUEUE_FLAG_REGISTERED, q); |
cecf5d87 | 946 | mutex_unlock(&q->sysfs_lock); |
02ba8893 | 947 | |
cecf5d87 | 948 | mutex_lock(&q->sysfs_dir_lock); |
2c2086af BVA |
949 | /* |
950 | * Remove the sysfs attributes before unregistering the queue data | |
951 | * structures that can be modified through sysfs. | |
952 | */ | |
344e9ffc | 953 | if (queue_is_mq(q)) |
b21d5b30 | 954 | blk_mq_unregister_dev(disk_to_dev(disk), q); |
8324aa91 | 955 | |
48c0d4d4 ZK |
956 | kobject_uevent(&q->kobj, KOBJ_REMOVE); |
957 | kobject_del(&q->kobj); | |
958 | blk_trace_remove_sysfs(disk_to_dev(disk)); | |
667257e8 | 959 | |
b89f625e | 960 | mutex_lock(&q->sysfs_lock); |
344e9ffc | 961 | if (q->elevator) |
2c2086af | 962 | elv_unregister_queue(q); |
a2247f19 | 963 | disk_unregister_independent_access_ranges(disk); |
b89f625e | 964 | mutex_unlock(&q->sysfs_lock); |
cecf5d87 | 965 | mutex_unlock(&q->sysfs_dir_lock); |
2c2086af BVA |
966 | |
967 | kobject_put(&disk_to_dev(disk)->kobj); | |
8324aa91 | 968 | } |