From: Anton Blanchard <anton@linuxcare.com.au>
To: Sasi Peter <sape@iq.rulez.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Is sendfile all that sexy?
Date: Fri, 26 Jan 2001 17:10:15 +1100 [thread overview]
Message-ID: <20010126171014.B18463@linuxcare.com> (raw)
In-Reply-To: <20010125212033.E14807@linuxcare.com> <Pine.LNX.4.30.0101251157400.5377-100000@iq.rulez.org>
In-Reply-To: <Pine.LNX.4.30.0101251157400.5377-100000@iq.rulez.org>; from sape@iq.rulez.org on Thu, Jan 25, 2001 at 11:58:03AM +0100
> Do you have it at a URL?
The patch is small so I have attached it to this email. It should apply
to the samba CVS tree. Remember this is still a hack and I need to add
code to ensure the file is not truncated and we sendfile() less than we
promised. (After talking to tridge and davem, this should be fixed shortly.)
There is a lot more going on than in the web serving case, so
sendfile+zero copy is not going to help us as much as it did for the tux
guys. For example currently on 2.4.0 + zero copy patches:
anton@drongo:~/dbench$ ~anton/samba/source/bin/smbtorture //otherhost/netbench -U% -N 15 NBW95
read/write:
Throughput 16.5478 MB/sec (NB=20.6848 MB/sec 165.478 MBit/sec)
sendfile:
Throughput 17.0128 MB/sec (NB=21.266 MB/sec 170.128 MBit/sec)
Of course there is still lots to be done :)
Cheers,
Anton
diff -u -u -r1.195 includes.h
--- source/include/includes.h 2000/12/06 00:05:14 1.195
+++ source/include/includes.h 2001/01/26 05:38:51
@@ -871,7 +871,8 @@
/* default socket options. Dave Miller thinks we should default to TCP_NODELAY
given the socket IO pattern that Samba uses */
-#ifdef TCP_NODELAY
+
+#if 0
#define DEFAULT_SOCKET_OPTIONS "TCP_NODELAY"
#else
#define DEFAULT_SOCKET_OPTIONS ""
diff -u -u -r1.257 reply.c
--- source/smbd/reply.c 2001/01/24 19:34:53 1.257
+++ source/smbd/reply.c 2001/01/26 05:38:53
@@ -2383,6 +2391,51 @@
END_PROFILE(SMBreadX);
return(ERROR(ERRDOS,ERRlock));
}
+
+#if 1
+ /* We can use sendfile if it is not chained */
+ if (CVAL(inbuf,smb_vwv0) == 0xFF) {
+ off_t tmpoffset;
+ struct stat buf;
+ int flags = 0;
+
+ nread = smb_maxcnt;
+
+ fstat(fsp->fd, &buf);
+ if (startpos > buf.st_size)
+ return(UNIXERROR(ERRDOS,ERRnoaccess));
+ if (nread > (buf.st_size - startpos))
+ nread = (buf.st_size - startpos);
+
+ SSVAL(outbuf,smb_vwv5,nread);
+ SSVAL(outbuf,smb_vwv6,smb_offset(data,outbuf));
+ SSVAL(smb_buf(outbuf),-2,nread);
+ CVAL(outbuf,smb_vwv0) = 0xFF;
+ set_message(outbuf,12,nread,False);
+
+#define MSG_MORE 0x8000
+ if (nread > 0)
+ flags = MSG_MORE;
+ if (send(smbd_server_fd(), outbuf, data - outbuf, flags) == -1)
+ DEBUG(0,("reply_read_and_X: send ERROR!\n"));
+
+ tmpoffset = startpos;
+ while(nread) {
+ int nwritten;
+ nwritten = sendfile(smbd_server_fd(), fsp->fd, &tmpoffset, nread);
+ if (nwritten == -1)
+ DEBUG(0,("reply_read_and_X: sendfile ERROR!\n"));
+
+ if (!nwritten)
+ break;
+
+ nread -= nwritten;
+ }
+
+ return -1;
+ }
+#endif
+
nread = read_file(fsp,data,startpos,smb_maxcnt);
if (nread < 0) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2001-01-26 6:12 UTC|newest]
Thread overview: 130+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-14 18:29 Is sendfile all that sexy? jamal
2001-01-14 18:50 ` Ingo Molnar
2001-01-14 19:02 ` jamal
2001-01-14 19:09 ` Ingo Molnar
2001-01-14 19:18 ` jamal
2001-01-14 20:22 ` Linus Torvalds
2001-01-14 20:38 ` Ingo Molnar
2001-01-14 21:44 ` Linus Torvalds
2001-01-14 21:49 ` Ingo Molnar
2001-01-14 21:54 ` Gerhard Mack
2001-01-14 22:40 ` Linus Torvalds
2001-01-14 22:45 ` J Sloan
2001-01-15 20:15 ` H. Peter Anvin
2001-01-15 3:43 ` Michael Peddemors
2001-01-15 13:02 ` Florian Weimer
2001-01-15 13:45 ` Tristan Greaves
2001-01-15 1:14 ` Dan Hollis
2001-01-15 15:24 ` Jonathan Thackray
2001-01-15 15:36 ` Matti Aarnio
2001-01-15 20:17 ` H. Peter Anvin
2001-01-15 16:05 ` dean gaudet
2001-01-15 18:34 ` Jonathan Thackray
2001-01-15 18:46 ` Linus Torvalds
2001-01-15 20:47 ` [patch] sendpath() support, 2.4.0-test3/-ac9 Ingo Molnar
2001-01-16 4:51 ` dean gaudet
2001-01-16 4:59 ` Linus Torvalds
2001-01-16 9:48 ` 'native files', 'object fingerprints' [was: sendpath()] Ingo Molnar
2000-01-01 2:02 ` Pavel Machek
2001-01-16 11:13 ` Andi Kleen
2001-01-16 11:26 ` Ingo Molnar
2001-01-16 11:37 ` Andi Kleen
2001-01-16 12:04 ` O_ANY [was: Re: 'native files', 'object fingerprints' [was: sendpath()]] Ingo Molnar
2001-01-16 12:09 ` Ingo Molnar
2001-01-16 12:13 ` Peter Samuelson
2001-01-16 12:33 ` Ingo Molnar
2001-01-16 14:40 ` Felix von Leitner
2001-01-16 12:34 ` Andi Kleen
2001-01-16 13:00 ` Mitchell Blank Jr
2001-01-16 13:57 ` 'native files', 'object fingerprints' [was: sendpath()] Jamie Lokier
2001-01-16 14:27 ` Felix von Leitner
2001-01-16 17:47 ` Linus Torvalds
2001-01-17 4:39 ` dean gaudet
2001-01-16 9:19 ` [patch] sendpath() support, 2.4.0-test3/-ac9 Ingo Molnar
2001-01-17 0:03 ` dean gaudet
2001-01-15 18:58 ` Is sendfile all that sexy? dean gaudet
2001-01-15 19:41 ` Ingo Molnar
2001-01-15 20:33 ` Albert D. Cahalan
2001-01-15 21:00 ` Linus Torvalds
2001-01-16 10:40 ` Felix von Leitner
2001-01-16 11:56 ` Peter Samuelson
2001-01-16 12:37 ` Ingo Molnar
2001-01-16 12:42 ` Ingo Molnar
2001-01-16 12:47 ` Felix von Leitner
2001-01-16 13:48 ` Jamie Lokier
2001-01-16 14:20 ` Felix von Leitner
2001-01-16 15:05 ` David L. Parsley
2001-01-16 15:05 ` Jakub Jelinek
2001-01-16 15:46 ` David L. Parsley
2001-01-18 14:00 ` Laramie Leavitt
2001-01-17 19:27 ` dean gaudet
2001-01-24 0:58 ` Sasi Peter
2001-01-24 8:44 ` James Sutherland
2001-01-25 10:20 ` Anton Blanchard
2001-01-25 10:58 ` Sasi Peter
2001-01-26 6:10 ` Anton Blanchard [this message]
2001-01-26 11:46 ` David S. Miller
2001-01-26 14:12 ` Anton Blanchard
2001-01-15 23:16 ` Pavel Machek
2001-01-16 13:47 ` jamal
2001-01-16 14:41 ` Pavel Machek
-- strict thread matches above, loose matches on Subject: below --
2001-01-16 13:50 Andries.Brouwer
2001-01-17 6:56 ` Ton Hospel
2001-01-17 7:31 ` Steve VanDevender
2001-01-17 8:09 ` Ton Hospel
2001-01-17 15:02 Ben Mansell
2000-01-01 2:10 ` Pavel Machek
2001-01-17 19:32 ` Linus Torvalds
2001-01-18 2:34 ` Olivier Galibert
2001-01-21 21:22 ` LA Walsh
2001-01-18 8:23 ` Rogier Wolff
2001-01-18 10:01 ` Andreas Dilger
2001-01-18 11:04 ` Russell Leighton
2001-01-18 16:36 ` Larry McVoy
2001-01-19 1:53 ` Linus Torvalds
2001-01-18 16:24 ` Linus Torvalds
2001-01-18 18:46 ` Kai Henningsen
2001-01-18 18:58 ` Roman Zippel
2001-01-18 19:42 ` Linus Torvalds
2001-01-19 0:18 ` Roman Zippel
2001-01-19 1:14 ` Linus Torvalds
2001-01-19 6:57 ` Alan Cox
2001-01-19 10:13 ` Roman Zippel
2001-01-19 10:55 ` Andre Hedrick
2001-01-19 20:18 ` kuznet
2001-01-19 21:45 ` Linus Torvalds
2001-01-20 18:53 ` kuznet
2001-01-20 19:26 ` Linus Torvalds
2001-01-20 21:20 ` Roman Zippel
2001-01-21 0:25 ` Linus Torvalds
2001-01-21 2:03 ` Roman Zippel
2001-01-21 18:00 ` kuznet
2001-01-21 23:21 ` David Woodhouse
2001-01-20 15:36 ` Kai Henningsen
2001-01-20 21:01 ` Linus Torvalds
2001-01-20 21:10 ` Mo McKinlay
2001-01-20 22:24 ` Roman Zippel
2001-01-21 0:33 ` Linus Torvalds
2001-01-21 1:29 ` David Schwartz
2001-01-21 2:42 ` Roman Zippel
2001-01-21 9:52 ` James Sutherland
2001-01-21 10:02 ` Ingo Molnar
2001-01-22 9:52 ` Helge Hafting
2001-01-22 13:00 ` James Sutherland
2001-01-23 9:01 ` Helge Hafting
2001-01-23 9:37 ` James Sutherland
2001-01-18 19:51 ` Rick Jones
2001-01-18 12:17 ` Peter Samuelson
2001-01-22 18:13 ` Val Henson
2001-01-22 18:27 ` David Lang
2001-01-22 19:37 ` Val Henson
2001-01-22 20:01 ` David Lang
2001-01-22 22:04 ` Ion Badulescu
2001-01-22 18:54 ` Linus Torvalds
[not found] <Pine.LNX.4.10.10101190911130.10218-100000@penguin.transmeta.com>
2001-01-19 17:23 ` Rogier Wolff
2001-01-24 15:12 Sasi Peter
2001-01-24 15:29 ` James Sutherland
2001-01-25 1:11 ` Alan Cox
2001-01-25 9:06 ` James Sutherland
2001-01-25 10:42 ` bert hubert
2001-01-25 12:14 ` James Sutherland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010126171014.B18463@linuxcare.com \
--to=anton@linuxcare.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=sape@iq.rulez.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox