Repository navigation
Conversation
queryAlignment() threw when statx came back without STATX_DIOALIGN, so storage could not open a file on a pre-6.1 kernel or a filesystem that does not implement the query (BTRFS, among others). It now falls back to stx_blksize, or the page size when the kernel did not report that either, and warns. The page size is a multiple of every sector size such a filesystem uses, so a buffer aligned to it satisfies any of them. Moving the statx struct and the resolution into linux_statx.h lets linux_alignment_check drive the mask directly, since a modern kernel cannot produce the one this fix is about. Writing that check turned up a division by zero: a filesystem that reports the query but zeroes dio_offset_align (tmpfs) had stx_blksize % stx_dio_offset_align evaluated with a zero divisor whenever stx_blksize was larger. The zero case is now passed through for the caller to reject, as before.
fix(storage): fall back when the kernel does not report STATX_DIOALIGN
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes issue #7