mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 13:09:00 +00:00
Fix madvise code
This commit is contained in:
parent
a1a9d33b17
commit
da40172c68
@ -127,15 +127,15 @@ public class MultimapFileLong implements AutoCloseable, MultimapFileLongSlice {
|
||||
var buff = mappedByteBuffers.get((int)(startLongs / bufferSize));
|
||||
|
||||
if ((int)(startLongs / bufferSize) != (int)((endLongs) / bufferSize)) {
|
||||
logger.warn("Misaligned madvise, skipping");
|
||||
logger.debug("Misaligned madvise, skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
NativeIO.madviseRange(buff, advice, (startLongs % bufferSize) * WORD_SIZE, (int)(lengthLongs*WORD_SIZE));
|
||||
}
|
||||
|
||||
public void pokeRange(long offset, int length) {
|
||||
for (int i = 0; i < length; i += 4096/8) {
|
||||
public void pokeRange(long offset, long length) {
|
||||
for (long i = 0; i < length; i += 4096/8) {
|
||||
get(offset + i);
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,9 @@ import com.google.inject.Inject;
|
||||
import com.google.inject.name.Named;
|
||||
import com.upserve.uppend.blobs.NativeIO;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import nu.marginalia.wmsa.edge.index.conversion.SearchIndexConverter;
|
||||
import nu.marginalia.util.btree.BTreeReader;
|
||||
import nu.marginalia.util.multimap.MultimapFileLong;
|
||||
import nu.marginalia.wmsa.edge.index.conversion.SearchIndexConverter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -49,7 +49,7 @@ public class SearchIndex implements AutoCloseable {
|
||||
urls.advice(NativeIO.Advice.Random);
|
||||
words.forEachWordsOffset(offset -> {
|
||||
var h = reader.getHeader(offset);
|
||||
int length = (int) (h.dataOffsetLongs() - h.indexOffsetLongs());
|
||||
long length = h.dataOffsetLongs() - h.indexOffsetLongs();
|
||||
|
||||
urls.adviceRange(NativeIO.Advice.Normal, offset, 512);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user