[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230213134619.2198965-4-dhowells@redhat.com>
Date: Mon, 13 Feb 2023 13:46:18 +0000
From: David Howells <dhowells@...hat.com>
To: Jens Axboe <axboe@...nel.dk>, Al Viro <viro@...iv.linux.org.uk>,
Christoph Hellwig <hch@...radead.org>
Cc: David Howells <dhowells@...hat.com>,
Matthew Wilcox <willy@...radead.org>, Jan Kara <jack@...e.cz>,
Jeff Layton <jlayton@...nel.org>,
David Hildenbrand <david@...hat.com>,
Jason Gunthorpe <jgg@...dia.com>,
Logan Gunthorpe <logang@...tatee.com>,
Hillf Danton <hdanton@...a.com>, linux-fsdevel@...r.kernel.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Christoph Hellwig <hch@....de>,
John Hubbard <jhubbard@...dia.com>
Subject: [PATCH 3/4] splice: Use init_sync_kiocb() in filemap_splice_read()
Use init_sync_kiocb() in filemap_splice_read() rather than open coding it
and filter out IOCB_NOWAIT since the splice is synchronous.
Requested-by: Christoph Hellwig <hch@....de>
Signed-off-by: David Howells <dhowells@...hat.com>
cc: Christoph Hellwig <hch@....de>
cc: Jens Axboe <axboe@...nel.dk>
cc: Al Viro <viro@...iv.linux.org.uk>
cc: John Hubbard <jhubbard@...dia.com>
cc: David Hildenbrand <david@...hat.com>
cc: Matthew Wilcox <willy@...radead.org>
cc: linux-block@...r.kernel.org
cc: linux-fsdevel@...r.kernel.org
cc: linux-mm@...ck.org
---
fs/splice.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/splice.c b/fs/splice.c
index 7c0ff187f87a..8b2a9d963bc4 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -419,15 +419,15 @@ static ssize_t filemap_splice_read(struct file *in, loff_t *ppos,
size_t len, unsigned int flags)
{
struct folio_batch fbatch;
+ struct kiocb iocb;
size_t total_spliced = 0, used, npages;
loff_t isize, end_offset;
bool writably_mapped;
int i, error = 0;
- struct kiocb iocb = {
- .ki_filp = in,
- .ki_pos = *ppos,
- };
+ init_sync_kiocb(&iocb, in);
+ iocb.ki_pos = *ppos;
+ iocb.ki_flags &= IOCB_NOWAIT;
/* Work out how much data we can actually add into the pipe */
used = pipe_occupancy(pipe->head, pipe->tail);
Powered by blists - more mailing lists