Wire putsmap/getsmap up for mysql and use it instead of the for loop.  Pull start_bulk_insert and end_bulk_insert info files_shl as static functions.  Stop writing sector data to files.  Unconstify getsmap since we need to be able to write to the map.