MCPcopy Create free account
hub / github.com/ceph/ceph / create_objects

Method create_objects

src/client/SyntheticClient.cc:2224–2302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2222};
2223
2224int SyntheticClient::create_objects(int nobj, int osize, int inflight)
2225{
2226 // divy up
2227 int numc = num_client ? num_client : 1;
2228
2229 int start, inc, end;
2230
2231 if (1) {
2232 // strided
2233 start = client->get_nodeid().v; //nobjs % numc;
2234 inc = numc;
2235 end = start + nobj;
2236 } else {
2237 // segments
2238 start = nobj * client->get_nodeid().v / numc;
2239 inc = 1;
2240 end = nobj * (client->get_nodeid().v+1) / numc;
2241 }
2242
2243 dout(5) << "create_objects " << nobj << " size=" << osize
2244 << " .. doing [" << start << "," << end << ") inc " << inc
2245 << dendl;
2246
2247 bufferptr bp(osize);
2248 bp.zero();
2249 bufferlist bl;
2250 bl.push_back(bp);
2251
2252 ceph::mutex lock = ceph::make_mutex("create_objects lock");
2253 ceph::condition_variable cond;
2254
2255 int unsafe = 0;
2256
2257 list<utime_t> starts;
2258
2259 for (int i=start; i<end; i += inc) {
2260 if (time_to_stop()) break;
2261
2262 object_t oid = file_object_t(999, i);
2263 object_locator_t oloc(SYNCLIENT_FIRST_POOL);
2264 SnapContext snapc;
2265
2266 if (i % inflight == 0) {
2267 dout(6) << "create_objects " << i << "/" << (nobj+1) << dendl;
2268 }
2269 dout(10) << "writing " << oid << dendl;
2270
2271 starts.push_back(ceph_clock_now());
2272 {
2273 std::lock_guard locker{client->client_lock};
2274 client->objecter->write(oid, oloc, 0, osize, snapc, bl,
2275 ceph::real_clock::now(), 0,
2276 new C_Ref(lock, cond, &unsafe));
2277 }
2278 {
2279 std::unique_lock locker{lock};
2280 cond.wait(locker, [&unsafe, inflight, this] {
2281 if (unsafe > inflight) {

Callers

nothing calls this directly

Calls 11

make_mutexFunction · 0.85
file_object_tClass · 0.85
ceph_clock_nowFunction · 0.85
nowFunction · 0.50
get_nodeidMethod · 0.45
zeroMethod · 0.45
push_backMethod · 0.45
writeMethod · 0.45
waitMethod · 0.45
frontMethod · 0.45
pop_frontMethod · 0.45

Tested by

no test coverage detected