From owner-freebsd-current Fri Apr 14 20:31:48 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id UAA24816 for current-outgoing; Fri, 14 Apr 1995 20:31:48 -0700 Received: from sequent.kiae.su (sequent.kiae.su [144.206.136.6]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id UAA24795 for ; Fri, 14 Apr 1995 20:31:33 -0700 Received: by sequent.kiae.su id AA29712 (5.65.kiae-2 ); Sat, 15 Apr 1995 07:24:18 +0400 Received: by sequent.KIAE.su (UUMAIL/2.0); Sat, 15 Apr 95 07:24:18 +0400 Received: (from ache@localhost) by astral.msk.su (8.6.8/8.6.6) id DAA02679; Sat, 15 Apr 1995 03:30:17 +0400 To: current@FreeBSD.org, "John S. Dyson" References: <199504141715.RAA05096@jsdinc.root.com> In-Reply-To: <199504141715.RAA05096@jsdinc.root.com>; from "John S. Dyson" at Fri, 14 Apr 1995 17:15:53 GMT Message-Id: Organization: Olahm Ha-Yetzirah Date: Sat, 15 Apr 1995 03:30:14 +0400 X-Mailer: Mail/@ [v2.32 FreeBSD] From: "Andrey A. Chernov, Black Mage" X-Class: Fast Subject: Re: Info on VM/VFS changes since 4.4Lite Lines: 150 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Length: 3977 Sender: current-owner@FreeBSD.org Precedence: bulk In message <199504141715.RAA05096@jsdinc.root.com> John S. Dyson writes: >5) The VM system and buffer cache has been merged. > Now mmap is fully coherent with the read/write system calls. This > is an initial implementation, and the VOP_GETPAGE and VOP_PUTPAGE > will be compatibly added soon (Probably V2.2). For example, a > write to a file immediately causes the data to change immediately > in the address space of a process that might have the file mapped. John, please, can you fix munmap() & msync() to modify modification times as supposed and manpages promise? Now they don't touch modification times at all. It cause impossibility to use mmap() inside INND, it suppose modification time changing. BTW: my local chief shows me that BSDI 2.0 can handle much more articles quickly with INND then FreeBSD and call it "benchmark". The only one reason exists: BSDI have INND compiled with mmap() and FreeBSD without mmap() (it is configurable) due to modification times bug. Here small test program to demonstrate this bug: #include #include #include #include #include static char ICDactpath[] = "testfile"; static char *ICDactpointer; static int ICDactfd; static int ICDactsize; #if defined(MAP_FILE) #define MAP__ARG (MAP_FILE | MAP_SHARED) #else #define MAP__ARG (MAP_SHARED) #endif /* defined(MAP_FILE) */ char * ICDread() { struct stat Sb; int i; if ((ICDactfd = open(ICDactpath, O_WRONLY|O_TRUNC|O_CREAT, 0666)) < 0) { perror("open"); fprintf(stderr, "read: cant open %s\n", ICDactpath); exit(1); } for (i = 0; i < 7; i++) write(ICDactfd, "1234567890", 10); if (close(ICDactfd) < 0) { perror("close"); fprintf(stderr, "Close: cant close %s\n", ICDactpath); exit(1); } if ((ICDactfd = open(ICDactpath, O_RDWR)) < 0) { perror("open"); fprintf(stderr, "read: cant open %s\n", ICDactpath); exit(1); } if (fstat(ICDactfd, &Sb) < 0) { perror("fstat"); fprintf(stderr, "read: cant fstat %d %s\n", ICDactfd, ICDactpath); exit(1); } ICDactsize = Sb.st_size; ICDactpointer = mmap((caddr_t)0, ICDactsize, PROT_READ|PROT_WRITE, MAP__ARG, ICDactfd, (off_t)0); if (ICDactpointer == (char *)-1) { perror("mmap"); fprintf(stderr, "read: cant mmap %d %s\n", ICDactfd, ICDactpath); exit(1); } return ICDactpointer; } ICDclose() { if (ICDactpointer) { if (msync(ICDactpointer, ICDactsize, 0) < 0) { perror("msync"); fprintf(stderr, "Close: cant msync %s in closeactive()\n", ICDactpath); } if (munmap(ICDactpointer, ICDactsize) < 0) { perror("munmap"); fprintf(stderr, "Close: cant munmap\n", ICDactpath); } ICDactpointer = NULL; if (close(ICDactfd) < 0) { perror("close"); fprintf(stderr, "Close: cant close %s\n", ICDactpath); exit(1); } } } ICDwrite() { /* No-op. */ /* ICDactsize */ if (msync(ICDactpointer, 0, 0) < 0) { perror("msync"); fprintf(stderr, "Write: cant msync %s\n", ICDactpath); } } spy() { system("cat testfile; echo; ls -l testfile"); } main() { char *file_p; int to_sleep = 60; file_p = ICDread(); fprintf(stderr, "Original file and time\n"); spy(); *(file_p + 20) = '\n'; #if 0 fprintf(stderr, "After 1st write to mapped region\n"); spy(); #endif sleep(to_sleep); *(file_p + 30) = '\n'; #if 0 fprintf(stderr, "After 2nd write to mapped region and sleep()\n"); spy(); #endif ICDwrite(); fprintf(stderr, "After msync(..., 0)\n"); spy(); sleep(to_sleep); ICDclose(); fprintf(stderr, "After sleep(), msync(..., size) and close()\n"); spy(); unlink(ICDactpath); } -- Andrey A. Chernov : And I rest so composedly, /Now, in my bed, ache@astral.msk.su : That any beholder /Might fancy me dead - FidoNet: 2:5020/230.3 : Might start at beholding me, /Thinking me dead. RELCOM Team,FreeBSD Team : E.A.Poe From "For Annie" 1849