I'm trying to use prefetching hints on an IO-heavy code. I set up the code according to my understanding of the man page of gpfs_fcntl(), but do get an EINVAL. I'm a bit lost now what I'm doing wrong - any hints are appreciated.
Mount: /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
File: -rw-rw-r-- 1 delalond bbp 14739308544 Jul 25 2012 /bgscratch/foo.dat
Source:
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;
}
Edit: I could reproduce the problem in a standalone application, and the error happens once start in greater than 4GB, even though it is a long long and a 64 bit system.
gpfsAccessRange_t
the elementsstart
andlength
are of typeoffset_t
is this equivalent touint64_t
on your platform? – Timothy Brown