Skip to content

Commit

Permalink
Use direct I/O for loop devices
Browse files Browse the repository at this point in the history
This is a huge performance improvement for two reasons:

1. It uses the filesystem’s asynchronous I/O support, rather than using
   synchronous I/O.
2. It bypasses the page cache, removing a redundant layer of caching and
   associated overhead.

Fixes QubesOS/qubes-issues#7332.
  • Loading branch information
DemiMarie committed Apr 14, 2022
1 parent 3e3bc89 commit cced625
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
11 changes: 11 additions & 0 deletions patch-Linux-loop-use-direct-io.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- xen-4.14.4/tools/hotplug/Linux/block 2022-01-31 04:44:39.000000000 -0500
+++ xen-4.14.4/tools/hotplug/Linux/block 2022-03-11 16:18:36.667000000 -0500
@@ -330,7 +330,7 @@
else
roflag=''
fi
- do_or_die losetup $roflag "$loopdev" "$file"
+ do_or_die losetup --direct-io=on $roflag "$loopdev" "$file"
xenstore_write "$XENBUS_PATH/node" "$loopdev"
write_dev "$loopdev"
release_lock "block"
2 changes: 1 addition & 1 deletion patch-xen-hotplug-external-store.patch
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Signed-off-by: Marek Marczykowski <[email protected]>
FRONTEND_UUID=$(xenstore_read_default \
@@ -305,6 +312,7 @@
fi
do_or_die losetup $roflag "$loopdev" "$file"
do_or_die losetup --direct-io=on $roflag "$loopdev" "$file"
xenstore_write "$XENBUS_PATH/node" "$loopdev"
+ echo $loopdev > "$HOTPLUG_STORE-node"
write_dev "$loopdev"
Expand Down
1 change: 1 addition & 0 deletions series-debian-vm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ patch-Define-build-dates-time-based-on-SOURCE_DATE_EPOCH.patch
patch-docs-rename-DATE-to-PANDOC_REL_DATE-and-allow-to-spe.patch
patch-docs-xen-headers-use-alphabetical-sorting-for-incont.patch
patch-Strip-build-path-directories-in-tools-xen-and-xen-ar.patch
patch-Linux-loop-use-direct-io.patch
1 change: 1 addition & 0 deletions series-vm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ patch-Define-build-dates-time-based-on-SOURCE_DATE_EPOCH.patch
patch-docs-rename-DATE-to-PANDOC_REL_DATE-and-allow-to-spe.patch
patch-docs-xen-headers-use-alphabetical-sorting-for-incont.patch
patch-Strip-build-path-directories-in-tools-xen-and-xen-ar.patch
patch-Linux-loop-use-direct-io.patch
1 change: 1 addition & 0 deletions xen.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ Patch636: patch-autoconf-fix-handling-absolute-PYTHON-path.patch
Patch638: patch-libxl-do-not-require-filling-backend_domid-to-remove.patch
Patch639: patch-libxl-add-pcidevs-to-stubdomain-earlier.patch
Patch640: patch-xen-efi-align.patch
Patch641: patch-Linux-loop-use-direct-io.patch

# GCC8 fixes
Patch714: patch-tools-kdd-mute-spurious-gcc-warning.patch
Expand Down

0 comments on commit cced625

Please sign in to comment.