diff options
author | Christoph Hellwig <hch@lst.de> | 2021-08-10 17:45:09 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-08-12 10:31:35 -0600 |
commit | a08aa9bccdc282b5e8d133bf8c239473f057b464 (patch) | |
tree | bacbfd0d8f42786aed2fff06103c78aa3a98b3df /block/partitions/core.c | |
parent | 50b4aecfbbb09869db967e4a26212a47e10c0088 (diff) |
block: store a gendisk in struct parsed_partitions
Partition scanning only happens on the whole device, so pass a
struct gendisk instead of the whole device block_device to the scanners.
This allows to simplify printing the device name in various places as the
disk name is available in disk->name.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Link: https://lore.kernel.org/r/20210810154512.1809898-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/partitions/core.c')
-rw-r--r-- | block/partitions/core.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/block/partitions/core.c b/block/partitions/core.c index c6738ccbcee5..5dd1cd1a163d 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -135,7 +135,7 @@ static struct parsed_partitions *check_partition(struct gendisk *hd) } state->pp_buf[0] = '\0'; - state->bdev = hd->part0; + state->disk = hd; snprintf(state->name, BDEVNAME_SIZE, "%s", hd->disk_name); snprintf(state->pp_buf, PAGE_SIZE, " %s:", state->name); if (isdigit(state->name[strlen(state->name)-1])) @@ -717,10 +717,10 @@ EXPORT_SYMBOL_GPL(bdev_disk_changed); void *read_part_sector(struct parsed_partitions *state, sector_t n, Sector *p) { - struct address_space *mapping = state->bdev->bd_inode->i_mapping; + struct address_space *mapping = state->disk->part0->bd_inode->i_mapping; struct page *page; - if (n >= get_capacity(state->bdev->bd_disk)) { + if (n >= get_capacity(state->disk)) { state->access_beyond_eod = true; return NULL; } |