#if defined(HAVE_PMEM)
if (type == "kernel") {
int is_pmem = 0;
- void *addr = pmem_map_file(path.c_str(), 1024*1024, PMEM_FILE_EXCL, O_RDONLY, NULL, &is_pmem);
+ size_t map_len = 0;
+ void *addr = pmem_map_file(path.c_str(), 0, PMEM_FILE_EXCL, O_RDONLY, &map_len, &is_pmem);
if (addr != NULL) {
if (is_pmem)
type = "pmem";
- pmem_unmap(addr, 1024*1024);
+ else
+ dout(1) << path.c_str() << " isn't pmem file" << dendl;
+ pmem_unmap(addr, map_len);
+ } else {
+ dout(1) << "pmem_map_file:" << path.c_str() << " failed." << pmem_errormsg() << dendl;
}
}
#endif
derr << __func__ << " fstat got " << cpp_strerror(r) << dendl;
goto out_fail;
}
- if (S_ISBLK(st.st_mode)) {
- int64_t s;
- r = get_block_device_size(fd, &s);
- if (r < 0) {
- goto out_fail;
- }
- size = s;
- } else {
- size = st.st_size;
- }
size_t map_len;
- addr = (char *)pmem_map_file(path.c_str(), size, PMEM_FILE_EXCL, O_RDWR, &map_len, NULL);
+ addr = (char *)pmem_map_file(path.c_str(), 0, PMEM_FILE_EXCL, O_RDWR, &map_len, NULL);
if (addr == NULL) {
- derr << __func__ << " pmem_map_file error" << dendl;
+ derr << __func__ << " pmem_map_file failed: " << pmem_errormsg() << dendl;
goto out_fail;
}
size = map_len;
void PMEMDevice::aio_submit(IOContext *ioc)
{
+ if (ioc->priv) {
+ assert(ioc->num_running == 0);
+ aio_callback(aio_callback_priv, ioc->priv);
+ } else {
+ ioc->try_aio_wake();
+ }
return;
}
len -= l;
off1 += l;
}
-
return 0;
}