MCPcopy Create free account
hub / github.com/apache/trafficserver / write_to_disk_no_lock

Method write_to_disk_no_lock

plugins/traffic_dump/session_data.cc:331–348  ·  view source on GitHub ↗

* Note this assumes that the caller holds the disk_io_mutex lock. This is a * private member function. The two publicly accessible functions hold the * lock before calling this. */

Source from the content-addressed store, hash-verified

329 * lock before calling this.
330 */
331int
332SessionData::write_to_disk_no_lock(std::string_view content)
333{
334 char *pBuf = nullptr;
335 // Allocate a buffer for aio writing
336 if ((pBuf = static_cast<char *>(TSmalloc(sizeof(char) * content.size())))) {
337 memcpy(pBuf, content.data(), content.size());
338 if (TS_SUCCESS == TSAIOWrite(log_fd, write_offset, pBuf, content.size(), aio_cont)) {
339 // Update offset within file and aio events count
340 write_offset += content.size();
341 aio_count += 1;
342
343 return TS_SUCCESS;
344 }
345 TSfree(pBuf);
346 }
347 return TS_ERROR;
348}
349
350int
351SessionData::write_to_disk(std::string_view content)

Callers

nothing calls this directly

Calls 6

TSmallocFunction · 0.85
TSAIOWriteFunction · 0.85
TSfreeFunction · 0.85
memcpyFunction · 0.50
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected