[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whX+mAESz01NJZssoLMsgEpFjx7LDLO1_uW1qaDY2Jidw@mail.gmail.com>
Date: Fri, 19 May 2023 09:31:17 -0700
From: Linus Torvalds <torvalds@...ux-foundation.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>,
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 12:41 AM David Howells <dhowells@...hat.com> wrote:
>
> +
> + if (S_ISREG(file_inode(in)->i_mode) ||
> + S_ISBLK(file_inode(in)->i_mode)) {
This really feels fundamentally wrong to me.
If block and regular files have this limit, they should have their own
splice_read() function that implements that limit.
Not make everybody else check it.
IOW, this should be a separate function ("block_splice_read()" or
whatever), not inside a generic function that other users use.
The zero size checking looks fine, although I wondered about that too.
Some special files do traditionally have special meanings for
zero-sized reads (as in "packet boundary"). But I suspect that isn't
an issue for splice, and perhaps more importantly, I think the same
rule should be in place: special files that want special rules
shouldn't be using this generic function directly then.
Linus
Powered by blists - more mailing lists