blk-sysfs.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. /*
  2. * Functions related to sysfs handling
  3. */
  4. #include <linux/kernel.h>
  5. #include <linux/slab.h>
  6. #include <linux/module.h>
  7. #include <linux/bio.h>
  8. #include <linux/blkdev.h>
  9. #include <linux/backing-dev.h>
  10. #include <linux/blktrace_api.h>
  11. #include <linux/blk-mq.h>
  12. #include <linux/blk-cgroup.h>
  13. #include "blk.h"
  14. #include "blk-mq.h"
  15. struct queue_sysfs_entry {
  16. struct attribute attr;
  17. ssize_t (*show)(struct request_queue *, char *);
  18. ssize_t (*store)(struct request_queue *, const char *, size_t);
  19. };
  20. static ssize_t
  21. queue_var_show(unsigned long var, char *page)
  22. {
  23. return sprintf(page, "%lu\n", var);
  24. }
  25. static ssize_t
  26. queue_var_store(unsigned long *var, const char *page, size_t count)
  27. {
  28. int err;
  29. unsigned long v;
  30. err = kstrtoul(page, 10, &v);
  31. if (err || v > UINT_MAX)
  32. return -EINVAL;
  33. *var = v;
  34. return count;
  35. }
  36. static ssize_t queue_requests_show(struct request_queue *q, char *page)
  37. {
  38. return queue_var_show(q->nr_requests, (page));
  39. }
  40. static ssize_t
  41. queue_requests_store(struct request_queue *q, const char *page, size_t count)
  42. {
  43. unsigned long nr;
  44. int ret, err;
  45. if (!q->request_fn && !q->mq_ops)
  46. return -EINVAL;
  47. ret = queue_var_store(&nr, page, count);
  48. if (ret < 0)
  49. return ret;
  50. if (nr < BLKDEV_MIN_RQ)
  51. nr = BLKDEV_MIN_RQ;
  52. if (q->request_fn)
  53. err = blk_update_nr_requests(q, nr);
  54. else
  55. err = blk_mq_update_nr_requests(q, nr);
  56. if (err)
  57. return err;
  58. return ret;
  59. }
  60. static ssize_t queue_ra_show(struct request_queue *q, char *page)
  61. {
  62. unsigned long ra_kb = q->backing_dev_info.ra_pages <<
  63. (PAGE_CACHE_SHIFT - 10);
  64. return queue_var_show(ra_kb, (page));
  65. }
  66. static ssize_t
  67. queue_ra_store(struct request_queue *q, const char *page, size_t count)
  68. {
  69. unsigned long ra_kb;
  70. ssize_t ret = queue_var_store(&ra_kb, page, count);
  71. if (ret < 0)
  72. return ret;
  73. q->backing_dev_info.ra_pages = ra_kb >> (PAGE_CACHE_SHIFT - 10);
  74. return ret;
  75. }
  76. static ssize_t queue_max_sectors_show(struct request_queue *q, char *page)
  77. {
  78. int max_sectors_kb = queue_max_sectors(q) >> 1;
  79. return queue_var_show(max_sectors_kb, (page));
  80. }
  81. static ssize_t queue_max_segments_show(struct request_queue *q, char *page)
  82. {
  83. return queue_var_show(queue_max_segments(q), (page));
  84. }
  85. static ssize_t queue_max_integrity_segments_show(struct request_queue *q, char *page)
  86. {
  87. return queue_var_show(q->limits.max_integrity_segments, (page));
  88. }
  89. static ssize_t queue_max_segment_size_show(struct request_queue *q, char *page)
  90. {
  91. if (blk_queue_cluster(q))
  92. return queue_var_show(queue_max_segment_size(q), (page));
  93. return queue_var_show(PAGE_CACHE_SIZE, (page));
  94. }
  95. static ssize_t queue_logical_block_size_show(struct request_queue *q, char *page)
  96. {
  97. return queue_var_show(queue_logical_block_size(q), page);
  98. }
  99. static ssize_t queue_physical_block_size_show(struct request_queue *q, char *page)
  100. {
  101. return queue_var_show(queue_physical_block_size(q), page);
  102. }
  103. static ssize_t queue_io_min_show(struct request_queue *q, char *page)
  104. {
  105. return queue_var_show(queue_io_min(q), page);
  106. }
  107. static ssize_t queue_io_opt_show(struct request_queue *q, char *page)
  108. {
  109. return queue_var_show(queue_io_opt(q), page);
  110. }
  111. static ssize_t queue_discard_granularity_show(struct request_queue *q, char *page)
  112. {
  113. return queue_var_show(q->limits.discard_granularity, page);
  114. }
  115. static ssize_t queue_discard_max_hw_show(struct request_queue *q, char *page)
  116. {
  117. unsigned long long val;
  118. val = q->limits.max_hw_discard_sectors << 9;
  119. return sprintf(page, "%llu\n", val);
  120. }
  121. static ssize_t queue_discard_max_show(struct request_queue *q, char *page)
  122. {
  123. return sprintf(page, "%llu\n",
  124. (unsigned long long)q->limits.max_discard_sectors << 9);
  125. }
  126. static ssize_t queue_discard_max_store(struct request_queue *q,
  127. const char *page, size_t count)
  128. {
  129. unsigned long max_discard;
  130. ssize_t ret = queue_var_store(&max_discard, page, count);
  131. if (ret < 0)
  132. return ret;
  133. if (max_discard & (q->limits.discard_granularity - 1))
  134. return -EINVAL;
  135. max_discard >>= 9;
  136. if (max_discard > UINT_MAX)
  137. return -EINVAL;
  138. if (max_discard > q->limits.max_hw_discard_sectors)
  139. max_discard = q->limits.max_hw_discard_sectors;
  140. q->limits.max_discard_sectors = max_discard;
  141. return ret;
  142. }
  143. static ssize_t queue_discard_zeroes_data_show(struct request_queue *q, char *page)
  144. {
  145. return queue_var_show(queue_discard_zeroes_data(q), page);
  146. }
  147. static ssize_t queue_write_same_max_show(struct request_queue *q, char *page)
  148. {
  149. return sprintf(page, "%llu\n",
  150. (unsigned long long)q->limits.max_write_same_sectors << 9);
  151. }
  152. static ssize_t
  153. queue_max_sectors_store(struct request_queue *q, const char *page, size_t count)
  154. {
  155. unsigned long max_sectors_kb,
  156. max_hw_sectors_kb = queue_max_hw_sectors(q) >> 1,
  157. page_kb = 1 << (PAGE_CACHE_SHIFT - 10);
  158. ssize_t ret = queue_var_store(&max_sectors_kb, page, count);
  159. if (ret < 0)
  160. return ret;
  161. if (max_sectors_kb > max_hw_sectors_kb || max_sectors_kb < page_kb)
  162. return -EINVAL;
  163. spin_lock_irq(q->queue_lock);
  164. q->limits.max_sectors = max_sectors_kb << 1;
  165. spin_unlock_irq(q->queue_lock);
  166. return ret;
  167. }
  168. static ssize_t queue_max_hw_sectors_show(struct request_queue *q, char *page)
  169. {
  170. int max_hw_sectors_kb = queue_max_hw_sectors(q) >> 1;
  171. return queue_var_show(max_hw_sectors_kb, (page));
  172. }
  173. #define QUEUE_SYSFS_BIT_FNS(name, flag, neg) \
  174. static ssize_t \
  175. queue_show_##name(struct request_queue *q, char *page) \
  176. { \
  177. int bit; \
  178. bit = test_bit(QUEUE_FLAG_##flag, &q->queue_flags); \
  179. return queue_var_show(neg ? !bit : bit, page); \
  180. } \
  181. static ssize_t \
  182. queue_store_##name(struct request_queue *q, const char *page, size_t count) \
  183. { \
  184. unsigned long val; \
  185. ssize_t ret; \
  186. ret = queue_var_store(&val, page, count); \
  187. if (ret < 0) \
  188. return ret; \
  189. if (neg) \
  190. val = !val; \
  191. \
  192. spin_lock_irq(q->queue_lock); \
  193. if (val) \
  194. queue_flag_set(QUEUE_FLAG_##flag, q); \
  195. else \
  196. queue_flag_clear(QUEUE_FLAG_##flag, q); \
  197. spin_unlock_irq(q->queue_lock); \
  198. return ret; \
  199. }
  200. QUEUE_SYSFS_BIT_FNS(nonrot, NONROT, 1);
  201. QUEUE_SYSFS_BIT_FNS(random, ADD_RANDOM, 0);
  202. QUEUE_SYSFS_BIT_FNS(iostats, IO_STAT, 0);
  203. #undef QUEUE_SYSFS_BIT_FNS
  204. static ssize_t queue_nomerges_show(struct request_queue *q, char *page)
  205. {
  206. return queue_var_show((blk_queue_nomerges(q) << 1) |
  207. blk_queue_noxmerges(q), page);
  208. }
  209. static ssize_t queue_nomerges_store(struct request_queue *q, const char *page,
  210. size_t count)
  211. {
  212. unsigned long nm;
  213. ssize_t ret = queue_var_store(&nm, page, count);
  214. if (ret < 0)
  215. return ret;
  216. spin_lock_irq(q->queue_lock);
  217. queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
  218. queue_flag_clear(QUEUE_FLAG_NOXMERGES, q);
  219. if (nm == 2)
  220. queue_flag_set(QUEUE_FLAG_NOMERGES, q);
  221. else if (nm)
  222. queue_flag_set(QUEUE_FLAG_NOXMERGES, q);
  223. spin_unlock_irq(q->queue_lock);
  224. return ret;
  225. }
  226. static ssize_t queue_rq_affinity_show(struct request_queue *q, char *page)
  227. {
  228. bool set = test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags);
  229. bool force = test_bit(QUEUE_FLAG_SAME_FORCE, &q->queue_flags);
  230. return queue_var_show(set << force, page);
  231. }
  232. static ssize_t
  233. queue_rq_affinity_store(struct request_queue *q, const char *page, size_t count)
  234. {
  235. ssize_t ret = -EINVAL;
  236. #ifdef CONFIG_SMP
  237. unsigned long val;
  238. ret = queue_var_store(&val, page, count);
  239. if (ret < 0)
  240. return ret;
  241. spin_lock_irq(q->queue_lock);
  242. if (val == 2) {
  243. queue_flag_set(QUEUE_FLAG_SAME_COMP, q);
  244. queue_flag_set(QUEUE_FLAG_SAME_FORCE, q);
  245. } else if (val == 1) {
  246. queue_flag_set(QUEUE_FLAG_SAME_COMP, q);
  247. queue_flag_clear(QUEUE_FLAG_SAME_FORCE, q);
  248. } else if (val == 0) {
  249. queue_flag_clear(QUEUE_FLAG_SAME_COMP, q);
  250. queue_flag_clear(QUEUE_FLAG_SAME_FORCE, q);
  251. }
  252. spin_unlock_irq(q->queue_lock);
  253. #endif
  254. return ret;
  255. }
  256. static struct queue_sysfs_entry queue_requests_entry = {
  257. .attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR },
  258. .show = queue_requests_show,
  259. .store = queue_requests_store,
  260. };
  261. static struct queue_sysfs_entry queue_ra_entry = {
  262. .attr = {.name = "read_ahead_kb", .mode = S_IRUGO | S_IWUSR },
  263. .show = queue_ra_show,
  264. .store = queue_ra_store,
  265. };
  266. static struct queue_sysfs_entry queue_max_sectors_entry = {
  267. .attr = {.name = "max_sectors_kb", .mode = S_IRUGO | S_IWUSR },
  268. .show = queue_max_sectors_show,
  269. .store = queue_max_sectors_store,
  270. };
  271. static struct queue_sysfs_entry queue_max_hw_sectors_entry = {
  272. .attr = {.name = "max_hw_sectors_kb", .mode = S_IRUGO },
  273. .show = queue_max_hw_sectors_show,
  274. };
  275. static struct queue_sysfs_entry queue_max_segments_entry = {
  276. .attr = {.name = "max_segments", .mode = S_IRUGO },
  277. .show = queue_max_segments_show,
  278. };
  279. static struct queue_sysfs_entry queue_max_integrity_segments_entry = {
  280. .attr = {.name = "max_integrity_segments", .mode = S_IRUGO },
  281. .show = queue_max_integrity_segments_show,
  282. };
  283. static struct queue_sysfs_entry queue_max_segment_size_entry = {
  284. .attr = {.name = "max_segment_size", .mode = S_IRUGO },
  285. .show = queue_max_segment_size_show,
  286. };
  287. static struct queue_sysfs_entry queue_iosched_entry = {
  288. .attr = {.name = "scheduler", .mode = S_IRUGO | S_IWUSR },
  289. .show = elv_iosched_show,
  290. .store = elv_iosched_store,
  291. };
  292. static struct queue_sysfs_entry queue_hw_sector_size_entry = {
  293. .attr = {.name = "hw_sector_size", .mode = S_IRUGO },
  294. .show = queue_logical_block_size_show,
  295. };
  296. static struct queue_sysfs_entry queue_logical_block_size_entry = {
  297. .attr = {.name = "logical_block_size", .mode = S_IRUGO },
  298. .show = queue_logical_block_size_show,
  299. };
  300. static struct queue_sysfs_entry queue_physical_block_size_entry = {
  301. .attr = {.name = "physical_block_size", .mode = S_IRUGO },
  302. .show = queue_physical_block_size_show,
  303. };
  304. static struct queue_sysfs_entry queue_io_min_entry = {
  305. .attr = {.name = "minimum_io_size", .mode = S_IRUGO },
  306. .show = queue_io_min_show,
  307. };
  308. static struct queue_sysfs_entry queue_io_opt_entry = {
  309. .attr = {.name = "optimal_io_size", .mode = S_IRUGO },
  310. .show = queue_io_opt_show,
  311. };
  312. static struct queue_sysfs_entry queue_discard_granularity_entry = {
  313. .attr = {.name = "discard_granularity", .mode = S_IRUGO },
  314. .show = queue_discard_granularity_show,
  315. };
  316. static struct queue_sysfs_entry queue_discard_max_hw_entry = {
  317. .attr = {.name = "discard_max_hw_bytes", .mode = S_IRUGO },
  318. .show = queue_discard_max_hw_show,
  319. };
  320. static struct queue_sysfs_entry queue_discard_max_entry = {
  321. .attr = {.name = "discard_max_bytes", .mode = S_IRUGO | S_IWUSR },
  322. .show = queue_discard_max_show,
  323. .store = queue_discard_max_store,
  324. };
  325. static struct queue_sysfs_entry queue_discard_zeroes_data_entry = {
  326. .attr = {.name = "discard_zeroes_data", .mode = S_IRUGO },
  327. .show = queue_discard_zeroes_data_show,
  328. };
  329. static struct queue_sysfs_entry queue_write_same_max_entry = {
  330. .attr = {.name = "write_same_max_bytes", .mode = S_IRUGO },
  331. .show = queue_write_same_max_show,
  332. };
  333. static struct queue_sysfs_entry queue_nonrot_entry = {
  334. .attr = {.name = "rotational", .mode = S_IRUGO | S_IWUSR },
  335. .show = queue_show_nonrot,
  336. .store = queue_store_nonrot,
  337. };
  338. static struct queue_sysfs_entry queue_nomerges_entry = {
  339. .attr = {.name = "nomerges", .mode = S_IRUGO | S_IWUSR },
  340. .show = queue_nomerges_show,
  341. .store = queue_nomerges_store,
  342. };
  343. static struct queue_sysfs_entry queue_rq_affinity_entry = {
  344. .attr = {.name = "rq_affinity", .mode = S_IRUGO | S_IWUSR },
  345. .show = queue_rq_affinity_show,
  346. .store = queue_rq_affinity_store,
  347. };
  348. static struct queue_sysfs_entry queue_iostats_entry = {
  349. .attr = {.name = "iostats", .mode = S_IRUGO | S_IWUSR },
  350. .show = queue_show_iostats,
  351. .store = queue_store_iostats,
  352. };
  353. static struct queue_sysfs_entry queue_random_entry = {
  354. .attr = {.name = "add_random", .mode = S_IRUGO | S_IWUSR },
  355. .show = queue_show_random,
  356. .store = queue_store_random,
  357. };
  358. static struct attribute *default_attrs[] = {
  359. &queue_requests_entry.attr,
  360. &queue_ra_entry.attr,
  361. &queue_max_hw_sectors_entry.attr,
  362. &queue_max_sectors_entry.attr,
  363. &queue_max_segments_entry.attr,
  364. &queue_max_integrity_segments_entry.attr,
  365. &queue_max_segment_size_entry.attr,
  366. &queue_iosched_entry.attr,
  367. &queue_hw_sector_size_entry.attr,
  368. &queue_logical_block_size_entry.attr,
  369. &queue_physical_block_size_entry.attr,
  370. &queue_io_min_entry.attr,
  371. &queue_io_opt_entry.attr,
  372. &queue_discard_granularity_entry.attr,
  373. &queue_discard_max_entry.attr,
  374. &queue_discard_max_hw_entry.attr,
  375. &queue_discard_zeroes_data_entry.attr,
  376. &queue_write_same_max_entry.attr,
  377. &queue_nonrot_entry.attr,
  378. &queue_nomerges_entry.attr,
  379. &queue_rq_affinity_entry.attr,
  380. &queue_iostats_entry.attr,
  381. &queue_random_entry.attr,
  382. NULL,
  383. };
  384. #define to_queue(atr) container_of((atr), struct queue_sysfs_entry, attr)
  385. static ssize_t
  386. queue_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
  387. {
  388. struct queue_sysfs_entry *entry = to_queue(attr);
  389. struct request_queue *q =
  390. container_of(kobj, struct request_queue, kobj);
  391. ssize_t res;
  392. if (!entry->show)
  393. return -EIO;
  394. mutex_lock(&q->sysfs_lock);
  395. if (blk_queue_dying(q)) {
  396. mutex_unlock(&q->sysfs_lock);
  397. return -ENOENT;
  398. }
  399. res = entry->show(q, page);
  400. mutex_unlock(&q->sysfs_lock);
  401. return res;
  402. }
  403. static ssize_t
  404. queue_attr_store(struct kobject *kobj, struct attribute *attr,
  405. const char *page, size_t length)
  406. {
  407. struct queue_sysfs_entry *entry = to_queue(attr);
  408. struct request_queue *q;
  409. ssize_t res;
  410. if (!entry->store)
  411. return -EIO;
  412. q = container_of(kobj, struct request_queue, kobj);
  413. mutex_lock(&q->sysfs_lock);
  414. if (blk_queue_dying(q)) {
  415. mutex_unlock(&q->sysfs_lock);
  416. return -ENOENT;
  417. }
  418. res = entry->store(q, page, length);
  419. mutex_unlock(&q->sysfs_lock);
  420. return res;
  421. }
  422. static void blk_free_queue_rcu(struct rcu_head *rcu_head)
  423. {
  424. struct request_queue *q = container_of(rcu_head, struct request_queue,
  425. rcu_head);
  426. kmem_cache_free(blk_requestq_cachep, q);
  427. }
  428. /**
  429. * blk_release_queue: - release a &struct request_queue when it is no longer needed
  430. * @kobj: the kobj belonging to the request queue to be released
  431. *
  432. * Description:
  433. * blk_release_queue is the pair to blk_init_queue() or
  434. * blk_queue_make_request(). It should be called when a request queue is
  435. * being released; typically when a block device is being de-registered.
  436. * Currently, its primary task it to free all the &struct request
  437. * structures that were allocated to the queue and the queue itself.
  438. *
  439. * Note:
  440. * The low level driver must have finished any outstanding requests first
  441. * via blk_cleanup_queue().
  442. **/
  443. static void blk_release_queue(struct kobject *kobj)
  444. {
  445. struct request_queue *q =
  446. container_of(kobj, struct request_queue, kobj);
  447. bdi_exit(&q->backing_dev_info);
  448. blkcg_exit_queue(q);
  449. if (q->elevator) {
  450. spin_lock_irq(q->queue_lock);
  451. ioc_clear_queue(q);
  452. spin_unlock_irq(q->queue_lock);
  453. elevator_exit(q->elevator);
  454. }
  455. blk_exit_rl(&q->root_rl);
  456. if (q->queue_tags)
  457. __blk_queue_free_tags(q);
  458. if (!q->mq_ops)
  459. blk_free_flush_queue(q->fq);
  460. else
  461. blk_mq_release(q);
  462. blk_trace_shutdown(q);
  463. if (q->bio_split)
  464. bioset_free(q->bio_split);
  465. ida_simple_remove(&blk_queue_ida, q->id);
  466. call_rcu(&q->rcu_head, blk_free_queue_rcu);
  467. }
  468. static const struct sysfs_ops queue_sysfs_ops = {
  469. .show = queue_attr_show,
  470. .store = queue_attr_store,
  471. };
  472. struct kobj_type blk_queue_ktype = {
  473. .sysfs_ops = &queue_sysfs_ops,
  474. .default_attrs = default_attrs,
  475. .release = blk_release_queue,
  476. };
  477. int blk_register_queue(struct gendisk *disk)
  478. {
  479. int ret;
  480. struct device *dev = disk_to_dev(disk);
  481. struct request_queue *q = disk->queue;
  482. if (WARN_ON(!q))
  483. return -ENXIO;
  484. /*
  485. * SCSI probing may synchronously create and destroy a lot of
  486. * request_queues for non-existent devices. Shutting down a fully
  487. * functional queue takes measureable wallclock time as RCU grace
  488. * periods are involved. To avoid excessive latency in these
  489. * cases, a request_queue starts out in a degraded mode which is
  490. * faster to shut down and is made fully functional here as
  491. * request_queues for non-existent devices never get registered.
  492. */
  493. if (!blk_queue_init_done(q)) {
  494. queue_flag_set_unlocked(QUEUE_FLAG_INIT_DONE, q);
  495. blk_queue_bypass_end(q);
  496. if (q->mq_ops)
  497. blk_mq_finish_init(q);
  498. }
  499. ret = blk_trace_init_sysfs(dev);
  500. if (ret)
  501. return ret;
  502. ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue");
  503. if (ret < 0) {
  504. blk_trace_remove_sysfs(dev);
  505. return ret;
  506. }
  507. kobject_uevent(&q->kobj, KOBJ_ADD);
  508. if (q->mq_ops)
  509. blk_mq_register_disk(disk);
  510. if (!q->request_fn)
  511. return 0;
  512. ret = elv_register_queue(q);
  513. if (ret) {
  514. kobject_uevent(&q->kobj, KOBJ_REMOVE);
  515. kobject_del(&q->kobj);
  516. blk_trace_remove_sysfs(dev);
  517. kobject_put(&dev->kobj);
  518. return ret;
  519. }
  520. return 0;
  521. }
  522. void blk_unregister_queue(struct gendisk *disk)
  523. {
  524. struct request_queue *q = disk->queue;
  525. if (WARN_ON(!q))
  526. return;
  527. if (q->mq_ops)
  528. blk_mq_unregister_disk(disk);
  529. if (q->request_fn)
  530. elv_unregister_queue(q);
  531. kobject_uevent(&q->kobj, KOBJ_REMOVE);
  532. kobject_del(&q->kobj);
  533. blk_trace_remove_sysfs(disk_to_dev(disk));
  534. kobject_put(&disk_to_dev(disk)->kobj);
  535. }