Skip to contentSkip to conversation

sendfile

DISCUSSION Frederik Eaton 2 participants 4 messages Jun 6, 2005 – Jun 7, 2005 VFS

lore
Share & tools
lore
#0 lore raw

Hi. Two questions:

Why was 'sendfile' changed in 2.6 to only accept a socket destination? (the man page doesn't explain)

If this restriction were removed, wouldn't the 'sendfile' system call also be useful as interface to copy-on-write filesystems?

Frederik

Signature · 1 line
http://ofb.net/~frederik/
#1 lore raw
Quoted 3 lines · Frederik Eaton

Why was 'sendfile' changed in 2.6 to only accept a socket destination? (the man page doesn't explain)

AFAIK it was because of big file->file sendfiles, which could easily block the entire system.

Quoted 2 lines

If this restriction were removed, wouldn't the 'sendfile' system call also be useful as interface to copy-on-write filesystems?

There are a few patches (sendfile part of the COW-Link patches from Joern Engel, http://wohnheim.fh-wedel.de/~joern/cowlink/, and Alexander Nybergs generic_file_sendpage() patch,
http://marc.theaimsgroup.com/?l=linux-kernel&m=108680821325052&w=2)
available. But I don't think the chances are high that Al will push them into the mainstream kernel.

Jan

#2 lore raw
Quoted 7 lines · Jan Blunck
Quoted 3 lines · Frederik Eaton

Why was 'sendfile' changed in 2.6 to only accept a socket destination? (the man page doesn't explain)

AFAIK it was because of big file->file sendfiles, which could easily block the entire system.

How could they block the system? Couldn't you send just as much data over a socket?

Quoted 9 lines
Quoted 2 lines

If this restriction were removed, wouldn't the 'sendfile' system call also be useful as interface to copy-on-write filesystems?

There are a few patches (sendfile part of the COW-Link patches from Joern Engel, http://wohnheim.fh-wedel.de/~joern/cowlink/, and Alexander Nybergs generic_file_sendpage() patch,
http://marc.theaimsgroup.com/?l=linux-kernel&m=108680821325052&w=2)
available. But I don't think the chances are high that Al will push them into the mainstream kernel.

Meaning they won't be incorporated ever, or yet?

Frederik

Signature · 1 line
http://ofb.net/~frederik/
#3 lore raw
Quoted 4 lines · Frederik Eaton

How could they block the system? Couldn't you send just as much data over a socket?

Yeah, but the sending kernel will sleep (and reschedule) while the receiving side of the socket is processing the data. Don't know if it is interruptable, though.

With the actual patches for file->file sendfile() a non-preemptive kernel would block on copying big files. Additionally, they doesn't handle signals and therefore the sendfile() isn't interruptable.

Quoted 3 lines

Meaning they won't be incorporated ever, or yet?

I can't read Linus mind but he was quite clear with his comments about them (http://marc.theaimsgroup.com/?t=109455992100001&r=1&w=2).

Jan