Commit d081f568 authored by David COME's avatar David COME
Browse files

Moved the computation of the number of blocks to a function

parent 34fb8fe1
......@@ -71,7 +71,7 @@ namespace daemon {
tape::utils::suppresUnusedVariable(sp);
m_lc.log(LOG_INFO, "Logged file to migrate");
const u_signed64 neededBlock = fileSize/blockCapacity + ((fileSize%blockCapacity==0) ? 0 : 1);
const u_signed64 neededBlock = howManyBlocksNeeded(fileSize,blockCapacity);
std::auto_ptr<TapeWriteTask> twt(new TapeWriteTask(neededBlock,removeOwningList((*it)->clone()),m_memManager));
std::auto_ptr<DiskReadTask> drt(new DiskReadTask(*twt,removeOwningList((*it)->clone()),neededBlock));
......
......@@ -69,6 +69,12 @@ public:
void requestInjection(int maxFiles, int byteSizeThreshold, bool lastCall);
private:
/*Compute how many blocks are needed for a file of fileSize bytes*/
size_t howManyBlocksNeeded(size_t fileSize,size_t blockCapacity){
return fileSize/blockCapacity + ((fileSize%blockCapacity==0) ? 0 : 1);
}
/**
* A request of files to migrate. We request EITHER
* - a maximum of nbMaxFiles files
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment