[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZGcusJQfz68H1s7S@infradead.org>
Date: Fri, 19 May 2023 01:09:20 -0700
From: Christoph Hellwig <hch@...radead.org>
To: David Howells <dhowells@...hat.com>
Cc: Jens Axboe <axboe@...nel.dk>, Al Viro <viro@...iv.linux.org.uk>,
Christoph Hellwig <hch@...radead.org>,
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>,
Christian Brauner <brauner@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-fsdevel@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v20 03/32] splice: Make direct_read_splice() limit to eof
where appropriate
On Fri, May 19, 2023 at 08:40:18AM +0100, David Howells wrote:
> Make direct_read_splice() limit the read to the end of the file for regular
> files and block devices, thereby reducing the amount of allocation it will
> do in such a case.
>
> This means that the blockdev code doesn't require any special handling as
> filemap_read_splice() also limits to i_size.
I'm really not sure if this is a good idea. Right now
direct_read_splice (which also appears a little misnamed) really is
a splice by calling ->read_iter helper. I we don't do any
of this validtion we can just call it directly from splice.c instead
of calling into ->splice_read for direct I/O and DAX and remove a ton
of boilerplate code.
How often do we even call into splice beyond i_size and for how much?
> + if (S_ISREG(file_inode(in)->i_mode) ||
> + S_ISBLK(file_inode(in)->i_mode)) {
Btw, having these kinds of checks in supposedly generic code is always
a marked for a bit of a layering problem.
Powered by blists - more mailing lists