Re: Question about output message and object update for ceph class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I take back the question, because I just found that for a succeed
write opetion in the class, *no* data in the out buffer...

On Wed, Feb 4, 2015 at 5:44 PM, Dennis Chen <kernel.org.gnu@xxxxxxxxx> wrote:
> Hello,
>
> I write a ceph client using rados lib to execute a funcution upon the object.
>
> CLIENT SIDE CODE
> ===============
> int main()
> {
>   ...
>     strcpy(in, "from client");
>     err = rados_exec(io, objname, "devctl", "devctl_op", in,
> strlen(in), out, 128);
>     if (err < 0) {
>         fprintf(stderr, "rados_exec() failed: %s\n", strerror(-err));
>         rados_ioctx_destroy(io);
>         rados_shutdown(cluster);
>         exit(1);
>     }
>     out[err] = '\0';
>     printf("err = %d, exec result out = %s, in = %s\n", err, out, in);
>   ...
> }
>
> CLASS CODE IN OSD SIDE
> ======================
> static int devctl_op(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
> {
>   ...
>
>   i = cls_cxx_stat(hctx, &size, NULL);
>   if (i < 0)
>     return i;
>
>   bufferlist read_bl, write_bl;
>   i = cls_cxx_read(hctx, 0, size, &read_bl);
>   if (i < 0) {
>     CLS_ERR("cls_cxx_read failed");
>     return i;
>   }
>
>
>   // we generate our reply
>   out->append("Hello, ");
>   if (in->length() == 0)
>     out->append("world");
>   else
>     out->append(*in);
>   out->append("!");
>
> #if 1
>   const char *tstr = "from devctl func";
>   write_bl.append(tstr);
>   i = cls_cxx_write(hctx, size, write_bl.length(), &write_bl);
>   if (i < 0) {
>     CLS_ERR("cls_cxx_write failed: %s", strerror(-i));
>     return i;
>   }
> #endif
>
>   // this return value will be returned back to the librados caller
>   return 0;
> }
>
> I found that if I update the content of the object when calling
> cls_cxx_write(), then the 'out' will be null in the client side,
> otherwise the out will be "Hello, from client!".
>
> Does anybody here can give some hints?
>
> --
> Den



-- 
Den
_______________________________________________
ceph-users mailing list
ceph-users@xxxxxxxxxxxxxx
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com




[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Ceph Dev]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]


  Powered by Linux