From 2638c20876734f986fd91cfbe196483835ed7095 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sun, 28 Apr 2024 19:01:39 -0400 Subject: missing helpers: bdev_unhash(), bdev_drop() bdev_unhash(): make block device invisible to lookups by device number bdev_drop(): drop reference to associated inode. Both are internal, for use by genhd and partition-related code - similar to bdev_add(). The logics in there (especially the lifetime-related parts of it) ought to be cleaned up, but that's a separate story; here we just encapsulate getting to associated inode. Signed-off-by: Al Viro --- block/bdev.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'block/bdev.c') diff --git a/block/bdev.c b/block/bdev.c index 536233ac3e99..28e6f0423857 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -451,6 +451,16 @@ void bdev_add(struct block_device *bdev, dev_t dev) insert_inode_hash(bdev->bd_inode); } +void bdev_unhash(struct block_device *bdev) +{ + remove_inode_hash(bdev->bd_inode); +} + +void bdev_drop(struct block_device *bdev) +{ + iput(bdev->bd_inode); +} + long nr_blockdev_pages(void) { struct inode *inode; -- cgit v1.2.3