summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-11-17 08:18:55 +0100
committerJens Axboe <axboe@kernel.dk>2020-12-01 14:53:39 -0700
commit8d65269fe8065fee889bca5b204d711b0695a8f6 (patch)
tree6444d7cdab2f4a9e63021188538f27b28396b8d4 /include
parent3f50b95e0edd22824b2650eb65466bf7060f7488 (diff)
downloadlinux-stable-8d65269fe8065fee889bca5b204d711b0695a8f6.tar.gz
linux-stable-8d65269fe8065fee889bca5b204d711b0695a8f6.tar.bz2
linux-stable-8d65269fe8065fee889bca5b204d711b0695a8f6.zip
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>
Diffstat (limited to 'include')
-rw-r--r--include/linux/blk_types.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index ebfb4e7c1fd1..9698f459cc65 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -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.