X-Patchwork-Id: 957552 From: Joe Thornber 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 Signed-off-by: Mike Snitzer FIXME - dm_disk looks completely avoidable (and in fact congestion fns are set up in the wrong place anyway) - rewrite the thinp congestion code not to need it - agk FIXME - unconvinced about the need for dm_bdev yet until I've probed more deeply, but if it is to stay, must be changed to avoid code duplication and provide a proper justification in this patch header etc. - agk --- drivers/md/dm.c | 11 +++++++++-- drivers/md/dm.c | 11 +++++++++-- include/linux/device-mapper.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) Index: linux-3.0-rc7/drivers/md/dm.c =================================================================== --- linux-3.0-rc7.orig/drivers/md/dm.c +++ linux-3.0-rc7/drivers/md/dm.c @@ -2632,13 +2632,20 @@ void dm_uevent_add(struct mapped_device } /* - * 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) { Index: linux-3.0-rc7/include/linux/device-mapper.h =================================================================== --- linux-3.0-rc7.orig/include/linux/device-mapper.h +++ linux-3.0-rc7/include/linux/device-mapper.h @@ -301,6 +301,7 @@ void dm_uevent_add(struct mapped_device 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);