From: Lukas Bulwahn <lukas.bulwahn@gmail.com>
To: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
Lukas Bulwahn <lukas.bulwahn@gmail.com>
Subject: [PATCH] block: remove dead queue_dma_alignment branch from bio_map_user_iov()
Date: Tue, 4 Jan 2022 13:01:58 +0100 [thread overview]
Message-ID: <20220104120158.20177-1-lukas.bulwahn@gmail.com> (raw)
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@lst.de>
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
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 4526adde0156..1cccdb776905 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
next reply other threads:[~2022-01-04 12:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-04 12:01 Lukas Bulwahn [this message]
2022-01-04 12:47 ` [PATCH] block: remove dead queue_dma_alignment branch from bio_map_user_iov() 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=20220104120158.20177-1-lukas.bulwahn@gmail.com \
--to=lukas.bulwahn@gmail.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).