consolidate generic_writepages and mpage_writepages