Loading drivers/md/dm-crypt.c +14 −4 Original line number Diff line number Diff line Loading @@ -125,7 +125,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 }; enum cipher_flags { CRYPT_MODE_INTEGRITY_AEAD, /* Use authenticated mode for cihper */ Loading Loading @@ -2663,6 +2664,8 @@ static int crypt_ctr_optional(struct dm_target *ti, unsigned int argc, char **ar cc->sector_shift = __ffs(cc->sector_size) - SECTOR_SHIFT; } else if (!strcasecmp(opt_string, "iv_large_sectors")) set_bit(CRYPT_IV_LARGE_SECTORS, &cc->cipher_flags); else if (!strcasecmp(opt_string, "allow_encrypt_override")) set_bit(DM_CRYPT_ENCRYPT_OVERRIDE, &cc->flags); else { ti->error = "Invalid feature arguments"; return -EINVAL; Loading Loading @@ -2868,12 +2871,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_set_dev(bio, cc->dev->bdev); if (bio_sectors(bio)) bio->bi_iter.bi_sector = cc->start + Loading Loading @@ -2960,6 +2966,8 @@ static void crypt_status(struct dm_target *ti, status_type_t type, num_feature_args += test_bit(DM_CRYPT_NO_OFFLOAD, &cc->flags); num_feature_args += cc->sector_size != (1 << SECTOR_SHIFT); num_feature_args += test_bit(CRYPT_IV_LARGE_SECTORS, &cc->cipher_flags); num_feature_args += test_bit(DM_CRYPT_ENCRYPT_OVERRIDE, &cc->flags); if (cc->on_disk_tag_size) num_feature_args++; if (num_feature_args) { Loading @@ -2976,6 +2984,8 @@ static void crypt_status(struct dm_target *ti, status_type_t type, DMEMIT(" sector_size:%d", cc->sector_size); if (test_bit(CRYPT_IV_LARGE_SECTORS, &cc->cipher_flags)) DMEMIT(" iv_large_sectors"); if (test_bit(DM_CRYPT_ENCRYPT_OVERRIDE, &cc->flags)) DMEMIT(" allow_encrypt_override"); } break; Loading include/linux/blk_types.h +6 −8 Original line number Diff line number Diff line Loading @@ -333,17 +333,17 @@ enum req_flag_bits { __REQ_SORTED = __REQ_RAHEAD, /* elevator knows about this request */ __REQ_URGENT, /* urgent request */ /* Android specific flags */ __REQ_NOENCRYPT, /* * ok to not encrypt (already encrypted at fs * level) */ /* command specific flags for REQ_OP_WRITE_ZEROES: */ __REQ_NOUNMAP, /* do not free blocks when zeroing */ /* for driver use */ __REQ_DRV, __REQ_SWAP, /* swapping request. */ /* Android specific flags */ __REQ_NOENCRYPT, /* * ok to not encrypt (already encrypted at fs * level) */ __REQ_NR_BITS, /* stops here */ }; Loading @@ -362,12 +362,10 @@ enum req_flag_bits { #define REQ_RAHEAD (1ULL << __REQ_RAHEAD) #define REQ_BACKGROUND (1ULL << __REQ_BACKGROUND) #define REQ_NOWAIT (1ULL << __REQ_NOWAIT) #define REQ_NOENCRYPT (1ULL << __REQ_NOENCRYPT) #define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP) #define REQ_DRV (1ULL << __REQ_DRV) #define REQ_SWAP (1ULL << __REQ_SWAP) #define REQ_NOENCRYPT (1ULL << __REQ_NOENCRYPT) #define REQ_FAILFAST_MASK \ (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) Loading Loading
drivers/md/dm-crypt.c +14 −4 Original line number Diff line number Diff line Loading @@ -125,7 +125,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 }; enum cipher_flags { CRYPT_MODE_INTEGRITY_AEAD, /* Use authenticated mode for cihper */ Loading Loading @@ -2663,6 +2664,8 @@ static int crypt_ctr_optional(struct dm_target *ti, unsigned int argc, char **ar cc->sector_shift = __ffs(cc->sector_size) - SECTOR_SHIFT; } else if (!strcasecmp(opt_string, "iv_large_sectors")) set_bit(CRYPT_IV_LARGE_SECTORS, &cc->cipher_flags); else if (!strcasecmp(opt_string, "allow_encrypt_override")) set_bit(DM_CRYPT_ENCRYPT_OVERRIDE, &cc->flags); else { ti->error = "Invalid feature arguments"; return -EINVAL; Loading Loading @@ -2868,12 +2871,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_set_dev(bio, cc->dev->bdev); if (bio_sectors(bio)) bio->bi_iter.bi_sector = cc->start + Loading Loading @@ -2960,6 +2966,8 @@ static void crypt_status(struct dm_target *ti, status_type_t type, num_feature_args += test_bit(DM_CRYPT_NO_OFFLOAD, &cc->flags); num_feature_args += cc->sector_size != (1 << SECTOR_SHIFT); num_feature_args += test_bit(CRYPT_IV_LARGE_SECTORS, &cc->cipher_flags); num_feature_args += test_bit(DM_CRYPT_ENCRYPT_OVERRIDE, &cc->flags); if (cc->on_disk_tag_size) num_feature_args++; if (num_feature_args) { Loading @@ -2976,6 +2984,8 @@ static void crypt_status(struct dm_target *ti, status_type_t type, DMEMIT(" sector_size:%d", cc->sector_size); if (test_bit(CRYPT_IV_LARGE_SECTORS, &cc->cipher_flags)) DMEMIT(" iv_large_sectors"); if (test_bit(DM_CRYPT_ENCRYPT_OVERRIDE, &cc->flags)) DMEMIT(" allow_encrypt_override"); } break; Loading
include/linux/blk_types.h +6 −8 Original line number Diff line number Diff line Loading @@ -333,17 +333,17 @@ enum req_flag_bits { __REQ_SORTED = __REQ_RAHEAD, /* elevator knows about this request */ __REQ_URGENT, /* urgent request */ /* Android specific flags */ __REQ_NOENCRYPT, /* * ok to not encrypt (already encrypted at fs * level) */ /* command specific flags for REQ_OP_WRITE_ZEROES: */ __REQ_NOUNMAP, /* do not free blocks when zeroing */ /* for driver use */ __REQ_DRV, __REQ_SWAP, /* swapping request. */ /* Android specific flags */ __REQ_NOENCRYPT, /* * ok to not encrypt (already encrypted at fs * level) */ __REQ_NR_BITS, /* stops here */ }; Loading @@ -362,12 +362,10 @@ enum req_flag_bits { #define REQ_RAHEAD (1ULL << __REQ_RAHEAD) #define REQ_BACKGROUND (1ULL << __REQ_BACKGROUND) #define REQ_NOWAIT (1ULL << __REQ_NOWAIT) #define REQ_NOENCRYPT (1ULL << __REQ_NOENCRYPT) #define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP) #define REQ_DRV (1ULL << __REQ_DRV) #define REQ_SWAP (1ULL << __REQ_SWAP) #define REQ_NOENCRYPT (1ULL << __REQ_NOENCRYPT) #define REQ_FAILFAST_MASK \ (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) Loading