I don't quite understand the subject line, what does " for just one time" mean here? From my reading of the patch we always do it. > +static int do_cow_at_local(struct request *req, struct sd_req *cow_hdr) I'd call this gateway_handle_copy_on_write or similar. > @@ -106,6 +144,14 @@ int forward_write_obj_req(struct request *req) > memcpy(&fwd_hdr, &req->rq, sizeof(fwd_hdr)); > fwd_hdr.flags |= SD_FLAG_CMD_IO_LOCAL; > > + if (fwd_hdr.flags & SD_FLAG_CMD_COW) { > + ret = do_cow_at_local(req, &fwd_hdr); > + if (!ret) { > + fwd_hdr.flags &= ~SD_FLAG_CMD_COW; > + req->rq.flags &= ~SD_FLAG_CMD_COW; > + } > + } If you initialize the forward hdr after the COW this code would be quite a bit simpler. |