2002-10-23 16:32:58

by Nivedita Singhvi

[permalink] [raw]
Subject: Re: O_DIRECT sockets? (was [RESEND] tuning linux for high network performance?)

Roy Sigurd Karlsbakk wrote:

> I'm doing O_DIRECT read (from disk), so it needs to be user -> kernel, then.
>
> any chance of using O_DIRECT to the socket?

Hmm, I'm still not clear on why you cannot use sendfile()?
I was not aware of any upper limit to the file size in order
for sendfile() to be used? From what little I know, this
is exactly the kind of situation that sendfile was intended
to benefit.

thanks,
Nivedita


2002-10-24 10:00:54

by Roy Sigurd Karlsbakk

[permalink] [raw]
Subject: Re: O_DIRECT sockets? (was [RESEND] tuning linux for high network performance?)

> Hmm, I'm still not clear on why you cannot use sendfile()?
> I was not aware of any upper limit to the file size in order
> for sendfile() to be used? From what little I know, this
> is exactly the kind of situation that sendfile was intended
> to benefit.

I can't use sendfile(). I'm working with files > 4GB, and from man 2 sendfile:

ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count);

int main() {
ssize_t s1;
off_t offset;
size_t count;

printf("sizeof ssize_t: %d\n", sizeof s1);
printf("sizeof size_t: %d\n", sizeof count);
printf("sizeof off_t: %d\n", sizeof offset);
return 0;
}

running it

$ ./sendfile_test
sizeof ssize_t: 4
sizeof size_t: 4
sizeof off_t: 4
$

as far as I'm concerned, this will not allow me to address files past the 4GB
limit (or was it 2?)

roy

--
Roy Sigurd Karlsbakk, Datavaktmester
ProntoTV AS - http://www.pronto.tv/
Tel: +47 9801 3356

Computers are like air conditioners.
They stop working when you open Windows.

2002-10-24 10:28:42

by David S. Miller

[permalink] [raw]
Subject: Re: O_DIRECT sockets? (was [RESEND] tuning linux for high network performance?)

On Thu, 2002-10-24 at 03:14, Roy Sigurd Karlsbakk wrote:
> I can't use sendfile(). I'm working with files > 4GB, and from man 2 sendfile:

That's what sendfile64() is for. In fact every vendor I am aware
of is shipping the sys_sendfile64() patch in their kernels and
an appropriately fixed up glibc.