From: Jens Axboe <axboe@kernel.dk>
To: linux-fsdevel@vger.kernel.org
Cc: torvalds@linux-foundation.org, brauner@kernel.org,
viro@zeniv.linux.org.uk, Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 03/11] IB/hfi1: check for user backed iterator, not specific iterator type
Date: Thu, 30 Mar 2023 10:46:54 -0600 [thread overview]
Message-ID: <20230330164702.1647898-4-axboe@kernel.dk> (raw)
In-Reply-To: <20230330164702.1647898-1-axboe@kernel.dk>
In preparation for switching single segment iterators to using ITER_UBUF,
swap the check for whether we are user backed or not. While at it, move
it outside the srcu locking area to clean up the code a bit.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
drivers/infiniband/hw/hfi1/file_ops.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c
index 3065db9d6bb9..f3d6ce45c397 100644
--- a/drivers/infiniband/hw/hfi1/file_ops.c
+++ b/drivers/infiniband/hw/hfi1/file_ops.c
@@ -267,6 +267,8 @@ static ssize_t hfi1_write_iter(struct kiocb *kiocb, struct iov_iter *from)
if (!HFI1_CAP_IS_KSET(SDMA))
return -EINVAL;
+ if (!from->user_backed)
+ return -EINVAL;
idx = srcu_read_lock(&fd->pq_srcu);
pq = srcu_dereference(fd->pq, &fd->pq_srcu);
if (!cq || !pq) {
@@ -274,11 +276,6 @@ static ssize_t hfi1_write_iter(struct kiocb *kiocb, struct iov_iter *from)
return -EIO;
}
- if (!iter_is_iovec(from) || !dim) {
- srcu_read_unlock(&fd->pq_srcu, idx);
- return -EINVAL;
- }
-
trace_hfi1_sdma_request(fd->dd, fd->uctxt->ctxt, fd->subctxt, dim);
if (atomic_read(&pq->n_reqs) == pq->n_max_reqs) {
--
2.39.2
next prev parent reply other threads:[~2023-03-30 16:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 16:46 [PATCHSET v6b 0/11] Turn single segment imports into ITER_UBUF Jens Axboe
2023-03-30 16:46 ` [PATCH 01/11] block: ensure bio_alloc_map_data() deals with ITER_UBUF correctly Jens Axboe
2023-03-30 16:46 ` [PATCH 02/11] iov_iter: add iter_iovec() helper Jens Axboe
2023-03-30 16:46 ` Jens Axboe [this message]
2023-03-30 16:46 ` [PATCH 04/11] IB/qib: check for user backed iterator, not specific iterator type Jens Axboe
2023-03-30 16:46 ` [PATCH 05/11] ALSA: pcm: " Jens Axboe
2023-03-30 16:46 ` [PATCH 06/11] iov_iter: add iter_iov_addr() and iter_iov_len() helpers Jens Axboe
2023-03-30 16:46 ` [PATCH 07/11] iov_iter: remove iov_iter_iovec() Jens Axboe
2023-03-30 16:46 ` [PATCH 08/11] iov_iter: set nr_segs = 1 for ITER_UBUF Jens Axboe
2023-03-30 16:47 ` [PATCH 09/11] iov_iter: overlay struct iovec and ubuf/len Jens Axboe
2023-03-30 16:47 ` [PATCH 10/11] iov_iter: convert import_single_range() to ITER_UBUF Jens Axboe
2023-03-30 16:47 ` [PATCH 11/11] iov_iter: import single vector iovecs as ITER_UBUF Jens Axboe
2023-03-30 17:11 ` [PATCHSET v6b 0/11] Turn single segment imports into ITER_UBUF Linus Torvalds
2023-03-30 17:33 ` Jens Axboe
2023-03-30 21:53 ` Linus Torvalds
2023-03-30 22:18 ` Jens Axboe
2023-04-02 22:22 ` Jens Axboe
2023-04-02 23:37 ` Linus Torvalds
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=20230330164702.1647898-4-axboe@kernel.dk \
--to=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=torvalds@linux-foundation.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).