summaryrefslogtreecommitdiff
path: root/block/bdev.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2024-04-28 19:01:39 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2024-05-03 02:36:21 -0400
commit2638c20876734f986fd91cfbe196483835ed7095 (patch)
tree1cb487635c21b1a5bc1a1688f7054dceaba7c4cb /block/bdev.c
parent186ddac2072a8134798d72635d1ed0f29889369d (diff)
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 <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block/bdev.c')
-rw-r--r--block/bdev.c10
1 files changed, 10 insertions, 0 deletions
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;