Repository navigation
eval-under-loop: options for image allocation, direct I/O, mkfs and mount - #17
Open
yarikoptic-gitmate wants to merge 3 commits into
Open
yarikoptic-gitmate wants to merge 3 commits into
yarikoptic-gitmate wants to merge 3 commits into
Conversation
…ount --alloc zero|sparse|fallocate picks how the backing image gets its size. zero (dd from /dev/zero) stays the default so CI cells keep measuring the same thing; sparse (truncate) and fallocate are instant, which is what makes TB-sized images practical. fallocate uses fallocate(2) directly, so a host without it (NFS < 4.2) fails loudly instead of glibc's posix_fallocate silently writing every block. --direct-io attaches with losetup --direct-io=on, so image I/O is not cached twice, and warns if the kernel kept the device buffered. --mkfs-opts / --mount-opts pass extra arguments through (e.g. btrfs -m single, discard=async). The image's apparent vs allocated size is logged, so a sparse image is visible as such. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0135xivQQnx5bWMzWD91J5TR
- --direct-io on a host fs without O_DIRECT: current kernels refuse to attach rather than fall back, so say why losetup failed instead of exiting with only its EINVAL. Help/GOTCHAS no longer claim tmpfs lacks O_DIRECT (it has it since 6.6; ramfs is the example now). - --alloc fallocate: vfat implements it by zeroing in the kernel, so it is not an example of failing; list NFS < 4.2, ramfs, ext4 w/o extents. - --mount-opts ro no longer aborts on the post-mount chown; warns. - --mkfs-opts folds newlines into spaces (read -a stopped at the first) and documents that there is no quoting. - --size is validated as a positive integer up front, so the three alloc modes cannot read a bad value three different ways. - Help/README/header no longer say the image is always dd'd; README gets a large sparse btrfs example; default columns say (unset) like the nfs backend. - bats: help/parse test for the new options (incl. value consumption), missing-value and --size validation tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0135xivQQnx5bWMzWD91J5TR
This branch has not been deployed
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.
Makes the loop backend usable for large (up to TB) images, and adds hooks for tuning the filesystem under test. Today the image is always
dd'd from/dev/zero, which means writing every byte up front.New options (each with an
EVAL_UNDER_LOOP_*env var)--alloc zero|sparse|fallocatezerois the default and keeps the oldddbehaviour, so existing CI cells are unchanged.sparseusestruncate: instant, allocates nothing.fallocatecalls fallocate(2) directly: it reserves the blocks without writing them. Where the host can't do it (NFS < 4.2, ramfs) it fails, instead of glibc'sposix_fallocatequietly writing every block.--direct-iolosetup --direct-io=on, so image I/O isn't cached twice. If the host fs lacks O_DIRECT, current kernels refuse to attach; the backend now says that is why. Older kernels attach buffered instead, and the backend warns.--mkfs-opts "..."mkfs.<fs>arguments, split on whitespace (e.g. btrfs-m single -K). There is no quoting.--mount-opts a,bmount -ooptions. For vfat-like filesystems they are appended afteruid=/gid=.Also:
--sizeis now checked to be a positive integer.ro, the post-mountchownno longer aborts the run; it warns instead.Docs: GOTCHAS.md's loop settings table now lists the allocation and loop-I/O settings, plus the btrfs minimum size of 109 MiB. The README has a large sparse btrfs example.
Behaviour for existing callers
With no new options, the run does the same thing as before.
mount -o defaultsis equivalent to a baremount; a real ext4 run still givesrw,relatime. The only new output is oneI: image on host: …log line.bin/ci/run-under.shpasses none of the new options.Review and testing
masteris merged in, so the branch is up to date with master's NFS--mount-opts/--export-opts. That merge had no conflicts.romounts broke the post-mountchown;--mkfs-optssilently dropped the rest of the string;--sizewasn't validated;dd'd;--allocmodes;--direct-io(DIO=1), and on a ramfs host (clear error, clean teardown);--mkfs-optsand--mount-opts, including invalid values,ro, and an embedded newline.bin/ci/shellcheck.shis clean.bats tests/passes 34/34, including 4 new unprivileged loop tests.mkfs.btrfsitself was run: it rejects 100 MB (minimum is 114294784 bytes) and accepts 120 MB.Not in this PR (follow-ups)
Loop btrfsmatrix row. The git-annex target'sloop-size-mb: 100is below btrfs's minimum and would need raising.eval-under nfs --no-root-squash -- eval-under loop --fs btrfs …to put the image on NFS. This already composes throughTMPDIR, but it needs--no-root-squash, and turning it into a matrix row would need anover:field inevals/matrix.yaml.🤖 Generated with Claude Code
https://claude.ai/code/session_0135xivQQnx5bWMzWD91J5TR
Generated by Claude Code