]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
librgw: cleanup rgw_write
authorMatt Benjamin <mbenjamin@redhat.com>
Sun, 17 Jan 2016 21:46:05 +0000 (16:46 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Fri, 12 Feb 2016 17:08:11 +0000 (12:08 -0500)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_file.cc

index a4060a7f9209efc040547e0c1709b54c4c48bf5a..f168faac28e597c05448c95c0d508c02fea96ee4 100644 (file)
@@ -405,9 +405,6 @@ namespace rgw {
     lock_guard guard(mtx);
 
     int rc = 0;
-    buffer::list bl;
-    bl.push_back(
-      buffer::create_static(len, static_cast<char*>(buffer)));
 
     file* f = get<file>(&variant_type);
     if (! f)
@@ -422,6 +419,10 @@ namespace rgw {
       rc = rgwlib.get_fe()->start_req(f->write_req);
     }
 
+    buffer::list bl;
+    bl.push_back(
+      buffer::create_static(len, static_cast<char*>(buffer)));
+
     f->write_req->put_data(off, bl);
     rc = f->write_req->exec_continue();
 
@@ -1142,6 +1143,8 @@ int rgw_write(struct rgw_fs *rgw_fs,
   RGWFileHandle* rgw_fh = get_rgwfh(fh);
   int rc;
 
+  *bytes_written = 0;
+
   if (! rgw_fh->is_file())
     return -EISDIR;
 
@@ -1160,11 +1163,6 @@ int rgw_write(struct rgw_fs *rgw_fs,
            << " rc " << rc
            << std::endl;
 
-  std::string str;
-  str.reserve(length+1);
-  str.assign(static_cast<char*>(buffer), uint32_t(length));
-  str += '\0';
-
   return rc;
 }