From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 21 13:28:14 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A369816A4CE for ; Wed, 21 Apr 2004 13:28:14 -0700 (PDT) Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2D68E43D49 for ; Wed, 21 Apr 2004 13:28:14 -0700 (PDT) (envelope-from julian@elischer.org) Received: from interjet.elischer.org ([24.7.73.28]) by comcast.net (rwcrmhc12) with ESMTP id <2004042120281301400i65vse>; Wed, 21 Apr 2004 20:28:13 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id NAA33677; Wed, 21 Apr 2004 13:28:12 -0700 (PDT) Date: Wed, 21 Apr 2004 13:28:12 -0700 (PDT) From: Julian Elischer To: Steve Watt In-Reply-To: <200404212000.i3LK0ZFa065240@wattres.Watt.COM> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: hackers@freebsd.org Subject: Re: how to flush out cache.? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2004 20:28:14 -0000 On Wed, 21 Apr 2004, Steve Watt wrote: > In article you write: > > > >Ok so I have an application where I need to > >reread a file I have just written to ensure that it went to disk > >correctly.. > > > >Other than reading a few GB of data, is there a way to flush > >out the cache copy of a file I've written? > > You can flush the file to disk with fsync(). But I don't think that > evicts the blocks from the cache, just forces them to be written. To > the disk controller's cache, if you're lucky. > > >possibilities include: > > > >a file flag saying "don't keep a copy after it's written to disk"? > >a syscall discard_cached_blocks(fd); > > > > > >? > >any other suggestions? > > What are you hoping to accomplish? There are probably other ways > to solve the larger problem. I thought I was being clear.. I need to remove all the pages from cache so that a reread of the file is forced to go to disk. and I don't want to go read a 2GB dummy file to force the flush.. Someone suggested that I read the file usign 'dump' through the raw device.. > > -- > Steve Watt KD6GGD PP-ASEL-IA ICBM: 121W 56' 57.8" / 37N 20' 14.9" > Internet: steve @ Watt.COM Whois: SW32 > Free time? There's no such thing. It just comes in varying prices... >