xfs_repair: refactor file writes into a common helper

Create a helper function to write data to a file, then kill the open
coded versions of file writes for rt metadata regeneration.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
3 files changed