From: Joe Thornber <thornber@xxxxxxxxxx> Allow targets to access to the block_device associated with a DM mapped_device. Export dm_disk() and dm_bdev() -- both are required by the dm-thinp target. Signed-off-by: Joe Thornber <thornber@xxxxxxxxxx> Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxx> --- drivers/md/dm.c | 11 +++++++++-- include/linux/device-mapper.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 538144b..99664eb 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2632,13 +2632,20 @@ void dm_uevent_add(struct mapped_device *md, struct list_head *elist) } /* - * The gendisk is only valid as long as you have a reference - * count on 'md'. + * The gendisk or block_device are only valid as long as you + * have a reference count on 'md'. */ struct gendisk *dm_disk(struct mapped_device *md) { return md->disk; } +EXPORT_SYMBOL_GPL(dm_disk); + +struct block_device *dm_bdev(struct mapped_device *md) +{ + return md->bdev; +} +EXPORT_SYMBOL_GPL(dm_bdev); struct kobject *dm_kobject(struct mapped_device *md) { diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 3fa1f3d..3941602 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -295,6 +295,7 @@ void dm_uevent_add(struct mapped_device *md, struct list_head *elist); const char *dm_device_name(struct mapped_device *md); int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid); struct gendisk *dm_disk(struct mapped_device *md); +struct block_device *dm_bdev(struct mapped_device *md); int dm_suspended(struct dm_target *ti); int dm_noflush_suspending(struct dm_target *ti); union map_info *dm_get_mapinfo(struct bio *bio); -- 1.7.1 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel