From: Christoph Hellwig <hch@lst.de>
To: Anuj Gupta <anuj20.g@samsung.com>
Cc: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org,
martin.petersen@oracle.com, asml.silence@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,
Kanchan Joshi <joshi.k@samsung.com>
Subject: Re: [PATCH v3 08/10] block: add support to pass user meta buffer
Date: Sat, 24 Aug 2024 10:44:30 +0200 [thread overview]
Message-ID: <20240824084430.GG8805@lst.de> (raw)
In-Reply-To: <20240823103811.2421-10-anuj20.g@samsung.com>
On Fri, Aug 23, 2024 at 04:08:09PM +0530, Anuj Gupta wrote:
> From: Kanchan Joshi <joshi.k@samsung.com>
>
> If iocb contains the meta, extract that and prepare the bip.
If an iocb contains metadata, ...
> --- a/block/fops.c
> +++ b/block/fops.c
> @@ -154,6 +154,9 @@ static void blkdev_bio_end_io(struct bio *bio)
> }
> }
>
> + if (bio_integrity(bio) && (dio->iocb->ki_flags & IOCB_HAS_META))
> + bio_integrity_unmap_user(bio);
How could bio_integrity() be true here without the iocb flag?
> + if (!is_sync && unlikely(iocb->ki_flags & IOCB_HAS_META)) {
unlikely is actively harmful here, as the code is likely if you use
the feature..
> + ret = bio_integrity_map_iter(bio, iocb->private);
> + if (unlikely(ret)) {
> + bio_release_pages(bio, false);
> + bio_clear_flag(bio, BIO_REFFED);
> + bio_put(bio);
> + blk_finish_plug(&plug);
> + return ret;
> + }
This duplicates the error handling done just above. Please add a
goto label to de-duplicate it.
> + if (unlikely(iocb->ki_flags & IOCB_HAS_META)) {
> + ret = bio_integrity_map_iter(bio, iocb->private);
> + WRITE_ONCE(iocb->private, NULL);
> + if (unlikely(ret)) {
> + bio_put(bio);
> + return ret;
This probably also wants an out_bio_put label even if the duplication
is minimal so far.
You probably also want a WARN_ON for the iocb meta flag in
__blkdev_direct_IO_simple so that we don't get caught off guard
if someone adds a synchronous path using PI.
> diff --git a/block/t10-pi.c b/block/t10-pi.c
> index e7052a728966..cb7bc4a88380 100644
> --- a/block/t10-pi.c
> +++ b/block/t10-pi.c
> @@ -139,6 +139,8 @@ static void t10_pi_type1_prepare(struct request *rq)
> /* Already remapped? */
> if (bip->bip_flags & BIP_MAPPED_INTEGRITY)
> break;
> + if (bip->bip_flags & BIP_INTEGRITY_USER)
> + break;
This is wrong. When submitting metadata on a partition the ref tag
does need to be remapped. Please also add a tests that tests submitting
metadata on a partition so that we have a regression test for this.
> + BIP_INTEGRITY_USER = 1 << 9, /* Integrity payload is user
> + * address
> + */
.. and with the above fix this flag should not be needed.
> };
>
> struct bio_integrity_payload {
> @@ -24,6 +27,7 @@ struct bio_integrity_payload {
> unsigned short bip_vcnt; /* # of integrity bio_vecs */
> unsigned short bip_max_vcnt; /* integrity bio_vec slots */
> unsigned short bip_flags; /* control flags */
> + u16 app_tag;
Please document the field even if it seems obvious.
next prev parent reply other threads:[~2024-08-24 8:44 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240823104552epcas5p226dbbbd448cd0ee0955ffdd3ad1b112d@epcas5p2.samsung.com>
2024-08-23 10:38 ` [PATCH v3 00/10] Read/Write with meta/integrity Anuj Gupta
2024-08-23 10:38 ` [PATCH v3 01/10] block: define set of integrity flags to be inherited by cloned bip Anuj Gupta
2024-08-24 8:24 ` Christoph Hellwig
2024-08-29 3:05 ` Martin K. Petersen
2024-08-23 10:38 ` [PATCH v3 02/10] block: introduce a helper to determine metadata bytes from data iter Anuj Gupta
2024-08-24 8:24 ` Christoph Hellwig
2024-08-29 3:06 ` Martin K. Petersen
2024-08-23 10:38 ` [PATCH v3 03/10] block: handle split correctly for user meta bounce buffer Anuj Gupta
2024-08-24 8:31 ` Christoph Hellwig
2024-08-28 11:18 ` Anuj Gupta
2024-08-29 4:04 ` Christoph Hellwig
2024-08-23 10:38 ` [PATCH v3 04/10] block: modify bio_integrity_map_user to accept iov_iter as argument Anuj Gupta
2024-08-23 10:38 ` [PATCH v3 05/10] block: define meta io descriptor Anuj Gupta
2024-08-24 8:31 ` Christoph Hellwig
2024-08-29 3:05 ` Martin K. Petersen
2024-08-23 10:38 ` [PATCH v3 06/10] io_uring/rw: add support to send meta along with read/write Anuj Gupta
2024-08-24 8:33 ` Christoph Hellwig
2024-08-23 10:38 ` [PATCH v3 07/10] block: introduce BIP_CHECK_GUARD/REFTAG/APPTAG bip_flags Anuj Gupta
2024-08-24 8:35 ` Christoph Hellwig
2024-08-28 13:42 ` Kanchan Joshi
2024-08-29 3:16 ` Martin K. Petersen
2024-08-29 4:06 ` Christoph Hellwig
2024-08-29 13:29 ` Anuj gupta
2024-09-12 12:40 ` Anuj Gupta
2024-09-13 2:06 ` Martin K. Petersen
2024-08-29 4:06 ` Christoph Hellwig
2024-08-23 10:38 ` [PATCH v3 07/10] block,nvme: " Anuj Gupta
2024-08-23 10:38 ` [PATCH v3 08/10] block: add support to pass user meta buffer Anuj Gupta
2024-08-24 8:44 ` Christoph Hellwig [this message]
2024-08-23 10:38 ` [PATCH v3 09/10] nvme: add handling for app_tag Anuj Gupta
2024-08-24 8:49 ` Christoph Hellwig
2024-08-29 3:00 ` Martin K. Petersen
2024-08-29 10:18 ` Kanchan Joshi
2024-09-13 2:05 ` Martin K. Petersen
2024-08-23 10:38 ` [PATCH v3 10/10] scsi: add support for user-meta interface Anuj Gupta
2024-08-24 8:52 ` 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=20240824084430.GG8805@lst.de \
--to=hch@lst.de \
--cc=anuj20.g@samsung.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=gost.dev@samsung.com \
--cc=io-uring@vger.kernel.org \
--cc=joshi.k@samsung.com \
--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 \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).