2003-08-07 12:28:52

by Theewara Vorakosit

[permalink] [raw]
Subject: sendfile system call on tmpfs

Dear All,
I use linux redhat 9 with kernal 2.4.20-13.9smp. I try to use
sendfile system. I found that on ext3 file system, it works fine.
However, on tmpfs, it error with "Invalid argument". Does sendfile()
support on tmpfs or other filesystem?
Thanks,
Theewara


2003-08-07 13:08:18

by Hugh Dickins

[permalink] [raw]
Subject: Re: sendfile system call on tmpfs

On Thu, 7 Aug 2003, Theewara Vorakosit wrote:
> I use linux redhat 9 with kernal 2.4.20-13.9smp. I try to use
> sendfile system. I found that on ext3 file system, it works fine.
> However, on tmpfs, it error with "Invalid argument". Does sendfile()
> support on tmpfs or other filesystem?

The 2.4 tmpfs did not support sendfile (or loop) until 2.4.22-pre3,
so Red Hat's 2.4.20-13.9smp won't do it.

If you're at ease with patching the kernel source and rebuilding your
kernel, please let me know: I should be able to send you the necessary
patch (mainly mm/shmem.c) to add those features into your Red Hat 9 tmpfs.

Hugh

2003-08-09 01:52:10

by Jamie Lokier

[permalink] [raw]
Subject: Re: sendfile system call on tmpfs

Hugh Dickins wrote:
> The 2.4 tmpfs did not support sendfile (or loop) until 2.4.22-pre3,
> so Red Hat's 2.4.20-13.9smp won't do it.

Oh. Does this mean that it is faster to serve program-generated data
by mmaping an ext3 file and using sendfile() on that, than to call
write() from anonymous memory? The former does zero-copy, the latter
doesn't. Unfortunately the former might write to disk, though you
don't want it too.

-- Jamie