Write scheduler changes towards selecting between competing writing streams.

Not done yet. Need to finish stream priority handling first.