From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 2/4] splice: simplify a conditional in copy_splice_read
Date: Wed, 14 Jun 2023 16:03:39 +0200 [thread overview]
Message-ID: <20230614140341.521331-3-hch@lst.de> (raw)
In-Reply-To: <20230614140341.521331-1-hch@lst.de>
Check for -EFAULT instead of wrapping the check in an ret < 0 block.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/splice.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/splice.c b/fs/splice.c
index 87c69fdb333dab..7a9565d8ec4f9d 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -368,15 +368,15 @@ ssize_t copy_splice_read(struct file *in, loff_t *ppos,
if (ret > 0) {
keep = DIV_ROUND_UP(ret, PAGE_SIZE);
*ppos = kiocb.ki_pos;
- } else if (ret < 0) {
- /*
- * callers of ->splice_read() expect -EAGAIN on
- * "can't put anything in there", rather than -EFAULT.
- */
- if (ret == -EFAULT)
- ret = -EAGAIN;
}
+ /*
+ * Callers of ->splice_read() expect -EAGAIN on "can't put anything in
+ * there", rather than -EFAULT.
+ */
+ if (ret == -EFAULT)
+ ret = -EAGAIN;
+
/* Free any pages that didn't get touched at all. */
if (keep < npages)
release_pages(pages + keep, npages - keep);
--
2.39.2
next prev parent reply other threads:[~2023-06-14 14:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 14:03 dio / splice fixups Christoph Hellwig
2023-06-14 14:03 ` [PATCH 1/4] splice: don't call file_accessed in copy_splice_read Christoph Hellwig
2023-06-14 18:03 ` Johannes Thumshirn
2023-06-16 10:45 ` Christian Brauner
2023-06-14 14:03 ` Christoph Hellwig [this message]
2023-06-14 18:01 ` [PATCH 2/4] splice: simplify a conditional " Johannes Thumshirn
2023-06-16 10:46 ` Christian Brauner
2023-06-14 14:03 ` [PATCH 3/4] block: remove BIO_PAGE_REFFED Christoph Hellwig
2023-06-14 18:03 ` Johannes Thumshirn
2023-06-16 10:47 ` Christian Brauner
2023-06-14 14:03 ` [PATCH 4/4] iov_iter: remove iov_iter_get_pages and iov_iter_get_pages_alloc Christoph Hellwig
2023-06-16 10:48 ` Christian Brauner
2023-06-16 9:44 ` [PATCH 2/4] splice: simplify a conditional in copy_splice_read David Howells
2023-06-16 9:46 ` dio / splice fixups David Howells
2023-06-16 16:08 ` Jens Axboe
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=20230614140341.521331-3-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.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).