diff options
-rw-r--r-- | block/blk-core.c | 8 | ||||
-rw-r--r-- | block/blk.h | 5 | ||||
-rw-r--r-- | block/bsg.c | 4 | ||||
-rw-r--r-- | block/genhd.c | 2 | ||||
-rw-r--r-- | drivers/scsi/scsi_scan.c | 2 | ||||
-rw-r--r-- | include/linux/blkdev.h | 2 |
6 files changed, 13 insertions, 10 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index af7301581172..fd4749391e17 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -626,14 +626,14 @@ blk_init_allocated_queue_node(struct request_queue *q, request_fn_proc *rfn, | |||
626 | } | 626 | } |
627 | EXPORT_SYMBOL(blk_init_allocated_queue_node); | 627 | EXPORT_SYMBOL(blk_init_allocated_queue_node); |
628 | 628 | ||
629 | int blk_get_queue(struct request_queue *q) | 629 | bool blk_get_queue(struct request_queue *q) |
630 | { | 630 | { |
631 | if (likely(!blk_queue_dead(q))) { | 631 | if (likely(!blk_queue_dead(q))) { |
632 | kobject_get(&q->kobj); | 632 | __blk_get_queue(q); |
633 | return 0; | 633 | return true; |
634 | } | 634 | } |
635 | 635 | ||
636 | return 1; | 636 | return false; |
637 | } | 637 | } |
638 | EXPORT_SYMBOL(blk_get_queue); | 638 | EXPORT_SYMBOL(blk_get_queue); |
639 | 639 | ||
diff --git a/block/blk.h b/block/blk.h index fc3c41b2fd24..8d421156fefb 100644 --- a/block/blk.h +++ b/block/blk.h | |||
@@ -13,6 +13,11 @@ extern struct kmem_cache *blk_requestq_cachep; | |||
13 | extern struct kobj_type blk_queue_ktype; | 13 | extern struct kobj_type blk_queue_ktype; |
14 | extern struct ida blk_queue_ida; | 14 | extern struct ida blk_queue_ida; |
15 | 15 | ||
16 | static inline void __blk_get_queue(struct request_queue *q) | ||
17 | { | ||
18 | kobject_get(&q->kobj); | ||
19 | } | ||
20 | |||
16 | void init_request_from_bio(struct request *req, struct bio *bio); | 21 | void init_request_from_bio(struct request *req, struct bio *bio); |
17 | void blk_rq_bio_prep(struct request_queue *q, struct request *rq, | 22 | void blk_rq_bio_prep(struct request_queue *q, struct request *rq, |
18 | struct bio *bio); | 23 | struct bio *bio); |
diff --git a/block/bsg.c b/block/bsg.c index 702f1316bb8f..167d586cece6 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
@@ -769,12 +769,10 @@ static struct bsg_device *bsg_add_device(struct inode *inode, | |||
769 | struct file *file) | 769 | struct file *file) |
770 | { | 770 | { |
771 | struct bsg_device *bd; | 771 | struct bsg_device *bd; |
772 | int ret; | ||
773 | #ifdef BSG_DEBUG | 772 | #ifdef BSG_DEBUG |
774 | unsigned char buf[32]; | 773 | unsigned char buf[32]; |
775 | #endif | 774 | #endif |
776 | ret = blk_get_queue(rq); | 775 | if (!blk_get_queue(rq)) |
777 | if (ret) | ||
778 | return ERR_PTR(-ENXIO); | 776 | return ERR_PTR(-ENXIO); |
779 | 777 | ||
780 | bd = bsg_alloc_device(); | 778 | bd = bsg_alloc_device(); |
diff --git a/block/genhd.c b/block/genhd.c index 02e9fca80825..c958169d24f0 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -615,7 +615,7 @@ void add_disk(struct gendisk *disk) | |||
615 | * Take an extra ref on queue which will be put on disk_release() | 615 | * Take an extra ref on queue which will be put on disk_release() |
616 | * so that it sticks around as long as @disk is there. | 616 | * so that it sticks around as long as @disk is there. |
617 | */ | 617 | */ |
618 | WARN_ON_ONCE(blk_get_queue(disk->queue)); | 618 | WARN_ON_ONCE(!blk_get_queue(disk->queue)); |
619 | 619 | ||
620 | retval = sysfs_create_link(&disk_to_dev(disk)->kobj, &bdi->dev->kobj, | 620 | retval = sysfs_create_link(&disk_to_dev(disk)->kobj, &bdi->dev->kobj, |
621 | "bdi"); | 621 | "bdi"); |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index b3c6d957fbd8..89da43f73c00 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -297,7 +297,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, | |||
297 | kfree(sdev); | 297 | kfree(sdev); |
298 | goto out; | 298 | goto out; |
299 | } | 299 | } |
300 | blk_get_queue(sdev->request_queue); | 300 | WARN_ON_ONCE(!blk_get_queue(sdev->request_queue)); |
301 | sdev->request_queue->queuedata = sdev; | 301 | sdev->request_queue->queuedata = sdev; |
302 | scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); | 302 | scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); |
303 | 303 | ||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 8c8dbc4738ea..d1b6f4ed1f96 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -865,7 +865,7 @@ extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatte | |||
865 | extern void blk_dump_rq_flags(struct request *, char *); | 865 | extern void blk_dump_rq_flags(struct request *, char *); |
866 | extern long nr_blockdev_pages(void); | 866 | extern long nr_blockdev_pages(void); |
867 | 867 | ||
868 | int blk_get_queue(struct request_queue *); | 868 | bool __must_check blk_get_queue(struct request_queue *); |
869 | struct request_queue *blk_alloc_queue(gfp_t); | 869 | struct request_queue *blk_alloc_queue(gfp_t); |
870 | struct request_queue *blk_alloc_queue_node(gfp_t, int); | 870 | struct request_queue *blk_alloc_queue_node(gfp_t, int); |
871 | extern void blk_put_queue(struct request_queue *); | 871 | extern void blk_put_queue(struct request_queue *); |