You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "monkuta (via GitHub)" <gi...@apache.org> on 2024/09/04 12:26:22 UTC
Re: [PR] Memory map: mmap+memcopy instead pread+pwrite [trafficserver]
monkuta commented on code in PR #11484:
URL: https://github.com/apache/trafficserver/pull/11484#discussion_r1743686975
##########
src/iocore/aio/AIO.cc:
##########
@@ -378,15 +400,27 @@ cache_op(AIOCallbackInternal *op)
#ifdef AIO_FAULT_INJECTION
err = aioFaultInjection.pread(a->aio_fildes, (static_cast<char *>(a->aio_buf)) + res, a->aio_nbytes - res,
a->aio_offset + res);
+#else
+#if TS_USE_MMAP
+ ink_assert((static_cast<char const *>(a->aio_fildes.first) + a->aio_offset + a->aio_nbytes) <= a->aio_fildes.last);
Review Comment:
Would replacing it with something like this be enough in your opinion?
#if TS_USE_MMAP
if ((static_cast<char const *>(a->aio_fildes.first) + a->aio_offset + a->aio_nbytes) <= a->aio_fildes.last) {
memcpy(static_cast<char *>(a->aio_buf) + res, static_cast<char const *>(a->aio_fildes.first) + a->aio_offset + res,
err = a->aio_nbytes - res);
} else {
err = -1;
}
This will be similarly as for other AIO modes (pwrite and pread).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org