Loading drivers/md/dm-crypt.c +14 −4 Original line number Diff line number Diff line Loading @@ -113,7 +113,8 @@ struct iv_tcw_private { * and encrypts / decrypts at the same time. */ enum flags { DM_CRYPT_SUSPENDED, DM_CRYPT_KEY_VALID, DM_CRYPT_SAME_CPU, DM_CRYPT_NO_OFFLOAD }; DM_CRYPT_SAME_CPU, DM_CRYPT_NO_OFFLOAD, DM_CRYPT_ENCRYPT_OVERRIDE }; /* * The fields in here must be read only after initialization. Loading Loading @@ -1858,6 +1859,9 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) else if (!strcasecmp(opt_string, "submit_from_crypt_cpus")) set_bit(DM_CRYPT_NO_OFFLOAD, &cc->flags); else if (!strcasecmp(opt_string, "allow_encrypt_override")) set_bit(DM_CRYPT_ENCRYPT_OVERRIDE, &cc->flags); else { ti->error = "Invalid feature arguments"; goto bad; Loading Loading @@ -1918,12 +1922,15 @@ static int crypt_map(struct dm_target *ti, struct bio *bio) struct crypt_config *cc = ti->private; /* * If bio is REQ_PREFLUSH or REQ_OP_DISCARD, just bypass crypt queues. * If bio is REQ_PREFLUSH, REQ_NOENCRYPT, or REQ_OP_DISCARD, * just bypass crypt queues. * - for REQ_PREFLUSH device-mapper core ensures that no IO is in-flight * - for REQ_OP_DISCARD caller must use flush if IO ordering matters */ if (unlikely(bio->bi_opf & REQ_PREFLUSH || bio_op(bio) == REQ_OP_DISCARD)) { if (unlikely(bio->bi_opf & REQ_PREFLUSH) || (unlikely(bio->bi_opf & REQ_NOENCRYPT) && test_bit(DM_CRYPT_ENCRYPT_OVERRIDE, &cc->flags)) || bio_op(bio) == REQ_OP_DISCARD) { bio->bi_bdev = cc->dev->bdev; if (bio_sectors(bio)) bio->bi_iter.bi_sector = cc->start + Loading Loading @@ -1978,6 +1985,7 @@ static void crypt_status(struct dm_target *ti, status_type_t type, num_feature_args += !!ti->num_discard_bios; num_feature_args += test_bit(DM_CRYPT_SAME_CPU, &cc->flags); num_feature_args += test_bit(DM_CRYPT_NO_OFFLOAD, &cc->flags); num_feature_args += test_bit(DM_CRYPT_ENCRYPT_OVERRIDE, &cc->flags); if (num_feature_args) { DMEMIT(" %d", num_feature_args); if (ti->num_discard_bios) Loading @@ -1986,6 +1994,8 @@ static void crypt_status(struct dm_target *ti, status_type_t type, DMEMIT(" same_cpu_crypt"); if (test_bit(DM_CRYPT_NO_OFFLOAD, &cc->flags)) DMEMIT(" submit_from_crypt_cpus"); if (test_bit(DM_CRYPT_ENCRYPT_OVERRIDE, &cc->flags)) DMEMIT(" allow_encrypt_override"); } break; Loading Loading
drivers/md/dm-crypt.c +14 −4 Original line number Diff line number Diff line Loading @@ -113,7 +113,8 @@ struct iv_tcw_private { * and encrypts / decrypts at the same time. */ enum flags { DM_CRYPT_SUSPENDED, DM_CRYPT_KEY_VALID, DM_CRYPT_SAME_CPU, DM_CRYPT_NO_OFFLOAD }; DM_CRYPT_SAME_CPU, DM_CRYPT_NO_OFFLOAD, DM_CRYPT_ENCRYPT_OVERRIDE }; /* * The fields in here must be read only after initialization. Loading Loading @@ -1858,6 +1859,9 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) else if (!strcasecmp(opt_string, "submit_from_crypt_cpus")) set_bit(DM_CRYPT_NO_OFFLOAD, &cc->flags); else if (!strcasecmp(opt_string, "allow_encrypt_override")) set_bit(DM_CRYPT_ENCRYPT_OVERRIDE, &cc->flags); else { ti->error = "Invalid feature arguments"; goto bad; Loading Loading @@ -1918,12 +1922,15 @@ static int crypt_map(struct dm_target *ti, struct bio *bio) struct crypt_config *cc = ti->private; /* * If bio is REQ_PREFLUSH or REQ_OP_DISCARD, just bypass crypt queues. * If bio is REQ_PREFLUSH, REQ_NOENCRYPT, or REQ_OP_DISCARD, * just bypass crypt queues. * - for REQ_PREFLUSH device-mapper core ensures that no IO is in-flight * - for REQ_OP_DISCARD caller must use flush if IO ordering matters */ if (unlikely(bio->bi_opf & REQ_PREFLUSH || bio_op(bio) == REQ_OP_DISCARD)) { if (unlikely(bio->bi_opf & REQ_PREFLUSH) || (unlikely(bio->bi_opf & REQ_NOENCRYPT) && test_bit(DM_CRYPT_ENCRYPT_OVERRIDE, &cc->flags)) || bio_op(bio) == REQ_OP_DISCARD) { bio->bi_bdev = cc->dev->bdev; if (bio_sectors(bio)) bio->bi_iter.bi_sector = cc->start + Loading Loading @@ -1978,6 +1985,7 @@ static void crypt_status(struct dm_target *ti, status_type_t type, num_feature_args += !!ti->num_discard_bios; num_feature_args += test_bit(DM_CRYPT_SAME_CPU, &cc->flags); num_feature_args += test_bit(DM_CRYPT_NO_OFFLOAD, &cc->flags); num_feature_args += test_bit(DM_CRYPT_ENCRYPT_OVERRIDE, &cc->flags); if (num_feature_args) { DMEMIT(" %d", num_feature_args); if (ti->num_discard_bios) Loading @@ -1986,6 +1994,8 @@ static void crypt_status(struct dm_target *ti, status_type_t type, DMEMIT(" same_cpu_crypt"); if (test_bit(DM_CRYPT_NO_OFFLOAD, &cc->flags)) DMEMIT(" submit_from_crypt_cpus"); if (test_bit(DM_CRYPT_ENCRYPT_OVERRIDE, &cc->flags)) DMEMIT(" allow_encrypt_override"); } break; Loading