-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get the correct size for block devices (#207)
The function `Size()` of `FileInfo` returns the length in bytes for regular files. However if we use a block device, `Size()` will return a length of zero. To chunk a file, we use the size to split the expected work in even parts. For this reason, when we wanted to generate an index from a block device, due to the incorrect reported zero size, the whole task was carried out by a single Goroutine. With this commit we use the ioctl `BLKGETSIZE64` to get the correct size for block devices. In a test environment the `make` operation against a block device took 2 minutes and 20 seconds to complete with the current master branch and only 24 seconds with this patch. Signed-off-by: Ludovico de Nittis <[email protected]>
- Loading branch information
Showing
3 changed files
with
49 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters