We call FileMapInfo::write_region twice in a loop:
http://hg.openjdk.java.net/jdk/jdk/file/ee37c9b2eb61/src/hotspot/share/memory/metaspaceShared.cpp#l1552
+ The first time just to store the CRC and offset of the region into the file header
+ then we compute CRC of the header and write the header
+ then we call write_region a second time to actually write it
This is too awkward. We should just write the regions, and then seek the fd back to the beginning of the file, and then write the header.
http://hg.openjdk.java.net/jdk/jdk/file/ee37c9b2eb61/src/hotspot/share/memory/metaspaceShared.cpp#l1552
+ The first time just to store the CRC and offset of the region into the file header
+ then we compute CRC of the header and write the header
+ then we call write_region a second time to actually write it
This is too awkward. We should just write the regions, and then seek the fd back to the beginning of the file, and then write the header.