* 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. */
| 329 | * lock before calling this. |
| 330 | */ |
| 331 | int |
| 332 | SessionData::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 | |
| 350 | int |
| 351 | SessionData::write_to_disk(std::string_view content) |