Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the correct size for block devices #207

Merged
merged 1 commit into from
Dec 25, 2021

Commits on Dec 23, 2021

  1. Get the correct size for block devices

    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 <ludovico.denittis@collabora.com>
    RyuzakiKK committed Dec 23, 2021
    Configuration menu
    Copy the full SHA
    8758614 View commit details
    Browse the repository at this point in the history