Add support of fallocate for FS and XL backends (#3032)

This commit is contained in:
Anis Elleuch
2016-10-29 20:44:44 +01:00
committed by Harshavardhana
parent 0b3282ac9f
commit a47ce7ab22
17 changed files with 415 additions and 50 deletions

View File

@@ -69,3 +69,16 @@ func (xl xlObjects) isObject(bucket, prefix string) (ok bool) {
} // Exhausted all disks - return false.
return false
}
// Calculate the space occupied by an object in a single disk
func (xl xlObjects) sizeOnDisk(fileSize int64, blockSize int64, dataBlocks int) int64 {
numBlocks := fileSize / blockSize
chunkSize := getChunkSize(blockSize, dataBlocks)
sizeInDisk := numBlocks * chunkSize
remaining := fileSize % blockSize
if remaining > 0 {
sizeInDisk += getChunkSize(remaining, dataBlocks)
}
return sizeInDisk
}