Barrier support in device mapper
Hi Alasdair
What are plans in supporting barriers in device mapper?
Sometime back Andi Kleen posted a patch[1] to support barriers for single- device dm-devices.
Recently Milan Broz posted an RFC patch-set[2] to implement full-barrier support.
Are we going to get full-barrier support soon? If not, I would like to see Andi's patch being merged till we get full barrier support ready. I would like to know your thoughts.
Thanks
Nikanth Karthikesan
SUSE Labs
[1] http://lkml.org/lkml/2008/2/15/125
[2] http://article.gmane.org/gmane.linux.kernel.device-mapper.devel/5941
Quoted 3 lines · Nikanth Karthikesan
Are we going to get full-barrier support soon? If not, I would like to see Andi's patch being merged till we get full barrier support ready. I would like to know your thoughts.
Hi,
Andi's patch is not complete and I think there can be several problems with it:
- imagine DM device which has barrier support switched on by this simple patch and you try to run pvmove on it. How is the barrier request processed by underlying devices now?
-> mapping can change online (pvmove, lvextend, lvconvert, ...) to more complicated mapping - who reset barrier flag support?
- what about stacking devices? Imagine crypto - there is one device per table possible under linear target (where you enable barriers by this patch). dm-crypt will need to implement some queue flushes to properly support barriers. Another example - partition mapping over multipath (kpartx), ... Are you sure that is it safe with Andi's patch?
...
It is dangerous to use that patch IMO, better not support barriers at all here. That's why we need something more robust.
Unfortunately I received _no_ feedback to mentioned RFC barrier patches.
Milan
--
[email protected]
Quoted 3 lines · Milan Broz
- imagine DM device which has barrier support switched on by this simple patch and you try to run pvmove on it. How is the barrier request processed by underlying devices now?
I don't see how a barrier can go through incorrectly even in this scenario. The pvmove will always be handled by the remapper and then remapper always checks underlying single device and barrier supported and rejects the barrier as needed.
After a request passed the remapper to extent cannot be moved elsewhere again because it's already in flight on the underlying device queues.
Please describe the scenario in more detail that you think will break.
Quoted 8 lines
-> mapping can change online (pvmove, lvextend, lvconvert, ...) to more complicated mapping - who reset barrier flag support?
- what about stacking devices? Imagine crypto - there is one device per table possible under linear target (where you enable barriers by this patch). dm-crypt will need to implement some queue flushes to properly support barriers.
Yes dm_crypt needs more work for barriers (I have an experimental but not quite right patch here for that), but my other patch doesn't enable barriers on dm_crypt anyways. dm_crypt doesn't call dm_barrier_supported() on its target ever, so there won't be any barriers for it.
Quoted 1 line
Another example - partition mapping over multipath (kpartx), ...
dm-mpath doesn't call dm_barrier_supported() either. Did you really read my patch? It sounds like you're ranting about something else, but not my patch.
Quoted 1 line
Are you sure that is it safe with Andi's patch?
I think it is.
Quoted 3 lines
That's why we need something more robust.
Unfortunately I received _no_ feedback to mentioned RFC barrier patches.
What patches? Pointer please.
-Andi
Quoted 9 lines · Andi Kleen
Quoted 3 lines · Milan Broz
- imagine DM device which has barrier support switched on by this simple patch and you try to run pvmove on it. How is the barrier request processed by underlying devices now?
I don't see how a barrier can go through incorrectly even in this scenario. The pvmove will always be handled by the remapper and then remapper always checks underlying single device and barrier supported and rejects the barrier as needed.
Well, it depends what we expect from barrier implementation. I work with the idea that if block device support barriers, it should support them in all situations.
You patch test every single request, so the same request can succeed, minute later the same request can return NOTSUPP because mapping changed. So if this is what you want, you are right - it works.
The pvmove example:
1) one disk, linear mapping -> barriers supported
2) user run pvmove to another disk -> all barriers are rejected during the move
3) pvmove finished -> barriers are supported again
That's probably fine (I expect barrier fs code support this correctly). But it is workaround, not real barrier support in device-mapper.
Quoted 10 lines
Quoted 4 lines
- what about stacking devices? Imagine crypto - there is one device per table possible under linear target (where you enable barriers by this patch). dm-crypt will need to implement some queue flushes to properly support barriers.
Yes
dm_cryptneeds more work for barriers (I have an experimental but not quite right patch here for that), but my other patch doesn't enable barriers ondm_cryptanyways.dm_cryptdoesn't calldm_barrier_supported()on its target ever, so there won't be any barriers for it.
Quoted 5 lines
Quoted 1 line
Another example - partition mapping over multipath (kpartx), ...
dm-mpath doesn't call
dm_barrier_supported()either. Did you really read my patch? It sounds like you're ranting about something else, but not my patch.
Sure - your patch enabled it only for linear target. So the request will fail somewhere down the stack - in mpath/crypt/whatever target.
That wass not against your patch - I just want more generic solution (and and wrote some simple implementation already).
And these workarounds mostly delay the real implementation...
I want barriers for all targets - use some core functionality and process only special situation in targets. See my comments in link below.
Quoted 3 lines
Quoted 1 line
Unfortunately I received _no_ feedback to mentioned RFC barrier patches.
What patches? Pointer please.
The mail I replied to contains links to all mentioned patches:
Quoted 2 lines
[1] http://lkml.org/lkml/2008/2/15/125
[2] http://article.gmane.org/gmane.linux.kernel.device-mapper.devel/5941
Milan
Quoted 6 lines · Milan Broz
Quoted 5 lines · Andi Kleen
Quoted 3 lines · Milan Broz
- imagine DM device which has barrier support switched on by this simple patch and you try to run pvmove on it. How is the barrier request processed by underlying devices now?
Quoted 8 lines
Quoted 4 lines
I don't see how a barrier can go through incorrectly even in this scenario. The pvmove will always be handled by the remapper and then remapper always checks underlying single device and barrier supported and rejects the barrier as needed.
Well, it depends what we expect from barrier implementation. I work with the idea that if block device support barriers, it should support them in all situations.
It does.
Quoted 5 lines
You patch test every single request, so the same request can succeed, minute later the same request can return NOTSUPP because mapping changed. So if this is what you want, you are right - it works.
Quoted 7 lines
The pvmove example:
1) one disk, linear mapping -> barriers supported
2) user run pvmove to another disk -> all barriers are rejected during the move
3) pvmove finished -> barriers are supported againThat's probably fine (I expect barrier fs code support this correctly). But it is workaround, not real barrier support in device-mapper.
It works for 95+% of the users that only have a single disk. That is all my patch was attempting: support the single disk case.
Yes I know there could be more done for multiple disks or dm crypt (although I think to do it well for multiple disks needs behaviour changes in the barriers), but that's orthogonal and shouldn't delay the single disk case patch.
Quoted 3 lines
That wass not against your patch - I just want more generic solution (and and wrote some simple implementation already).
Does solve the single disk case? If it passes the barriers through similar to my patch in the single disk case they would be fine for me.
Although I don't know if your patches would be ready for a .28 merge. I think my patch is. So if your patches would need more work it would be quite reasonable to target the simple patch for .28 and do the more complex stuff later.
Quoted 1 line
And these workarounds mostly delay the real implementation...
I don't know why you can call it a workaround. It's a perfectly fine design to handle barriers on single disk. And no, complexity is not always the goal.
I also don't see how it delays more complex solutions. If you have a more sophisticated scheme ready you can just do it on top of that patch. It's not that it's an extremly complicated patch that makes it hard to do other patches on top of it :)
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
Unfortunately I received _no_ feedback to mentioned RFC barrier patches.
What patches? Pointer please.
The mail I replied to contains links to all mentioned patches:
That's just a description, where are the patches?
Are they equivalent in the single disk case to my patch?
-Andi
Quoted 6 lines · Andi Kleen
Quoted 4 lines
The mail I replied to contains links to all mentioned patches:
That's just a description, where are the patches?
http://article.gmane.org/gmane.linux.kernel.device-mapper.devel/5942
http://article.gmane.org/gmane.linux.kernel.device-mapper.devel/5943
http://article.gmane.org/gmane.linux.kernel.device-mapper.devel/5944
http://article.gmane.org/gmane.linux.kernel.device-mapper.devel/5945
Quoted 1 line
Are they equivalent in the single disk case to my patch?
It transforms barrier to normal bio with following zero-size barrier bio. For the one disk case effect is the same of course.
Milan
Quoted 3 lines
Quoted 1 line
Are they equivalent in the single disk case to my patch?
It transforms barrier to normal bio with following zero-size barrier bio. For the one disk case effect is the same of course.
Ok fine assuming they work. Will they be ready for the 2.6.28 merge window?
If not I would still prefer my patch for .28
-Andi