block: allocate struct hd_struct as part of struct bdev_inode

Allocate hd_struct together with struct block_device to pre-load
the lifetime rule changes in preparation of merging the two structures.

Note that part0 was previously embedded into struct gendisk, but is
a separate allocation now, and already points to the block_device instead
of the hd_struct.  The lifetime of struct gendisk is still controlled by
the struct device embedded in the part0 hd_struct.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig
2020-11-26 18:47:17 +01:00
committed by Jens Axboe
parent 83950d3590
commit cb8432d650
15 changed files with 61 additions and 169 deletions

View File

@@ -59,8 +59,8 @@ static inline void part_stat_set_all(struct hd_struct *part, int value)
#define part_stat_add(part, field, addnd) do { \
__part_stat_add((part), field, addnd); \
if ((part)->partno) \
__part_stat_add(&part_to_disk((part))->part0, \
field, addnd); \
__part_stat_add(part_to_disk((part))->part0->bd_part, \
field, addnd); \
} while (0)
#define part_stat_dec(part, field) \