blk-sysfs.c (e3c55d406bd8df1a878546002c93db90c42be10c) | blk-sysfs.c (320ae51feed5c2f13664aa05a76bec198967e04d) |
---|---|
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/blktrace_api.h> | 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/blktrace_api.h> |
10#include <linux/blk-mq.h> |
|
10 11#include "blk.h" 12#include "blk-cgroup.h" 13 14struct queue_sysfs_entry { 15 struct attribute attr; 16 ssize_t (*show)(struct request_queue *, char *); 17 ssize_t (*store)(struct request_queue *, const char *, size_t); --- 519 unchanged lines hidden (view full) --- 537 elevator_exit(q->elevator); 538 } 539 540 blk_exit_rl(&q->root_rl); 541 542 if (q->queue_tags) 543 __blk_queue_free_tags(q); 544 | 11 12#include "blk.h" 13#include "blk-cgroup.h" 14 15struct 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); --- 519 unchanged lines hidden (view full) --- 538 elevator_exit(q->elevator); 539 } 540 541 blk_exit_rl(&q->root_rl); 542 543 if (q->queue_tags) 544 __blk_queue_free_tags(q); 545 |
546 percpu_counter_destroy(&q->mq_usage_counter); 547 548 if (q->mq_ops) 549 blk_mq_free_queue(q); 550 |
|
545 blk_trace_shutdown(q); 546 547 bdi_destroy(&q->backing_dev_info); 548 549 ida_simple_remove(&blk_queue_ida, q->id); 550 call_rcu(&q->rcu_head, blk_free_queue_rcu); 551} 552 --- 17 unchanged lines hidden (view full) --- 570 if (WARN_ON(!q)) 571 return -ENXIO; 572 573 /* 574 * Initialization must be complete by now. Finish the initial 575 * bypass from queue allocation. 576 */ 577 blk_queue_bypass_end(q); | 551 blk_trace_shutdown(q); 552 553 bdi_destroy(&q->backing_dev_info); 554 555 ida_simple_remove(&blk_queue_ida, q->id); 556 call_rcu(&q->rcu_head, blk_free_queue_rcu); 557} 558 --- 17 unchanged lines hidden (view full) --- 576 if (WARN_ON(!q)) 577 return -ENXIO; 578 579 /* 580 * Initialization must be complete by now. Finish the initial 581 * bypass from queue allocation. 582 */ 583 blk_queue_bypass_end(q); |
584 queue_flag_set_unlocked(QUEUE_FLAG_INIT_DONE, q); |
|
578 579 ret = blk_trace_init_sysfs(dev); 580 if (ret) 581 return ret; 582 583 ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue"); 584 if (ret < 0) { 585 blk_trace_remove_sysfs(dev); 586 return ret; 587 } 588 589 kobject_uevent(&q->kobj, KOBJ_ADD); 590 | 585 586 ret = blk_trace_init_sysfs(dev); 587 if (ret) 588 return ret; 589 590 ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue"); 591 if (ret < 0) { 592 blk_trace_remove_sysfs(dev); 593 return ret; 594 } 595 596 kobject_uevent(&q->kobj, KOBJ_ADD); 597 |
598 if (q->mq_ops) 599 blk_mq_register_disk(disk); 600 |
|
591 if (!q->request_fn) 592 return 0; 593 594 ret = elv_register_queue(q); 595 if (ret) { 596 kobject_uevent(&q->kobj, KOBJ_REMOVE); 597 kobject_del(&q->kobj); 598 blk_trace_remove_sysfs(dev); --- 6 unchanged lines hidden (view full) --- 605 606void blk_unregister_queue(struct gendisk *disk) 607{ 608 struct request_queue *q = disk->queue; 609 610 if (WARN_ON(!q)) 611 return; 612 | 601 if (!q->request_fn) 602 return 0; 603 604 ret = elv_register_queue(q); 605 if (ret) { 606 kobject_uevent(&q->kobj, KOBJ_REMOVE); 607 kobject_del(&q->kobj); 608 blk_trace_remove_sysfs(dev); --- 6 unchanged lines hidden (view full) --- 615 616void blk_unregister_queue(struct gendisk *disk) 617{ 618 struct request_queue *q = disk->queue; 619 620 if (WARN_ON(!q)) 621 return; 622 |
623 if (q->mq_ops) 624 blk_mq_unregister_disk(disk); 625 |
|
613 if (q->request_fn) 614 elv_unregister_queue(q); 615 616 kobject_uevent(&q->kobj, KOBJ_REMOVE); 617 kobject_del(&q->kobj); 618 blk_trace_remove_sysfs(disk_to_dev(disk)); 619 kobject_put(&disk_to_dev(disk)->kobj); 620} | 626 if (q->request_fn) 627 elv_unregister_queue(q); 628 629 kobject_uevent(&q->kobj, KOBJ_REMOVE); 630 kobject_del(&q->kobj); 631 blk_trace_remove_sysfs(disk_to_dev(disk)); 632 kobject_put(&disk_to_dev(disk)->kobj); 633} |