summaryrefslogtreecommitdiffstats
path: root/init/do_mounts.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-05-25 08:13:00 +0200
committerJens Axboe <axboe@kernel.dk>2021-06-01 07:45:49 -0600
commitc97d93c31e5734a16bfe663085ec91b8c9fb20f9 (patch)
treefdac112a1884242e87aa576e5f01675fc969a530 /init/do_mounts.c
parentab4b57057d744861f670b47b163209727b26418b (diff)
downloadlinux-c97d93c31e5734a16bfe663085ec91b8c9fb20f9.tar.gz
linux-c97d93c31e5734a16bfe663085ec91b8c9fb20f9.tar.bz2
linux-c97d93c31e5734a16bfe663085ec91b8c9fb20f9.zip
block: factor out a part_devt helper
Add a helper to find the dev_t for a disk + partno tuple. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20210525061301.2242282-8-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'init/do_mounts.c')
-rw-r--r--init/do_mounts.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/init/do_mounts.c b/init/do_mounts.c
index a78e44ee6adb..74aede860de7 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -133,14 +133,8 @@ static dev_t devt_from_partuuid(const char *uuid_str)
* Attempt to find the requested partition by adding an offset
* to the partition number found by UUID.
*/
- struct block_device *part;
-
- part = bdget_disk(dev_to_disk(dev),
- dev_to_bdev(dev)->bd_partno + offset);
- if (part) {
- devt = part->bd_dev;
- bdput(part);
- }
+ devt = part_devt(dev_to_disk(dev),
+ dev_to_bdev(dev)->bd_partno + offset);
} else {
devt = dev->devt;
}