MultiDiskAdaptor: Handle short read

pull/251/head
Tatsuhiro Tsujikawa 2014-07-01 23:53:49 +09:00
parent 8750d7be99
commit a3426821c8
1 changed files with 15 additions and 5 deletions

View File

@ -389,12 +389,22 @@ ssize_t MultiDiskAdaptor::readData
if(!(*i)->isOpen()) { if(!(*i)->isOpen()) {
throwOnDiskWriterNotOpened((*i).get(), offset+(len-rem)); throwOnDiskWriterNotOpened((*i).get(), offset+(len-rem));
} }
totalReadLength +=
(*i)->getDiskWriter()->readData(data+(len-rem), readLength, fileOffset); while(readLength > 0) {
rem -= readLength; auto nread = (*i)->getDiskWriter()->readData(data+(len-rem),
if(dropCache) { readLength, fileOffset);
(*i)->getDiskWriter()->dropCache(readLength, fileOffset);
totalReadLength += nread;
if(dropCache) {
(*i)->getDiskWriter()->dropCache(nread, fileOffset);
}
readLength -= nread;
rem -= nread;
fileOffset += nread;
} }
fileOffset = 0; fileOffset = 0;
if(rem == 0) { if(rem == 0) {
break; break;