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

blockdev: Use --direct-io=on for losetup #375

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

cgwalters
Copy link
Collaborator

This is what other projects do; it avoids double buffering and is generally a good idea.

This is what other projects do; it avoids double buffering
and is generally a good idea.

Signed-off-by: Colin Walters <walters@verbum.org>
Copy link
Contributor

@jeckersb jeckersb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for being explicit here. One thing to note is that I'm pretty sure this is not strictly necessary per util-linux/util-linux@5b3bb7d -- the manpage was wrong and 'on' was always the default. The manpage on stream9 still has the older incorrect version.

@cgwalters
Copy link
Collaborator Author

the manpage was wrong and 'on' was always the default.

The manpage was saying --direct-io is the same thing as --direct-io=on AFAICS - not that it's on by default.

Testing this

# bootc status --json | jq -r .status.booted.image
{
  "image": {
    "image": "quay.io/centos-bootc/fedora-bootc:eln-1709537055",
    "transport": "registry"
  },
  "version": "39.20240304.0",
  "timestamp": null,
  "imageDigest": "sha256:610131941967d62b3819756b6246a415f9dfff521bd229b5c75299393f51babc"
}
# rpm -q util-linux
util-linux-2.40-0.11.rc1.eln136.x86_64
# truncate -s 10G /var/tmp/foo
losetup -f -P /var/tmp/foo 
# losetup 
NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE                                                                                                            DIO LOG-SEC
/dev/loop1         0      0         0  0 /var/tmp/foo                                                                                                           0     512
/dev/loop0         0      0         1  1 /sysroot/ostree/deploy/default/deploy/e1455b056e30507ac9f51cc1c195ea1b29c9203a62e2f1309b9b0b84cd33f355.0/.ostree.cfs   1    4096
#

Notice the composefs mount is using DIO but the loopback mount I did is not.

@cgwalters cgwalters merged commit 6cc9a02 into containers:main Mar 6, 2024
11 checks passed
@jeckersb
Copy link
Contributor

jeckersb commented Mar 6, 2024

Ah gotcha. My English parser is buggy 😆

@mvo5
Copy link
Contributor

mvo5 commented Mar 6, 2024

Yeah, the code in https://github.com/util-linux/util-linux/blob/master/sys-utils/losetup.c#L687 also indicates the default is "off". But this is super nice, we will try this for osbuild too.

cgwalters added a commit to cgwalters/util-linux that referenced this pull request Apr 29, 2024
See e.g. containers/bootc#375 (comment)

The phrasing here was in my opinion technically correct but quite confusing and easy to misunderstand.

Let's be very clear:

- The default is *off*
- You can turn it on in two ways
- You can also explicitly turn it off
cgwalters added a commit to cgwalters/util-linux that referenced this pull request Apr 29, 2024
See e.g. containers/bootc#375 (comment)

The phrasing here was in my opinion technically correct but quite confusing and easy to misunderstand.

Let's be very clear:

- The default is *off*
- You can turn it on in two ways
- You can also explicitly turn it off

Signed-off-by: Colin Walters <walters@verbum.org>
cgwalters added a commit to cgwalters/util-linux that referenced this pull request Apr 29, 2024
See e.g. containers/bootc#375 (comment)

The phrasing here was in my opinion technically correct but quite confusing and easy to misunderstand.

Let's be very clear:

- The default is *off*
- You can turn it on in two ways
- You can also explicitly turn it off

Signed-off-by: Colin Walters <walters@verbum.org>
karelzak pushed a commit to util-linux/util-linux that referenced this pull request May 1, 2024
See e.g. containers/bootc#375 (comment)

The phrasing here was in my opinion technically correct but quite confusing and easy to misunderstand.

Let's be very clear:

- The default is *off*
- You can turn it on in two ways
- You can also explicitly turn it off

Signed-off-by: Colin Walters <walters@verbum.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants