APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Linux raw io not supported in 2.6 kernel


© December 2004 (various authors)

Taken from a newsgroup post

From: General Schvantzkoph <schvantzk...@yahoo.com>
Subject: Re: Is there a way to flush the file cache?
Date: 29 Dec 2006 13:29:38 GMT
Message-ID: <4vkji2F1b4vglU22@mid.individual.net> 
References: <4vig1lF1b4vglU18@mid.individual.net> 

On Fri, 29 Dec 2006 12:35:51 +0000, Jean-David Beyer wrote:

> General Schvantzkoph wrote:
>> On Thu, 28 Dec 2006 13:29:24 -0800, Tony  Lawrence wrote:
>> 
>>> General Schvantzkoph wrote:
>>>> I'm writing a system exerciser that checks memory and disk I/O. Is there a
>>>> C call that flushes the file cache so that I can be assured that my freads
>>>> are coming from the disk and not the RAM. I'm using a sync() but I don't
>>>> think that does the whole job, it guarantees that the disk writes happen
>>>> but I don't think it clears out the file cache.
>>>
>>> Well, of course it can't guarantee that some random app hasn't written
>>> data, if that's what you mean..
>>>
>> 
>> What I want to do is the following,
>> 
>> 1) Create a file and write it to the disk.
>> 2) Read that file off of the disk and then check it.
>> 
>> I'm trying to check the SATA interfaces so it's important that the file go
>> to and from the disks. The file cache interferes with this because if the
>> file is present in the cache the program will get the cached copy not the
>> copy that is on the disk. The sync() call forces the disk writes to happen
>> immediately which is half of the battle. The other half is to purge the
>> file cache so that all subsequent file reads come from the disk. Is there
>> a way to do this?
> 
> Does your version of the kernel permit "raw IO"? The 2.4 kernels do. In that
> case, you can open a raw partition and reads and writes will bypass the file
> system and use just the device drivers. I believe the 2.6 kernels do not
> unless you have some compatability library or something.
>

I've just gotten the answer on the Fedora forums. The open() call has a
O_DIRECT flag which causes file I/O to use user buffers instead of the
cache. Raw IO isn't supported in the 2.6 kernels.
 

Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> Linux raw io not supported in 2.6 kernel


Inexpensive and informative Apple related e-books:

iOS 8: A Take Control Crash Course

Photos: A Take Control Crash Course

Take Control of IOS 11

Take Control of iCloud

Take Control of OS X Server





Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us


Printer Friendly Version





FORTRAN was the language of choice for the same reason that three-legged races are popular. (Ken Thompson)




Linux posts

Troubleshooting posts


This post tagged:

Linux



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode





SCO Unix Sales, Support, & Service

Phone:  707-SCO-UNIX (707-726-8649Toll Free: 833-SCO-UNIX (833-726-8649)
www.SCOsales.com