Optimizing Software-Defined Storage for Flash Memory