]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls: cls_read, cls_cxx_read return the number of bytes read
authorYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 29 Jun 2010 22:11:04 +0000 (15:11 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 29 Jun 2010 23:00:05 +0000 (16:00 -0700)
src/objclass/class_api.cc

index 2bfe212c983876c64fc8a2aa9db725d0fdc18455..fd057f511c743b647e14bb64fb17736347acc5e2 100644 (file)
@@ -170,17 +170,24 @@ int cls_read(cls_method_context_t hctx, int ofs, int len,
   memcpy(*outdata, odata.c_str(), odata.length());
   *outdatalen = odata.length();
 
-  return r;
+  if (r < 0)
+    return r;
+
+  return *outdatalen;
 }
 
 int cls_cxx_read(cls_method_context_t hctx, int ofs, int len, bufferlist *outbl)
 {
   ReplicatedPG::OpContext **pctx = (ReplicatedPG::OpContext **)hctx;
   vector<OSDOp> ops(1);
+  int ret;
   ops[0].op.op = CEPH_OSD_OP_READ;
   ops[0].op.extent.offset = ofs;
   ops[0].op.extent.length = len;
-  return (*pctx)->pg->do_osd_ops(*pctx, ops, *outbl);
+  ret = (*pctx)->pg->do_osd_ops(*pctx, ops, *outbl);
+  if (ret < 0)
+    return ret;
+  return outbl->length();
 }
 
 int cls_cxx_write(cls_method_context_t hctx, int ofs, int len, bufferlist *inbl)