block: add a bdev_kobj helper

Add a little helper to find the kobject for a struct block_device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Coly Li <colyli@suse.de>		[bcache]
Acked-by: David Sterba <dsterba@suse.com>	[btrfs]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig 2020-11-17 08:18:55 +01:00 committed by Jens Axboe
parent 3f50b95e0e
commit 8d65269fe8
5 changed files with 12 additions and 23 deletions

View file

@ -49,6 +49,9 @@ struct block_device {
struct super_block *bd_fsfreeze_sb;
} __randomize_layout;
#define bdev_kobj(_bdev) \
(&part_to_dev((_bdev)->bd_part)->kobj)
/*
* Block error status values. See block/blk-core:blk_errors for the details.
* Alpha cannot write a byte atomically, so we need to use 32-bit value.