uschindler commented on code in PR #13219:
URL: https://github.com/apache/lucene/pull/13219#discussion_r1539364622
##########
lucene/core/src/java21/org/apache/lucene/store/PosixNativeAccess.java:
##########
@@ -137,17 +136,11 @@ public void madvise(MemorySegment segment, IOContext
context) throws IOException
}
private Integer mapIOContext(IOContext ctx) {
- // Merging always wins and implies sequential access, because kernel is
advised to free pages
- // after use:
- if (ctx.context() == Context.MERGE) {
- return POSIX_MADV_SEQUENTIAL;
- }
- if (ctx.randomAccess()) {
- return POSIX_MADV_RANDOM;
- }
- if (ctx.readOnce()) {
- return POSIX_MADV_SEQUENTIAL;
- }
- return null;
+ return switch (ctx.readAdvice()) {
Review Comment:
I think we can remove the context from the signature and change it to
`madvise(MemorySegment, ReadAdvice)`. `MemorySegmentIndexInputProvider` would
just pass `context.readAdvice()` to `madvise()` then.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]