Refactor dirty page bitmap allocation
Thread safety changes for flush_dirty_pages

Previously, multiple threads could be reading and writing
from the dirty_pages bitmap. This could potentially cause
problems, since the updates are done at a byte level, but
only a single bit is being flipped, so that changes could
be lost. Solution is to do an atomic flip to a new bitmap,
and use a private copy.