On Sat, Jul 04, 2020 at 09:12:06PM +0100, Al Viro wrote:
On Sat, Jul 04, 2020 at 09:41:09PM +0200, Miklos Szeredi wrote:
quoted
And "If the size of file is smaller than the value provided in count
then the whole file will be copied into buf", which is simply a lie;
for example seq_file will happily return a smaller-than-PAGE_SIZE
chunk if at least one record fits in there. You'll have a very hard
time explaining that in the man page. So I think there are two
possible ways forward:
1) just leave the first explanation (it's an open + read + close
equivalent) and leave out the rest
2) add a loop around the vfs_read() in the code.
3) don't bother with the entire thing, until somebody manages to demonstrate
a setup where it does make a real difference (compared to than the obvious
sequence of syscalls, that is). At which point we'll need to figure out
what's going on and deal with the underlying problem of that setup.
Incidentally, if that's intended for use on _sysfs_, I would like to see the
effects of that sucker being called by many processes in parallel, seeing that
sysfs has, er, certain scalability problems in its lookups. And I would be
very surprised if they were not heavier than said overhead of two extra syscalls.