lkml.org 
[lkml]   [2003]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: How to bypass buffer caches?
Bruno Diniz de Paula wrote:
>
> Hi,
>
> I've sent some messages about using O_DIRECT to read files, but I
> suppose that is not possible using 2.4 kernel and ext2. So I was
> wondering which other alternatives I have to bypass the buffer cache of
> the kernel.

You don't say why you need this. I recommend that you
simply don't use a filesystem - use a partition like
/dev/hda5 without a filesystem and read/write diskblocks
to and from it.

Without a filesystem you decide what data goes in what disk block,
and of course no fs cache gets in the way.

Transfering data between a range of blocks on a partition
and a ordinary file is easy - use the dd command.

file->partition
dd if=yourfile of=/dev/hdaX bs=4096 seek=<number of first block you want
to use>

partition->file
dd if=/dev/hdaX of=yourfile bs=4096 skip=<number of first disk block you
want copied> count=<total number of blocks>


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

\
 
 \ /
  Last update: 2005-03-22 13:33    [W:0.047 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site