utils: Use fallback for macOS in AllocateFileRange #17884

pull IPGlider wants to merge 1 commits into bitcoin:master from IPGlider:workaround_apfs_allocation_problem changing 1 files +0 −13
  1. IPGlider commented at 7:54 pm on January 6, 2020: contributor

    Following the findings collected in issue #17827 this PR removes the specific macOS code in favor of the generic fallback. Hence, APFS volumes with just enough free space can still complete the IBD.

    ftruncate behaves erratically when used in an APFS volume, generating rev*.data files with a size considerably bigger than expected.

    Using the generic method solves the problem and works for both APFS and HFS+.

  2. utils: Use fallback for macOS in AllocateFileRange
    ftruncate behaves erratically when used in an APFS volume, generating
    rev*.data files with a size considerably bigger than expected.
    
    Using the generic method solves the problem and works for both APFS and
    HFS+.
    49bff2ed13
  3. MarcoFalke added the label Block storage on Jan 6, 2020
  4. MarcoFalke added the label macOS on Jan 6, 2020
  5. MarcoFalke commented at 7:58 pm on January 6, 2020: member
    Concept ACK for fixing a bug by removing code. Didn’t look at the changes, though.
  6. kallewoof commented at 12:09 pm on January 7, 2020: member

    Concept NACK. We still want to do file range allocation (edit: using the built-in functionality) even on macs. However, it looks like we are using the F_PREALLOCATE function incorrectly.

    From the manpage:

    0     The position modes (fst_posmode) for the F_PREALLOCATE command indicate how to use the offset field.  The modes are as follows:
    1
    2           F_PEOFPOSMODE   Allocate from the physical end of file.  In this case, fst_length indicates the number of newly allocated bytes desired.
    3
    4           F_VOLPOSMODE    Allocate from the volume offset.
    

    we are using F_PEOFPOSMODE so we want to ignore the offset argument in

    0fst.fst_length = (off_t)offset + length;
    

    and update the ftruncate call to

    0    ftruncate(fileno(file), (off_t)offset + length);
    

    (edit: I missed the second step in my initial attempt, which resulted in truncated files and brokenness)

  7. DrahtBot commented at 1:55 pm on January 7, 2020: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #17887 (bug-fix macos: give free bytes to F_PREALLOCATE by kallewoof)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  8. IPGlider closed this on Jan 7, 2020

  9. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-31 03:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me