dm-userspace
Hi List,
As you all know, I'm working on a userspace-controlled CoW implementation using device-mapper. The idea is to offer a pseudo device through device-mapper that has CoW behavior, but where the block allocation decisions are made from userspace.
My thoughts are that it might be best to abandon the concept of the "dm-cow" target and instead work on a "dm-userspace" target. The userspace cow application I'm working on would remain mostly the same. Similarly, dm-userspace would look almost identical to my dm-cow does right now, but more generic. The target would simply present the details of the data passed to the map() function to userspace, which would respond with a target device and sector of where to send the request.
A generic dm-userspace target would allow for testing of new algorithms (RAID, CoW, etc) from a userspace application, as well as some more interesting things involving distributed applications. Just like FUSE allows for some neat (although not necessarily high-performance) tricks, dm-userspace could allow the same thing for block devices.
Would the device-mapper maintainers be interested in accepting something like dm-userspace upstream?
Signature · 4 lines
Dan Smith IBM Linux Technology Center Open Hypervisor Team email: [email protected]
Quoted 11 lines · Dan Smith
A generic dm-userspace target would allow for testing of new algorithms (RAID, CoW, etc) from a userspace application, as well as some more interesting things involving distributed applications. Just like FUSE allows for some neat (although not necessarily high-performance) tricks, dm-userspace could allow the same thing for block devices.
Would the device-mapper maintainers be interested in accepting something like dm-userspace upstream?
It seems like this would be really useful for prototyping and debugging new device mapper modules (like the dm-cache ideas I posted about a few weeks back). At the very least, I'd be interested in using it?
A couple of questions:
1) how would you handle permissions? IIRC FUSE allows normal users to bind their own FUSE userspace file systems, would something similar happen for dm-userspace or would even binding a userspace device-mapper module require root?
2) How close would the userspace API be to the kernel device-mapper API? It'd be nice to have something close so that userspace code could easily be migrated into the kernel (for performance reasons) as appropriate.
3) When do you think you'll be able to post a patch for RFC?
-eric
EVH> It seems like this would be really useful for prototyping and EVH> debugging new device mapper modules (like the dm-cache ideas I EVH> posted about a few weeks back).
Yes, I think that is a major benefit to going with the dm-userspace idea over the cow-specific dm-cow.
EVH> 1) how would you handle permissions? IIRC FUSE allows normal EVH> users to bind their own FUSE userspace file systems, would EVH> something similar happen for dm-userspace or would even binding a EVH> userspace device-mapper module require root?
Hmm, I think that due to the way device-mapper works, this would be difficult. Without the ability to create a pseudo-device with a dm-userspace target, I think you'd be out of luck.
EVH> 2) How close would the userspace API be to the kernel EVH> device-mapper API? It'd be nice to have something close so that EVH> userspace code could easily be migrated into the kernel (for EVH> performance reasons) as appropriate.
Well, currently I pass basically the same information to userspace. You get the location of the access and whether it was a read or a write. The userspace module passes back a destination location, device, and whether or not to copy the area from a source location (which gives you an interface to kcopyd).
I think that we could easily add a layer to be able to run simple device-mapper modules in userspace with it, similar to how nfsim works, which may be very useful to people trying to write new device-mapper targets. What are people's thoughts on this?
Something I should mention here: to simplify things and reduce communication, the current module blocks contiguous regions of the disk together so that you can talk about whole chunks at a time, instead of each individual bio request, which may be of varying size and location. Block sizes can be no smaller than 512 bytes. I think that most device-mapper work will be dealing with fixed blocks of some size, so this shouldn't be a problem.
EVH> 3) When do you think you'll be able to post a patch for RFC?
I'm currently just cleaning some things up at the moment. I would be glad to post a patch and a sample userspace app if people would be willing to take a look at it.
Signature · 4 lines
Dan Smith IBM Linux Technology Center Open Hypervisor Team email: [email protected]