How to use the class Filer in Ceph

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

 



Dear All,

   Currently, I’m using the class Filer to operate the OSD directly. And below list the codes.
The write_trunc routing return success, but I can’t read back the object, and I got r = -2,  -ENOENT.
Would anyone help me to answer the question that how to use those functions?  Thanks!

The input parameters are:
in->ino = 0x10000000035;
In->layout.fl_stripe_unit = stripe_unit = 4194304;
In->layout.fl_stripe_count = stripe_count = 1;
In->layout.fl_object_size = object_size = 4194304;
In->layout.fl_pg_pool = 0;
in->snaprealm = new SnapRealm(in->ino);
in->snaprealm->build_snap_context();

The writing code looks like this.
    Mutex flock("MClient::_write flock");
    Cond cond;
    bool done = false;
    Context *onfinish = new C_SafeCond(&flock, &cond, &done);
    Context *onsafe = new C_Client_SyncCommit(this, in);

    unsafe_sync_write++;
    get_cap_ref(in, CEPH_CAP_FILE_BUFFER);  // released by onsafe callback

    r = filer->write_trunc(in->ino, &in->layout, in->snaprealm->get_snap_context(),
                                                   offset, size, bl, ceph_clock_now(cct), 0,
                                                   in->truncate_size, in->truncate_seq,
                                                   onfinish, onsafe);
    if (r < 0)
      goto done;

    client_lock.Unlock();
    flock.Lock();
    while (!done)
      cond.Wait(flock);
 flock.Unlock();
 
The reading code looks like this.

Mutex flock("MClient::_read_sync flock");
bool done = false;
    Context *onfinish = new C_SafeCond(&flock, &cond, &done, &r);
    bufferlist tbl;

    int wanted = left;
    filer->read_trunc(in->ino, &in->layout, in->snapid,
                                      pos, left, &tbl, 0,
                                      in->truncate_size, in->truncate_seq,
                                      onfinish);
    client_lock.Unlock();
    flock.Lock();
    while (!done)
      cond.Wait(flock);
 flock.Unlock();

Thomas

 
 

________________________________
This email and any attachments are confidential and may be privileged. If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. This email does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. Thank you.
��.n��������+%������w��{.n����z��u���ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f





[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux