From: Anuj Gupta <anuj20.g@samsung.com>
To: Christoph Hellwig <hch@lst.de>
Cc: axboe@kernel.dk, kbusch@kernel.org, martin.petersen@oracle.com,
asml.silence@gmail.com, anuj1072538@gmail.com, krisman@suse.de,
io-uring@vger.kernel.org, linux-nvme@lists.infradead.org,
linux-block@vger.kernel.org, gost.dev@samsung.com,
linux-scsi@vger.kernel.org, vishak.g@samsung.com
Subject: Re: [PATCH v4 11/11] scsi: add support for user-meta interface
Date: Fri, 18 Oct 2024 13:56:48 +0530 [thread overview]
Message-ID: <20241018082648.GA32006@green245> (raw)
In-Reply-To: <20241017143918.GC21905@lst.de>
[-- Attachment #1: Type: text/plain, Size: 3041 bytes --]
On Thu, Oct 17, 2024 at 04:39:18PM +0200, Christoph Hellwig wrote:
> On Thu, Oct 17, 2024 at 05:09:23PM +0530, Anuj Gupta wrote:
> > This snippet prevents a scenario where a apptag check is specified without
> > a reftag check and vice-versa, which is not possible for scsi[1].
> > But for
> > block layer generated integrity apptag check (BIP_CHECK_APPTAG) is not
> > specified. When scsi drive is formatted with type1/2 PI, block layer would
> > specify refcheck but not appcheck. Hence, these I/O's would fail. Do you
> > see how we can handle this?
>
> Well, this is also related to difference in capability checking.
Right.
> Just curious, do you have any user of the more fine grained checking
> in NVMe? If not we could support the SCSI semantics only and emulate
> them using the fine grained NVMe semantics and have no portability
> problems.
We can choose to support scsi semantics only and expose only the valid
scsi combinations to userspace i.e.
1. no check
2. guard check only
3. ref + app check only
4. guard + ref + app check
Something like this [*] on top of this series, untested though. Does
this align with what you have in mind?
[*]
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 24fad9b6f3ec..2ca27910770b 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -308,12 +308,10 @@ static void bio_uio_meta_to_bip(struct bio *bio, struct uio_meta *meta)
{
struct bio_integrity_payload *bip = bio_integrity(bio);
- if (meta->flags & BLK_INTEGRITY_CHK_GUARD)
+ if (meta->flags & IO_INTEGRITY_CHK_GUARD)
bip->bip_flags |= BIP_CHECK_GUARD;
- if (meta->flags & BLK_INTEGRITY_CHK_APPTAG)
- bip->bip_flags |= BIP_CHECK_APPTAG;
- if (meta->flags & BLK_INTEGRITY_CHK_REFTAG)
- bip->bip_flags |= BIP_CHECK_REFTAG;
+ if (meta->flags & IO_INTEGRITY_CHK_REF_APP)
+ bip->bip_flags |= BIP_CHECK_REFTAG | BIP_CHECK_APPTAG;
bip->app_tag = meta->app_tag;
}
@@ -329,9 +327,9 @@ int bio_integrity_map_iter(struct bio *bio, struct uio_meta *meta)
return -EINVAL;
/* should fit into two bytes */
- BUILD_BUG_ON(BLK_INTEGRITY_VALID_FLAGS >= (1 << 16));
+ BUILD_BUG_ON(IO_INTEGRITY_VALID_FLAGS >= (1 << 16));
- if (meta->flags && (meta->flags & ~BLK_INTEGRITY_VALID_FLAGS))
+ if (meta->flags && (meta->flags & ~IO_INTEGRITY_VALID_FLAGS))
return -EINVAL;
/*
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index 753971770733..714700f9826e 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -40,6 +40,15 @@
#define BLOCK_SIZE_BITS 10
#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
+/*
+ * flags for integrity meta
+ */
+#define IO_INTEGRITY_CHK_GUARD (1U << 0) /* enforce guard check */
+#define IO_INTEGRITY_CHK_REF_APP (1U << 1) /* enforce ref and app check */
+
+#define IO_INTEGRITY_VALID_FLAGS (IO_INTEGRITY_CHK_GUARD | \
+ IO_INTEGRITY_CHK_REF_APP)
+
#define SEEK_SET 0 /* seek relative to beginning of file */
#define SEEK_CUR 1 /* seek relative to current file position */
#define SEEK_END 2 /* seek relative to end of file */
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2024-10-18 8:50 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20241016113705epcas5p1edc284b347de99bc34802b0b0c5e1b27@epcas5p1.samsung.com>
2024-10-16 11:29 ` [PATCH v4 00/11] Read/Write with meta/integrity Anuj Gupta
2024-10-16 11:29 ` [PATCH v4 01/11] block: define set of integrity flags to be inherited by cloned bip Anuj Gupta
2024-10-16 18:03 ` Keith Busch
2024-10-16 11:29 ` [PATCH v4 02/11] block: copy back bounce buffer to user-space correctly in case of split Anuj Gupta
2024-10-16 18:04 ` Keith Busch
2024-10-17 7:53 ` Christoph Hellwig
2024-10-16 11:29 ` [PATCH v4 03/11] block: modify bio_integrity_map_user to accept iov_iter as argument Anuj Gupta
2024-10-16 11:29 ` [PATCH v4 04/11] block: define meta io descriptor Anuj Gupta
2024-10-16 19:35 ` Keith Busch
2024-10-17 5:49 ` Anuj Gupta
2024-10-17 7:57 ` Christoph Hellwig
2024-10-22 2:11 ` Martin K. Petersen
2024-10-22 6:04 ` Christoph Hellwig
2024-10-23 1:20 ` Martin K. Petersen
2024-10-28 3:46 ` Anuj Gupta
2024-10-16 11:29 ` [PATCH v4 05/11] fs: introduce IOCB_HAS_METADATA for metadata Anuj Gupta
2024-10-17 7:58 ` Christoph Hellwig
2024-10-16 11:29 ` [PATCH v4 06/11] block: add flags for integrity meta Anuj Gupta
2024-10-17 8:00 ` Christoph Hellwig
2024-10-17 10:45 ` Anuj Gupta
2024-10-17 12:01 ` Christoph Hellwig
2024-10-17 12:59 ` Anuj gupta
2024-10-17 14:34 ` Christoph Hellwig
2024-10-16 11:29 ` [PATCH v4 07/11] io_uring/rw: add support to send meta along with read/write Anuj Gupta
2024-10-17 8:10 ` Christoph Hellwig
2024-10-17 22:51 ` Jens Axboe
2024-10-21 5:31 ` Anuj Gupta
2024-10-22 6:02 ` Christoph Hellwig
2024-10-22 1:50 ` Martin K. Petersen
2024-10-16 11:29 ` [PATCH v4 08/11] block: introduce BIP_CHECK_GUARD/REFTAG/APPTAG bip_flags Anuj Gupta
2024-10-17 8:12 ` Christoph Hellwig
2024-10-17 10:46 ` Anuj Gupta
2024-10-17 14:37 ` Christoph Hellwig
2024-10-16 11:29 ` [PATCH v4 09/11] block: add support to pass user meta buffer Anuj Gupta
2024-10-17 8:15 ` Christoph Hellwig
2024-10-17 8:24 ` Christoph Hellwig
2024-10-16 11:29 ` [PATCH v4 10/11] nvme: add support for passing on the application tag Anuj Gupta
2024-10-17 8:14 ` Christoph Hellwig
2024-10-16 11:29 ` [PATCH v4 11/11] scsi: add support for user-meta interface Anuj Gupta
2024-10-17 8:15 ` Christoph Hellwig
2024-10-17 11:39 ` Anuj Gupta
2024-10-17 14:39 ` Christoph Hellwig
2024-10-18 8:26 ` Anuj Gupta [this message]
2024-10-18 9:02 ` Christoph Hellwig
2024-10-22 1:58 ` Martin K. Petersen
2024-10-28 7:36 ` Anuj Gupta
2024-10-29 2:24 ` Martin K. Petersen
2024-10-22 2:04 ` [PATCH v4 00/11] Read/Write with meta/integrity Martin K. Petersen
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=20241018082648.GA32006@green245 \
--to=anuj20.g@samsung.com \
--cc=anuj1072538@gmail.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=gost.dev@samsung.com \
--cc=hch@lst.de \
--cc=io-uring@vger.kernel.org \
--cc=kbusch@kernel.org \
--cc=krisman@suse.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=vishak.g@samsung.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.