diff --git a/storage-proofs-porep/Cargo.toml b/storage-proofs-porep/Cargo.toml index 794b3522b1..f78e2c4557 100644 --- a/storage-proofs-porep/Cargo.toml +++ b/storage-proofs-porep/Cargo.toml @@ -14,7 +14,7 @@ storage-proofs-core = { path = "../storage-proofs-core", version = "~12.0.0", de sha2raw = { path = "../sha2raw", version = "~7.0.0"} filecoin-hashers = { path = "../filecoin-hashers", version = "~7.0.0", default-features = false, features = ["poseidon", "sha256"]} merkletree = "0.22.0" -mapr = "0.8.0" +memmap2 = "0.5.6" num-bigint = "0.4.3" num-traits = "0.2" rayon = "1.0.0" diff --git a/storage-proofs-porep/src/stacked/vanilla/cache.rs b/storage-proofs-porep/src/stacked/vanilla/cache.rs index dc3ec6ce67..6c9c0e0304 100644 --- a/storage-proofs-porep/src/stacked/vanilla/cache.rs +++ b/storage-proofs-porep/src/stacked/vanilla/cache.rs @@ -9,7 +9,7 @@ use byteorder::{ByteOrder, LittleEndian}; use filecoin_hashers::Hasher; use lazy_static::lazy_static; use log::{info, trace}; -use mapr::{Mmap, MmapOptions}; +use memmap2::{Mmap, MmapOptions}; use rayon::prelude::{IndexedParallelIterator, ParallelIterator, ParallelSliceMut}; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; diff --git a/storage-proofs-porep/src/stacked/vanilla/create_label/multi.rs b/storage-proofs-porep/src/stacked/vanilla/create_label/multi.rs index e3a9ca38ec..e662a838dc 100644 --- a/storage-proofs-porep/src/stacked/vanilla/create_label/multi.rs +++ b/storage-proofs-porep/src/stacked/vanilla/create_label/multi.rs @@ -16,7 +16,7 @@ use generic_array::{ GenericArray, }; use log::{debug, info}; -use mapr::MmapMut; +use memmap2::MmapMut; use merkletree::store::{DiskStore, Store, StoreConfig}; use storage_proofs_core::{ cache_key::CacheKey, diff --git a/storage-proofs-porep/src/stacked/vanilla/memory_handling.rs b/storage-proofs-porep/src/stacked/vanilla/memory_handling.rs index 5d3b1d0e63..8180f2f961 100644 --- a/storage-proofs-porep/src/stacked/vanilla/memory_handling.rs +++ b/storage-proofs-porep/src/stacked/vanilla/memory_handling.rs @@ -10,7 +10,7 @@ use std::sync::atomic::{AtomicU64, AtomicUsize, Ordering}; use anyhow::Result; use byte_slice_cast::{AsSliceOf, FromByteSlice}; use log::{info, warn}; -use mapr::{Mmap, MmapMut, MmapOptions}; +use memmap2::{Mmap, MmapMut, MmapOptions}; pub struct CacheReader { file: File, @@ -192,8 +192,7 @@ impl CacheReader { MmapOptions::new() .offset(offset) .len(len) - .private() - .map(file) + .map_copy_read_only(file) .map_err(|e| e.into()) } } @@ -278,19 +277,16 @@ impl CacheReader { fn allocate_layer(sector_size: usize) -> Result { match MmapOptions::new() .len(sector_size) - .private() - .clone() - .lock() .map_anon() .and_then(|mut layer| { - layer.mlock()?; + layer.lock()?; Ok(layer) }) { Ok(layer) => Ok(layer), Err(err) => { // fallback to not locked if permissions are not available warn!("failed to lock map {:?}, falling back", err); - let layer = MmapOptions::new().len(sector_size).private().map_anon()?; + let layer = MmapOptions::new().len(sector_size).map_anon()?; Ok(layer) } }