From: David Howells <dhowells@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: dhowells@redhat.com, David Hildenbrand <david@redhat.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Christoph Hellwig <hch@infradead.org>,
Matthew Wilcox <willy@infradead.org>, Jan Kara <jack@suse.cz>,
Jeff Layton <jlayton@kernel.org>,
Jason Gunthorpe <jgg@nvidia.com>,
Logan Gunthorpe <logang@deltatee.com>,
Hillf Danton <hdanton@sina.com>,
linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v3 0/5] iov_iter: Adjust styling/location of new splice functions
Date: Tue, 14 Feb 2023 15:49:29 +0000 [thread overview]
Message-ID: <2677038.1676389769@warthog.procyon.org.uk> (raw)
In-Reply-To: <9dd98aed-0d9a-eb3e-790c-0dd744be8ccb@kernel.dk>
Jens Axboe <axboe@kernel.dk> wrote:
> That is indeed the question, and unanswered so far... Let's turn it into
> one clean series, and get it stuffed into for-next and most likely
> target 6.4 for inclusion at this point.
I was waiting to see if the patch worked for Daniel (which it does) and
Guenter (no answer yet) before answering. It appears to fix shmem - I've
tested it with:
dd if=/dev/zero of=/tmp/sparse count=1 seek=401 bs=4096
just-splice /tmp/sparse 11234000 | sha1sum
where just-splice.c is attached (note that piping the output into another
program is important to make the splice work).
Meanwhile, I'm working on working the changes into my patchset at appropriate
points.
David
---
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/sendfile.h>
#include <sys/wait.h>
static char *prog;
int main(int argc, char *argv[])
{
unsigned int iflags = 0;
ssize_t spliced, remain;
int in, out;
prog = argv[0];
if (argc > 1 && strcmp(argv[1], "-d") == 0) {
iflags |= O_DIRECT;
argv++;
argc--;
}
if (argc != 3 || !argv[1][0] || !argv[2][0]) {
fprintf(stderr, "Usage: %s <file> <amount>\n", prog);
exit(2);
}
in = open(argv[1], O_RDONLY | O_NOFOLLOW | iflags);
if (in < 0) {
perror("open");
exit(1);
}
remain = strtoul(argv[2], NULL, 0);
while (remain > 0) {
spliced = splice(in, NULL, 1, NULL, remain, 0);
if (spliced < 0) {
perror("splice");
exit(1);
}
if (spliced == 0)
break;
remain -= spliced;
}
exit(0);
}
prev parent reply other threads:[~2023-02-14 15:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-14 8:37 David Howells
2023-02-14 8:37 ` [PATCH v3 1/5] splice: Rename " David Howells
2023-02-14 8:37 ` [PATCH v3 2/5] splice: Provide pipe_head_buf() helper David Howells
2023-02-14 8:37 ` [PATCH v3 3/5] splice: Use init_sync_kiocb() in filemap_splice_read() David Howells
2023-02-14 8:37 ` [PATCH v3 4/5] splice: Move filemap_read_splice() to mm/filemap.c David Howells
2023-02-14 8:37 ` [PATCH v3 5/5] shmem, overlayfs, coda, tty, proc, kernfs, random: Fix splice-read David Howells
2023-02-14 8:54 ` Greg Kroah-Hartman
2023-02-14 13:59 ` Daniel Golle
2023-02-14 13:05 ` Miklos Szeredi
[not found] ` <75d74adc-7f18-d0df-e092-10bca4f05f2a@redhat.com>
2023-02-14 15:36 ` [PATCH v3 0/5] iov_iter: Adjust styling/location of new splice functions Jens Axboe
2023-02-14 15:49 ` David Howells [this message]
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=2677038.1676389769@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=axboe@kernel.dk \
--cc=david@redhat.com \
--cc=hch@infradead.org \
--cc=hdanton@sina.com \
--cc=jack@suse.cz \
--cc=jgg@nvidia.com \
--cc=jlayton@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=logang@deltatee.com \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.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