我正在尝试对 IO 繁重的代码使用预取提示。我根据我对 gpfs_fcntl() 手册页的理解设置了代码,但确实得到了 EINVAL。我现在做错了什么有点迷茫 - 任何提示都值得赞赏。
山:/dev/scratch16 on /bgscratch type gpfs (rw,dev=cadmos-gss.gss1a:scratch16,ldev=scratch16)
Error: Prefetch using gpfs_fcntl failed: Invalid argument (22), 32768b at 7713095680 from /bgscratch/foo.dat
文件:-rw-rw-r-- 1 delalond bbp 14739308544 Jul 25 2012 /bgscratch/foo.dat
资源:
void BufferedFile::prefetch( const uint64_t offset, const uint64_t size )
{
if( file_.fd == -1 )
file_.fd = ::open( filename.c_str(), O_RDONLY );
if( file_.fd == -1 )
{
LBWARN << "open() failed: " << lunchbox::sysError << std::endl;
return;
}
struct
{
gpfsFcntlHeader_t hdr;
gpfsAccessRange_t acc;
} arg;
arg.hdr.totalLength = sizeof(arg);
arg.hdr.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
arg.hdr.fcntlReserved = 0;
arg.acc.structLen = sizeof(arg.acc);
arg.acc.structType = GPFS_ACCESS_RANGE;
arg.acc.start = offset;
arg.acc.length = size;
arg.acc.isWrite = 0;
if( gpfs_fcntl( file_.fd, &arg ) != 0 )
LBWARN << "Prefetch using gpfs_fcntl failed: " << lunchbox::sysError
<< ", " << size << "b at " << offset << " from " << filename
<< std::endl;
}
编辑:我可以在独立应用程序中重现该问题,并且一旦启动大于 4GB 就会发生错误,即使它是一个很长的 64 位系统。