Re: RFC: invalidateCaches(fd) interface

Stephen C. Tweedie (sct@redhat.com)
Wed, 17 Mar 1999 16:07:25 GMT


Hi,

On Sat, 06 Mar 1999 11:38:34 -0800, lm@bitmover.com (Larry McVoy)
said:

> I've been unable to find an interface in Linux which will flush just
> a single file's data from the buffer/page cache[s]. I used to do
> this on Sun's with an mmap() and then an msync(MS_INVALIDATE) but
> that doesn't seem to work in Linux. Does anyone have a patch to do
> this and would there be any interest in a /proc interface to do
> this? I'd like to be able to do

> echo /home/lm/tmp/BIGFILE > /proc/invalidate

> and have it do it.

The December ;Login: had an update on the Posix.1d standards WIP which
addressed this with an IO advisory function:

posix_fadvise(fd, code, start, length);

which defines advise codes

POSIX_FADV_NORMAL: no special treatment
POSIX_FADV_SEQUENTIAL: expect sequential access
POSIX_FADV_RANDOM: expect random access
POSIX_FADV_WILLNEED: expect access to given range soon
(ie. preload cache)
POSIX_FADV_DONTNEED: don't need the given range any more
POSIX_FADV_NOREUSE: don't expect reuse of this data after the
first access

Would this satisfy your requirements if implemented for Linux?
POSIX_FADV_DONTNEED would seem to be what you are after.

--Stephen

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/