summaryrefslogtreecommitdiff
path: root/block/genhd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-05-25 08:13:01 +0200
committerJens Axboe <axboe@kernel.dk>2021-06-01 07:47:14 -0600
commit0e0ccdecb3cff95a350b4364e7ebbaa754d0e47d (patch)
treee824664c86b6b1dc7799c5fd007f1d5615cbc7f0 /block/genhd.c
parentc97d93c31e5734a16bfe663085ec91b8c9fb20f9 (diff)
block: remove bdget_disk
Just opencode the xa_load in the callers, as none of them actually needs a reference to the bdev. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20210525061301.2242282-9-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c35
1 files changed, 5 insertions, 30 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 3f7b1c92c7f3..5f5628216295 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -676,32 +676,6 @@ void blk_request_module(dev_t devt)
request_module("block-major-%d", MAJOR(devt));
}
-/**
- * bdget_disk - do bdget() by gendisk and partition number
- * @disk: gendisk of interest
- * @partno: partition number
- *
- * Find partition @partno from @disk, do bdget() on it.
- *
- * CONTEXT:
- * Don't care.
- *
- * RETURNS:
- * Resulting block_device on success, NULL on failure.
- */
-struct block_device *bdget_disk(struct gendisk *disk, int partno)
-{
- struct block_device *bdev = NULL;
-
- rcu_read_lock();
- bdev = xa_load(&disk->part_tbl, partno);
- if (bdev && !bdgrab(bdev))
- bdev = NULL;
- rcu_read_unlock();
-
- return bdev;
-}
-
/*
* print a full list of all partitions - intended for places where the root
* filesystem can't be mounted and thus to give the victim some idea of what
@@ -1229,13 +1203,14 @@ module_init(proc_genhd_init);
dev_t part_devt(struct gendisk *disk, u8 partno)
{
- struct block_device *part = bdget_disk(disk, partno);
+ struct block_device *part;
dev_t devt = 0;
- if (part) {
+ rcu_read_lock();
+ part = xa_load(&disk->part_tbl, partno);
+ if (part)
devt = part->bd_dev;
- bdput(part);
- }
+ rcu_read_unlock();
return devt;
}