Reorder metadata updating patter in WB mode
In WB mode metadata should be updated only if the actuall data had been saved
on disk. Otherwise metadata might be flushed too early and consequently data
corruption might occur.
@@ -74,6 +74,8 @@ static int ocf_write_wb_do_flush_metadata(struct ocf_request *req)
env_atomic_set(&req->req_remaining, 1); /* One core IO */
+ _ocf_write_wb_update_bits(req);
+
if (req->info.flush_metadata) {
OCF_DEBUG_RQ(req, "Flush metadata");
ocf_metadata_flush_do_asynch(cache, req,
@@ -152,9 +154,6 @@ int ocf_write_wb_do(struct ocf_request *req)
/* Get OCF request - increase reference counter */
ocf_req_get(req);
- /* Update status bits */
- _ocf_write_wb_update_bits(req);
-
/* Submit IO */
_ocf_write_wb_submit(req);
