summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-03-11 12:53:19 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2022-03-11 12:53:19 +0100
commita15e8ba52bcc079f1144cd9e532064d079a5e722 (patch)
treec4f4cc5d1b2ee23179e20146e925ec25794bb833 /modules
parent3e448963037d213acc6cf7228b3766261458d4ba (diff)
downloadnixos-a15e8ba52bcc079f1144cd9e532064d079a5e722.tar
nixos-a15e8ba52bcc079f1144cd9e532064d079a5e722.tar.gz
nixos-a15e8ba52bcc079f1144cd9e532064d079a5e722.tar.bz2
nixos-a15e8ba52bcc079f1144cd9e532064d079a5e722.tar.xz
nixos-a15e8ba52bcc079f1144cd9e532064d079a5e722.zip
luksroot: bypassWorkqueues
Diffstat (limited to 'modules')
-rw-r--r--modules/luksroot.nix18
1 files changed, 16 insertions, 2 deletions
diff --git a/modules/luksroot.nix b/modules/luksroot.nix
index abaee692..52de2c40 100644
--- a/modules/luksroot.nix
+++ b/modules/luksroot.nix
@@ -140,9 +140,12 @@ let
140 umount /crypt-ramfs 2>/dev/null 140 umount /crypt-ramfs 2>/dev/null
141 ''; 141 '';
142 142
143 openCommand = name': { name, device, header, keyFile, keyFileSize, keyFileOffset, allowDiscards, yubikey, gpgCard, fido2, clevis, dmi, fallbackToPassword, preOpenCommands, postOpenCommands, ... }: assert name' == name; 143 openCommand = name': { name, device, header, keyFile, keyFileSize, keyFileOffset, allowDiscards, bypassWorkqueues, yubikey, gpgCard, fido2, clevis, dmi, fallbackToPassword, preOpenCommands, postOpenCommands, ... }: assert name' == name;
144 let 144 let
145 csopen = "cryptsetup luksOpen ${device} ${name} ${optionalString allowDiscards "--allow-discards"} ${optionalString (header != null) "--header=${header}"}"; 145 csopen = "cryptsetup luksOpen ${device} ${name}"
146 + optionalString allowDiscards " --allow-discards"
147 + optionalString bypassWorkqueues " --perf-no_read_workqueue --perf-no_write_workqueue"
148 + optionalString (header != null) " --header=${header}";
146 cschange = "cryptsetup luksChangeKey ${device} ${optionalString (header != null) "--header=${header}"}"; 149 cschange = "cryptsetup luksChangeKey ${device} ${optionalString (header != null) "--header=${header}"}";
147 in '' 150 in ''
148 # Wait for luksRoot (and optionally keyFile and/or header) to appear, e.g. 151 # Wait for luksRoot (and optionally keyFile and/or header) to appear, e.g.
@@ -658,6 +661,17 @@ in
658 ''; 661 '';
659 }; 662 };
660 663
664 bypassWorkqueues = mkOption {
665 default = false;
666 type = types.bool;
667 description = ''
668 Whether to bypass dm-crypt's internal read and write workqueues.
669 Enabling this should improve performance on SSDs; see
670 <link xlink:href="https://wiki.archlinux.org/index.php/Dm-crypt/Specialties#Disable_workqueue_for_increased_solid_state_drive_(SSD)_performance">here</link>
671 for more information. Needs Linux 5.9 or later.
672 '';
673 };
674
661 fallbackToPassword = mkOption { 675 fallbackToPassword = mkOption {
662 default = false; 676 default = false;
663 type = types.bool; 677 type = types.bool;