On Tue, Aug 27, 2013 at 03:49:22PM +0800, Wenchao Xia wrote: > In order to support multiple caller from different thread, global > inside block layer should be carefully treated. bdrv_states represent > a group of bds* which is now used by qemu, so it is a user concept which > should be managed by user. This series tries to move it out, so later > different thread can feed the API with its own bds* group. > > This is a RFC series which does not completely convert the API, the missing > part is adding parameter *l in all API which uses bdrv_states, then move > bdrv_states to caller. About 10 functions need to be converted, so hope to > get comments before that, to see if this is the right direction.
The global bdrv_states list needs to stay, I don't think we should try to remove it. The list is used to drain and flush all devices so that we can safely shut down or live migrate. If we give each thread their own list then there's no way to globally drain and flush. The invalidate function that you modified is another example: we *must* invalidate all BDS instances across all threads. Failure to invalidate all instances could mean inconsistencies or data loss. So in the end I think we need to keep bdrv_states. Stefan