mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-05-28 13:05:47 +03:00
cryptsetup: add same-cpu-crypt and submit-from-crypt-cpus options
Closes #11946.
This commit is contained in:
parent
05044ebff9
commit
2c65512ee7
@ -224,6 +224,26 @@
|
||||
mode.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>same-cpu-crypt</option></term>
|
||||
|
||||
<listitem><para>Perform encryption using the same cpu that IO was submitted on. The default is to use
|
||||
an unbound workqueue so that encryption work is automatically balanced between available CPUs.</para>
|
||||
<para>This requires kernel 4.0 or newer.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>submit-from-crypt-cpus</option></term>
|
||||
|
||||
<listitem><para>Disable offloading writes to a separate thread after encryption. There are some
|
||||
situations where offloading write bios from the encryption threads to a single thread degrades
|
||||
performance significantly. The default is to offload write bios to the same thread because it benefits
|
||||
CFQ to have writes submitted using the same context.</para>
|
||||
<para>This requires kernel 4.0 or newer.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>skip=</option></term>
|
||||
|
||||
|
@ -44,6 +44,8 @@ static unsigned arg_tries = 3;
|
||||
static bool arg_readonly = false;
|
||||
static bool arg_verify = false;
|
||||
static bool arg_discards = false;
|
||||
static bool arg_same_cpu_crypt = false;
|
||||
static bool arg_submit_from_crypt_cpus = false;
|
||||
static bool arg_tcrypt_hidden = false;
|
||||
static bool arg_tcrypt_system = false;
|
||||
#ifdef CRYPT_TCRYPT_VERA_MODES
|
||||
@ -199,6 +201,10 @@ static int parse_one_option(const char *option) {
|
||||
arg_verify = true;
|
||||
else if (STR_IN_SET(option, "allow-discards", "discard"))
|
||||
arg_discards = true;
|
||||
else if (streq(option, "same-cpu-crypt"))
|
||||
arg_same_cpu_crypt = true;
|
||||
else if (streq(option, "submit-from-crypt-cpus"))
|
||||
arg_submit_from_crypt_cpus = true;
|
||||
else if (streq(option, "luks"))
|
||||
arg_type = ANY_LUKS;
|
||||
else if (streq(option, "tcrypt"))
|
||||
@ -676,6 +682,12 @@ static int run(int argc, char *argv[]) {
|
||||
if (arg_discards)
|
||||
flags |= CRYPT_ACTIVATE_ALLOW_DISCARDS;
|
||||
|
||||
if (arg_same_cpu_crypt)
|
||||
flags |= CRYPT_ACTIVATE_SAME_CPU_CRYPT;
|
||||
|
||||
if (arg_submit_from_crypt_cpus)
|
||||
flags |= CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS;
|
||||
|
||||
if (arg_timeout == USEC_INFINITY)
|
||||
until = 0;
|
||||
else
|
||||
|
@ -11,6 +11,14 @@
|
||||
#define CRYPT_LUKS NULL
|
||||
#endif
|
||||
|
||||
#ifndef CRYPT_ACTIVATE_SAME_CPU_CRYPT
|
||||
#define CRYPT_ACTIVATE_SAME_CPU_CRYPT (1 << 6)
|
||||
#endif
|
||||
|
||||
#ifndef CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS
|
||||
#define CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS (1 << 7)
|
||||
#endif
|
||||
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(struct crypt_device *, crypt_free);
|
||||
|
||||
void cryptsetup_log_glue(int level, const char *msg, void *usrptr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user