Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Apr 2004 13:32:58 -0700 (PDT)
From:      Julian Elischer <julian@elischer.org>
To:        Steve Watt <steve@Watt.COM>
Cc:        hackers@freebsd.org
Subject:   Re: how to flush out cache.?
Message-ID:  <Pine.BSF.4.21.0404211331370.31770-100000@InterJet.elischer.org>
In-Reply-To: <Pine.BSF.4.21.0404211326301.31770-100000@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help


On Wed, 21 Apr 2004, Julian Elischer wrote:

> 
> 
> On Wed, 21 Apr 2004, Steve Watt wrote:
> 
> > In article <Pine.BSF.4.21.0404211219460.31770-100000@InterJet.elischer.org> 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);

Turns out O_DIRECT might do this, but I can't use this as 
apparently it's being written by a 3rd party program..
I can only check the file after the other program has written it..

> > >
> > >
> > >?
> > >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...
> > 
> 
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0404211331370.31770-100000>