Description of problem: I'm working on a device-mapper module but there's no public structure definition of dm_dev, which means there's no public way to access the underlying bdev. This means there's no way to write a mapper module that reads from the underlying block device. Version-Release number of selected component (if applicable): All 2.6 kernels I've tried, but in particular I'm working with 2.6.22.5-76.fc7 How reproducible: Completely reproducible.. struct dm_dev is only defined in dm.h which is a private kernel header in drivers/md/ .. It's referenced as an opaque object in the public device-mapper.h header in include/linux, but unlike the rest of the structures defined there, it's not. Nor is there an API to obtain the block_device pointer out of the dm_dev object. Steps to Reproduce: 1. look in include/linux/device-mapper.h and notice that dm_dev isn't fully defined. 2. try to write any device mapper module that needs the underlying block_device 3. notice there's no way to obtain that information from the dm_dev Actual results: structure isn't publically defined, and there's no way to obtain the block_device member from the results of dm_get_device() Expected results: Either dm_dev should be defined in device-mapper.h, or there needs to be an API to return the block_device from a dm_dev object. Additional info:
Is a device-mapper module a kernel module? You would need the kernel-devel package for building those...
Yes it is a kernel module, and I have the kernel-devel package installed. The problem is that the structure isn't defined in any header distributed by kernel-devel; it's ONLY defined in the kernel sources under 'drivers/md/dm.h', which you can find only if you "rpmbuild -bp" the kernel source rpm.
Created attachment 209001 [details] Proposed Patch 1 This proposed patch makes the dm_dev structure visible in the public header
Created attachment 209011 [details] Proposed Patch 2 This patch keeps the dm_dev structure private but adds a public function to obtain the block_device from the dm_dev object.
I just attached two patches, either of which would solve the problem. Both of them should at least show what I mean by the block_device member of dm_dev. I don't particularly care which method gets implemented, which is why I proposed both methods. I've added [patch] to the summary; feel free to adjust as necessary. Thanks
Adding lvm-team to the cc:
Surprisingly, you're the first person to ask for this! (We'll make a decision on how to export this and some related things upstream, then the solution will get sucked into Fedora.)
Hello, I'm reviewing this bug as part of the kernel bug triage project, an attempt to isolate current bugs in the Fedora kernel. http://fedoraproject.org/wiki/KernelBugTriage There hasn't been much activity on this bug for a while. Has the solution been sucked? :) If the problem no longer exists then please close this bug or I'll do so in a few days if there is no additional information lodged.
.
Changing version to '9' as part of upcoming Fedora 9 GA. More information and reason for this action is here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
This message is a reminder that Fedora 9 is nearing its end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 9. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '9'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 9's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 9 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug to the applicable version. If you are unable to change the version, please add a comment here and someone will do it for you. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
This is still an issue in F10; Probably still in F11 but I haven't tried that yet.
This message is a reminder that Fedora 10 is nearing its end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 10. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '10'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 10's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 10 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug to the applicable version. If you are unable to change the version, please add a comment here and someone will do it for you. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Fedora 10 changed to end-of-life (EOL) status on 2009-12-17. Fedora 10 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. Thank you for reporting this bug and we are sorry it could not be fixed.
I think this is resolved now: let's see. For display purposes, we have: const char *dm_device_name(struct mapped_device *md) { return md->name; } EXPORT_SYMBOL_GPL(dm_device_name); Or we have, e.g. for use with disk_devt() or disk_to_dev(): /* * The gendisk is only valid as long as you have a reference * count on 'md'. */ struct gendisk *dm_disk(struct mapped_device *md) { return md->disk; }
and device-mapper.h does now contain struct dm_dev { struct block_device *bdev; fmode_t mode; char name[16]; };