]> git.neil.brown.name Git - history.git/commit
Linux 2.1.108 2.1.108
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:15:49 +0000 (15:15 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:15:49 +0000 (15:15 -0500)
commit7eaba1c7b9dd7beeeb13579ab96baef6d1abad5e
tree65e8ef230b5241e45d53ab7056050f761b20ed79
parenteb4d32c1190c728bdea7b2fde7cc93650308aa18
Linux 2.1.108

I just made a pre-2.1.108 and put it on ftp.kernel.org - it fixes a
problem where my sendfile() forgot to get the kernel lock (blush), so it
randomly didn't work correctly on SMP.

I've also done some more testing of sendfile(), and the nice thing is that
when I compared doing a file copy with sendfile compared to a plain "cp",
the sendfile implementation was about twice as fast (at least my version
of "cp" will just do read+write pairs over and over again). When I copied
a 38MB file the "cp" took 1:58 seconds while sendfile took 1:08 seconds
according to "time" (I have 512MB of RAM, so this was all cached,
obviously)..

I haven't done any network tests, because I don't think I'd be able to see
any difference, and it does need the "SO_CONSTIPATED" thing and a way to
push the end of data for best performance.

Some final words on sendfile():
 - it does report errors correctly. That doesn't mean that you necessarily
   can know _which_ fd produced the error, that you have to find out on
   your own. A file real access can generally result in EIO and EACCES
   (the latter with NFS and other "protection-at-read-time" non-UNIX
   filesystems), while the output write() can result in a number of errors
   as the output fd can be any kind of socket/tty/file. Depending on the
   mode of the output file, the output errors can include EINTR, EAGAIN
   etc, and you can mix sendfile() with select() on the output socket, for
   example.
 - you can give it a length of MAX_ULONG, and it will write as much as it
   can. This is entirely consistent with the notion that it is equivalent
   with write(out, tmpbuf, read(in, tmpbuf, size)) where "tmpbuf" is
   essentially infinite - the read() will read al of the file and return
   the file length in the process. Thus you don't even need to know the
   size of the file beforehand.
   The file copy test was essentially done with a single
        error = sendfile(out, in, ~0);
   and I'm appending my current test-program.

This is going to be in 2.2, btw. The changes are so small and so obviously
have to work that it would be ridiculous not to have this - the only
question is whether I'll try to make it a "copyfd()" system call instead,
falling back on read+write when I can't use the page cache directly. I
suspect I won't.

                        Linus
25 files changed:
Documentation/Configure.help
Documentation/filesystems/vfs.txt [new file with mode: 0644]
MAINTAINERS
arch/alpha/config.in
arch/alpha/kernel/setup.c
arch/i386/kernel/bios32.c
drivers/block/Config.in
drivers/block/Makefile
drivers/block/ide.c
drivers/char/lp.c
drivers/char/serial.c
drivers/scsi/ChangeLog.ncr53c8xx
drivers/scsi/Config.in
drivers/scsi/README.ncr53c8xx
drivers/scsi/hosts.c
drivers/scsi/ncr53c8xx.c
drivers/scsi/ncr53c8xx.h
drivers/scsi/scsi.c
drivers/scsi/scsi_obsolete.c
fs/fcntl.c
include/linux/mm.h
mm/memory.c
mm/mlock.c
mm/mmap.c
mm/mremap.c