[PATCH 1/4] block: expose disk_map_sector_rcu() and hd_struct_put in genhd.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So they can be used in drivers.

Signed-off-by: Song Liu <songliubraving@xxxxxx>
---
 block/blk.h           | 8 --------
 block/genhd.c         | 1 +
 include/linux/genhd.h | 8 ++++++++
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/block/blk.h b/block/blk.h
index 94f7c084f68fc..a6bc909480111 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -332,8 +332,6 @@ void blk_queue_free_zone_bitmaps(struct request_queue *q);
 static inline void blk_queue_free_zone_bitmaps(struct request_queue *q) {}
 #endif
 
-struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, sector_t sector);
-
 int blk_alloc_devt(struct hd_struct *part, dev_t *devt);
 void blk_free_devt(dev_t devt);
 void blk_invalidate_devt(dev_t devt);
@@ -358,12 +356,6 @@ static inline int hd_struct_try_get(struct hd_struct *part)
 	return 1;
 }
 
-static inline void hd_struct_put(struct hd_struct *part)
-{
-	if (part->partno)
-		percpu_ref_put(&part->ref);
-}
-
 static inline void hd_free_part(struct hd_struct *part)
 {
 	free_percpu(part->dkstats);
diff --git a/block/genhd.c b/block/genhd.c
index 60ae4e1b4d387..5b9333317dcb4 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -349,6 +349,7 @@ struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, sector_t sector)
 	rcu_read_unlock();
 	return part;
 }
+EXPORT_SYMBOL_GPL(disk_map_sector_rcu);
 
 /**
  * disk_has_partitions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 31a54072ffd65..b47c64f9f26b4 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -380,6 +380,14 @@ void bd_set_size(struct block_device *bdev, loff_t size);
 int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long);
 long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
 
+struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, sector_t sector);
+
+static inline void hd_struct_put(struct hd_struct *part)
+{
+	if (part->partno)
+		percpu_ref_put(&part->ref);
+}
+
 #ifdef CONFIG_SYSFS
 int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk);
 void bd_unlink_disk_holder(struct block_device *bdev, struct gendisk *disk);
-- 
2.24.1





[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux