Skip to content

Commit 63e6495

Browse files
Christoph Hellwigaxboe
authored andcommitted
dm-integrity: use the nop integrity profile
Use the block layer built-in nop profile instead of duplicating it. Tested by: $ dd if=/dev/urandom of=key.bin bs=512 count=1 $ cryptsetup luksFormat -q --type luks2 --integrity hmac-sha256 \ --integrity-no-wipe /dev/nvme0n1 key.bin $ cryptsetup luksOpen /dev/nvme0n1 luks-integrity --key-file key.bin and then doing mkfs.xfs and simple I/O on the mount file system. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Milan Broz <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 799af94 commit 63e6495

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

drivers/md/dm-crypt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,8 +1176,8 @@ static int crypt_integrity_ctr(struct crypt_config *cc, struct dm_target *ti)
11761176
struct blk_integrity *bi = blk_get_integrity(cc->dev->bdev->bd_disk);
11771177
struct mapped_device *md = dm_table_get_md(ti->table);
11781178

1179-
/* From now we require underlying device with our integrity profile */
1180-
if (!bi || strcasecmp(bi->profile->name, "DM-DIF-EXT-TAG")) {
1179+
/* We require an underlying device with non-PI metadata */
1180+
if (!bi || strcmp(bi->profile->name, "nop")) {
11811181
ti->error = "Integrity profile not supported.";
11821182
return -EINVAL;
11831183
}

drivers/md/dm-integrity.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -350,25 +350,6 @@ static struct kmem_cache *journal_io_cache;
350350
#define DEBUG_bytes(bytes, len, msg, ...) do { } while (0)
351351
#endif
352352

353-
static void dm_integrity_prepare(struct request *rq)
354-
{
355-
}
356-
357-
static void dm_integrity_complete(struct request *rq, unsigned int nr_bytes)
358-
{
359-
}
360-
361-
/*
362-
* DM Integrity profile, protection is performed layer above (dm-crypt)
363-
*/
364-
static const struct blk_integrity_profile dm_integrity_profile = {
365-
.name = "DM-DIF-EXT-TAG",
366-
.generate_fn = NULL,
367-
.verify_fn = NULL,
368-
.prepare_fn = dm_integrity_prepare,
369-
.complete_fn = dm_integrity_complete,
370-
};
371-
372353
static void dm_integrity_map_continue(struct dm_integrity_io *dio, bool from_map);
373354
static void integrity_bio_wait(struct work_struct *w);
374355
static void dm_integrity_dtr(struct dm_target *ti);
@@ -3656,7 +3637,6 @@ static void dm_integrity_set(struct dm_target *ti, struct dm_integrity_c *ic)
36563637
struct blk_integrity bi;
36573638

36583639
memset(&bi, 0, sizeof(bi));
3659-
bi.profile = &dm_integrity_profile;
36603640
bi.tuple_size = ic->tag_size;
36613641
bi.tag_size = bi.tuple_size;
36623642
bi.interval_exp = ic->sb->log2_sectors_per_block + SECTOR_SHIFT;

0 commit comments

Comments
 (0)