linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@meta.com>
To: <linux-block@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <snitzer@kernel.org>, <axboe@kernel.dk>, <dw@davidwei.uk>,
	<brauner@kernel.org>, <hch@lst.de>, <martin.petersen@oracle.com>,
	<djwong@kernel.org>, <linux-xfs@vger.kernel.org>,
	<viro@zeniv.linux.org.uk>, Keith Busch <kbusch@kernel.org>,
	Hannes Reinecke <hare@suse.de>
Subject: [PATCHv3 7/8] blk-integrity: use simpler alignment check
Date: Tue, 19 Aug 2025 09:49:21 -0700	[thread overview]
Message-ID: <20250819164922.640964-8-kbusch@meta.com> (raw)
In-Reply-To: <20250819164922.640964-1-kbusch@meta.com>

From: Keith Busch <kbusch@kernel.org>

We're checking length and addresses against the same alignment value, so
use the more simple iterator check.

Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 block/bio-integrity.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 6b077ca937f6b..6d069a49b4aad 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -262,7 +262,6 @@ static unsigned int bvec_from_pages(struct bio_vec *bvec, struct page **pages,
 int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter)
 {
 	struct request_queue *q = bdev_get_queue(bio->bi_bdev);
-	unsigned int align = blk_lim_dma_alignment_and_pad(&q->limits);
 	struct page *stack_pages[UIO_FASTIOV], **pages = stack_pages;
 	struct bio_vec stack_vec[UIO_FASTIOV], *bvec = stack_vec;
 	size_t offset, bytes = iter->count;
@@ -285,7 +284,8 @@ int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter)
 		pages = NULL;
 	}
 
-	copy = !iov_iter_is_aligned(iter, align, align);
+	copy = iov_iter_alignment(iter) &
+			blk_lim_dma_alignment_and_pad(&q->limits);
 	ret = iov_iter_extract_pages(iter, &pages, bytes, nr_vecs, 0, &offset);
 	if (unlikely(ret < 0))
 		goto free_bvec;
-- 
2.47.3


  parent reply	other threads:[~2025-08-19 17:10 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-19 16:49 [PATCHv3 0/8] direct-io: even more flexible io vectors Keith Busch
2025-08-19 16:49 ` [PATCHv3 1/8] block: check for valid bio while splitting Keith Busch
2025-08-20  7:02   ` Damien Le Moal
2025-08-20 14:25     ` Keith Busch
2025-08-20  7:04   ` Damien Le Moal
2025-08-25  7:35   ` Christoph Hellwig
2025-08-19 16:49 ` [PATCHv3 2/8] block: add size alignment to bio_iov_iter_get_pages Keith Busch
2025-08-25  7:36   ` Christoph Hellwig
2025-08-19 16:49 ` [PATCHv3 3/8] block: align the bio after building it Keith Busch
2025-08-20  7:07   ` Damien Le Moal
2025-08-25  7:46   ` Christoph Hellwig
2025-08-25 13:57     ` Keith Busch
2025-08-25  7:47   ` Christoph Hellwig
2025-08-26  0:37     ` Keith Busch
2025-08-26  8:02       ` Christoph Hellwig
2025-08-26 23:11         ` Keith Busch
2025-08-19 16:49 ` [PATCHv3 4/8] block: simplify direct io validity check Keith Busch
2025-08-25  7:48   ` Christoph Hellwig
2025-08-19 16:49 ` [PATCHv3 5/8] iomap: " Keith Busch
2025-08-25  7:48   ` Christoph Hellwig
2025-08-19 16:49 ` [PATCHv3 6/8] block: remove bdev_iter_is_aligned Keith Busch
2025-08-25  7:48   ` Christoph Hellwig
2025-08-19 16:49 ` Keith Busch [this message]
2025-08-25  7:49   ` [PATCHv3 7/8] blk-integrity: use simpler alignment check Christoph Hellwig
2025-08-19 16:49 ` [PATCHv3 8/8] iov_iter: remove iov_iter_is_aligned Keith Busch
2025-08-25  7:50   ` Christoph Hellwig
2025-08-19 23:36 ` [PATCHv3 0/8] direct-io: even more flexible io vectors Mike Snitzer
2025-08-20  1:52 ` Song Chen
2025-08-22 13:27 ` Ritesh Harjani
2025-08-22 14:30   ` Keith Busch
2025-08-25 12:07   ` Jan Kara
2025-08-25 14:53     ` Keith Busch
2025-08-26  4:59       ` Ritesh Harjani
2025-08-27 15:20         ` Jan Kara
2025-08-27 16:09           ` Mike Snitzer
2025-09-01  7:55             ` Jan Kara
2025-09-02 14:39               ` Mike Snitzer
2025-08-27 17:52           ` Brian Foster
2025-08-27 19:20           ` Keith Busch
2025-09-01  8:22             ` Jan Kara
2025-08-29  2:11           ` Ritesh Harjani
2025-08-29  3:19             ` Ritesh Harjani

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=20250819164922.640964-8-kbusch@meta.com \
    --to=kbusch@meta.com \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=djwong@kernel.org \
    --cc=dw@davidwei.uk \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=snitzer@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).