}
lock.Unlock();
//create new contents and name on the heap, and fill them
- newContents = new bufferlist();
newName = generate_object_name(data.started);
- snprintf(data.object_contents, data.object_size, "I'm the %16dth object!", data.started);
- newContents->append(data.object_contents, data.object_size);
+ newContents = contents[slot];
+ snprintf(newContents->c_str(), data.object_size, "I'm the %16dth object!", data.started);
+ // we wrote to buffer, going around internal crc cache, so invalidate it now.
+ newContents->invalidate_crc();
+
completion_wait(slot);
lock.Lock();
r = completion_ret(slot);
release_completion(slot);
timePassed = ceph_clock_now(cct) - data.start_time;
- //write new stuff to backend, then delete old stuff
- //and save locations of new stuff for later deletion
+ //write new stuff to backend
start_times[slot] = ceph_clock_now(cct);
r = create_completion(slot, _aio_cb, &lc);
if (r < 0)
if (r < 0) {//naughty; doesn't clean up heap space.
goto ERR;
}
- delete contents[slot];
name[slot] = newName;
- contents[slot] = newContents;
- newContents = 0;
lock.Lock();
++data.started;
++data.in_flight;
lock.Unlock();
release_completion(slot);
delete contents[slot];
+ contents[slot] = 0;
}
timePassed = ceph_clock_now(cct) - data.start_time;
sync_write(run_name_meta, b_write, sizeof(int)*3);
completions_done();
+ for (int i = 0; i < concurrentios; i++)
+ if (contents[i])
+ delete contents[i];
return 0;
data.done = 1;
lock.Unlock();
pthread_join(print_thread, NULL);
- delete newContents;
+ for (int i = 0; i < concurrentios; i++)
+ if (contents[i])
+ delete contents[i];
return r;
}
release_completion(slot);
cur_contents = contents[slot];
+ // invalidate internal crc cache
+ cur_contents->invalidate_crc();
+
//start new read and check data if requested
start_times[slot] = ceph_clock_now(cct);
- contents[slot] = new bufferlist();
create_completion(slot, _aio_cb, (void *)&lc);
r = aio_read(newName, slot, contents[slot], data.object_size);
if (r < 0) {
++errors;
}
name[slot] = newName;
- delete cur_contents;
}
//wait for final reads to complete
release_completion(slot);
cur_contents = contents[slot];
+ // invalidate internal crc cache
+ cur_contents->invalidate_crc();
+
//start new read and check data if requested
start_times[slot] = ceph_clock_now(g_ceph_context);
- contents[slot] = new bufferlist();
create_completion(slot, _aio_cb, (void *)&lc);
r = aio_read(newName, slot, contents[slot], data.object_size);
if (r < 0) {
++errors;
}
name[slot] = newName;
- delete cur_contents;
}
//wait for final reads to complete