From owner-freebsd-hackers Tue Apr 13 16:56:57 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [209.157.86.2]) by hub.freebsd.org (Postfix) with ESMTP id 0132214CC7 for ; Tue, 13 Apr 1999 16:56:53 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id QAA23919; Tue, 13 Apr 1999 16:54:31 -0700 (PDT) (envelope-from dillon) Date: Tue, 13 Apr 1999 16:54:31 -0700 (PDT) From: Matthew Dillon Message-Id: <199904132354.QAA23919@apollo.backplane.com> To: Jason Thorpe Cc: Ville-Pertti Keinonen , hackers@FreeBSD.ORG Subject: Re: read() and pread() syscalls References: <199904121916.MAA07413@lestat.nas.nasa.gov> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :On 12 Apr 1999 17:01:50 +0300 : Ville-Pertti Keinonen wrote: : : > This may come as a shock to you, but read(2)/write(2) aren't atomic in : > updating the file pointer, either. : :Then that's a bug in the FreeBSD kernel. : : > Actually, read(2) is equivalent to lseek(2)+pread(2)+lseek(2), with the : > last lseek(2) being SEEK_CUR by the read count returned by pread(2). : > The difference is that read(2) can only be pre-empted if it blocks : > doing I/O (which is not unusual). : :Geez, how did this get implemented in FreeBSD?! It's certainly not that :complicated. : : -- Jason R. Thorpe There's an overriding issue with all of this related to the fact that vnodes have only one lock structure associated with them. What we really need are two lock structures -- one that can be used as a rename/delete interlock against namei, allowing namei operations to run in parallel and not block each other out, and a second one that handles everything else. Atomicy can be handle by creating a second POSIX locking structure for the vnode which could be used by the kernel to parallelize read and write ops. If there were five of me, I'd go and do it. But I've got my hands full. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message