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�����r��y����b�X��ǧv�^�){.n�+���z�]z���{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�m��������zZ+�����ݢj"��!�i