All of lore.kernel.org
 help / color / mirror / Atom feed
From: Milan Broz <gmazyland@gmail.com>
To: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Mike Snitzer <snitzer@kernel.org>,
	Mikulas Patocka <mpatocka@redhat.com>, Song Liu <song@kernel.org>,
	Yu Kuai <yukuai3@huawei.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Dave Jiang <dave.jiang@intel.com>,
	Ira Weiny <ira.weiny@intel.com>, Keith Busch <kbusch@kernel.org>,
	Sagi Grimberg <sagi@grimberg.me>,
	Chaitanya Kulkarni <kch@nvidia.com>,
	linux-block@vger.kernel.org, dm-devel@lists.linux.dev,
	linux-raid@vger.kernel.org, nvdimm@lists.linux.dev,
	linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH 01/12] dm-integrity: use the nop integrity profile
Date: Wed, 5 Jun 2024 16:52:27 +0200	[thread overview]
Message-ID: <a5570194-920c-45d8-98d5-da99db0d2f8d@gmail.com> (raw)
In-Reply-To: <20240605063031.3286655-2-hch@lst.de>

On 6/5/24 8:28 AM, Christoph Hellwig wrote:
> Use the block layer built-in nop profile instead of reinventing it.

As this is my "invention", I am pretty sure that "nop" profile was
not available at the time I was prototyping AEAD dmcrypt extension.
(It was months before we submitted it upstream - and then nobody
apparently fixed it.)

So, I am quite happy this hack can go away!

I run full cryptsetup testuite with this patch and everything
works, nice cleanup.

Reviewed-by: Milan Broz <gmazyland@gmail.com>

Thanks,
Milan

> 
> 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 <hch@lst.de>
> ---
>   drivers/md/dm-crypt.c     |  4 ++--
>   drivers/md/dm-integrity.c | 20 --------------------
>   2 files changed, 2 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
> index 1b7a97cc377943..1dfc462f29cd6f 100644
> --- a/drivers/md/dm-crypt.c
> +++ b/drivers/md/dm-crypt.c
> @@ -1176,8 +1176,8 @@ static int crypt_integrity_ctr(struct crypt_config *cc, struct dm_target *ti)
>   	struct blk_integrity *bi = blk_get_integrity(cc->dev->bdev->bd_disk);
>   	struct mapped_device *md = dm_table_get_md(ti->table);
>   
> -	/* From now we require underlying device with our integrity profile */
> -	if (!bi || strcasecmp(bi->profile->name, "DM-DIF-EXT-TAG")) {
> +	/* We require an underlying device with non-PI metadata */
> +	if (!bi || strcmp(bi->profile->name, "nop")) {
>   		ti->error = "Integrity profile not supported.";
>   		return -EINVAL;
>   	}
> diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
> index 417fddebe367a2..c1cc27541673c7 100644
> --- a/drivers/md/dm-integrity.c
> +++ b/drivers/md/dm-integrity.c
> @@ -350,25 +350,6 @@ static struct kmem_cache *journal_io_cache;
>   #define DEBUG_bytes(bytes, len, msg, ...)	do { } while (0)
>   #endif
>   
> -static void dm_integrity_prepare(struct request *rq)
> -{
> -}
> -
> -static void dm_integrity_complete(struct request *rq, unsigned int nr_bytes)
> -{
> -}
> -
> -/*
> - * DM Integrity profile, protection is performed layer above (dm-crypt)
> - */
> -static const struct blk_integrity_profile dm_integrity_profile = {
> -	.name			= "DM-DIF-EXT-TAG",
> -	.generate_fn		= NULL,
> -	.verify_fn		= NULL,
> -	.prepare_fn		= dm_integrity_prepare,
> -	.complete_fn		= dm_integrity_complete,
> -};
> -
>   static void dm_integrity_map_continue(struct dm_integrity_io *dio, bool from_map);
>   static void integrity_bio_wait(struct work_struct *w);
>   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)
>   	struct blk_integrity bi;
>   
>   	memset(&bi, 0, sizeof(bi));
> -	bi.profile = &dm_integrity_profile;
>   	bi.tuple_size = ic->tag_size;
>   	bi.tag_size = bi.tuple_size;
>   	bi.interval_exp = ic->sb->log2_sectors_per_block + SECTOR_SHIFT;


  reply	other threads:[~2024-06-05 14:52 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05  6:28 move integrity settings to queue_limits Christoph Hellwig
2024-06-05  6:28 ` [PATCH 01/12] dm-integrity: use the nop integrity profile Christoph Hellwig
2024-06-05 14:52   ` Milan Broz [this message]
2024-06-06  4:45     ` Christoph Hellwig
2024-06-06  0:12   ` Chaitanya Kulkarni
2024-06-05  6:28 ` [PATCH 02/12] block: remove the unused BIP_{CTRL,DISK}_NOCHECK flags Christoph Hellwig
2024-06-05 16:16   ` Bart Van Assche
2024-06-05 23:31   ` Kanchan Joshi
2024-06-06  0:13   ` Chaitanya Kulkarni
2024-06-05  6:28 ` [PATCH 03/12] block: remove the BIP_IP_CHECKSUM flag Christoph Hellwig
2024-06-05 16:21   ` Bart Van Assche
2024-06-05 23:31   ` Kanchan Joshi
2024-06-06  0:14   ` Chaitanya Kulkarni
2024-06-05  6:28 ` [PATCH 04/12] block: remove the blk_integrity_profile structure Christoph Hellwig
2024-06-05 14:35   ` Kanchan Joshi
2024-06-06  4:49     ` Christoph Hellwig
2024-06-05 16:31   ` Bart Van Assche
2024-06-06  4:50     ` Christoph Hellwig
2024-06-06 15:38       ` Bart Van Assche
2024-06-05  6:28 ` [PATCH 05/12] block: remove the blk_flush_integrity call in blk_integrity_unregister Christoph Hellwig
2024-06-05  6:28 ` [PATCH 06/12] block: factor out flag_{store,show} helper for integrity Christoph Hellwig
2024-06-05 16:00   ` Keith Busch
2024-06-06  0:16   ` Chaitanya Kulkarni
2024-06-05  6:28 ` [PATCH 07/12] block: use kstrtoul in flag_store Christoph Hellwig
2024-06-05 16:00   ` Keith Busch
2024-06-06  0:16   ` Chaitanya Kulkarni
2024-06-05  6:28 ` [PATCH 08/12] block: don't pretend to generate/verify for non-PI metadata Christoph Hellwig
2024-06-05  6:28 ` [PATCH 09/12] block: don't require stable pages " Christoph Hellwig
2024-06-05  6:28 ` [PATCH 10/12] block: bypass the STABLE_WRITES flag for protection information Christoph Hellwig
2024-06-05  6:28 ` [PATCH 11/12] block: invert the BLK_INTEGRITY_{GENERATE,VERIFY} flags Christoph Hellwig
2024-06-06  0:20   ` Chaitanya Kulkarni
2024-06-05  6:28 ` [PATCH 12/12] block: move integrity information into queue_limits Christoph Hellwig
2024-06-05 16:56   ` Bart Van Assche
2024-06-06  4:51     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5570194-920c-45d8-98d5-da99db0d2f8d@gmail.com \
    --to=gmazyland@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=hch@lst.de \
    --cc=ira.weiny@intel.com \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mpatocka@redhat.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=sagi@grimberg.me \
    --cc=snitzer@kernel.org \
    --cc=song@kernel.org \
    --cc=vishal.l.verma@intel.com \
    --cc=yukuai3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.