[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220307095411.30459-1-lukas.bulwahn@gmail.com>
Date: Mon, 7 Mar 2022 10:54:11 +0100
From: Lukas Bulwahn <lukas.bulwahn@...il.com>
To: Christoph Hellwig <hch@....de>, Jens Axboe <axboe@...nel.dk>,
linux-block@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Lukas Bulwahn <lukas.bulwahn@...il.com>
Subject: [PATCH RESEND] block: remove dead queue_dma_alignment branch from bio_map_user_iov()
If queue_dma_alignment(rq->q), then blk_rq_map_user_iov() will call
bio_copy_user_iov() and not bio_map_user_iov(). So, bio_map_user_iov() does
not need to handle the queue_dma_alignment(rq->q) case in any special way.
Remove this dead branch from bio_map_user_iov().
Suggested-by: Christoph Hellwig <hch@....de>
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@...il.com>
Reviewed-by: Christoph Hellwig <hch@....de>
---
still applies on next-20220307
added Christoph's Reviewed-by tag from:
https://lore.kernel.org/all/20220104124724.GA21670@lst.de/
Jens, this patch must have fell through the cracks...
please pick this minor non-urgent clean-up patch.
block/blk-map.c | 41 ++++++++++++++++++-----------------------
1 file changed, 18 insertions(+), 23 deletions(-)
diff --git a/block/blk-map.c b/block/blk-map.c
index c7f71d83eff1..2a1d7c5f791e 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -260,31 +260,26 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter,
npages = DIV_ROUND_UP(offs + bytes, PAGE_SIZE);
- if (unlikely(offs & queue_dma_alignment(rq->q))) {
- ret = -EINVAL;
- j = 0;
- } else {
- for (j = 0; j < npages; j++) {
- struct page *page = pages[j];
- unsigned int n = PAGE_SIZE - offs;
- bool same_page = false;
-
- if (n > bytes)
- n = bytes;
-
- if (!bio_add_hw_page(rq->q, bio, page, n, offs,
- max_sectors, &same_page)) {
- if (same_page)
- put_page(page);
- break;
- }
-
- added += n;
- bytes -= n;
- offs = 0;
+ for (j = 0; j < npages; j++) {
+ struct page *page = pages[j];
+ unsigned int n = PAGE_SIZE - offs;
+ bool same_page = false;
+
+ if (n > bytes)
+ n = bytes;
+
+ if (!bio_add_hw_page(rq->q, bio, page, n, offs,
+ max_sectors, &same_page)) {
+ if (same_page)
+ put_page(page);
+ break;
}
- iov_iter_advance(iter, added);
+
+ added += n;
+ bytes -= n;
+ offs = 0;
}
+ iov_iter_advance(iter, added);
/*
* release the pages we didn't map into the bio, if any
*/
--
2.17.1
Powered by blists - more mailing lists