in reply to Re: Need writes to happen immediately.
in thread Need writes to happen immediately.

I know the speed differences and the advantage / disadvantage of each. My problem is that I cannot seem to find a way to directly access the devices and bypass all the caching and everything that occurs, because of this I cannot do what I need to and make sure writes occur in order at the time they are given.

I am at my wits end, I do not know where to go from here... My searches have shown that someone doing something similar needed to use mmap to map some memory and align it with something before using O_DIRECT. but the terminology is beyond me. I try using O_DIRECT and get an invalid argument.

Now I am trying it with O_SYNC but all it is doing is making it write at about 1mb every 2 minutes.
  • Comment on Re^2: Need writes to happen immediately.

Replies are listed 'Best First'.
Re^3: Need writes to happen immediately.
by Anonymous Monk on Jun 17, 2007 at 02:07 UTC
Re^3: Need writes to happen immediately.
by exodist (Monk) on Jun 17, 2007 at 01:42 UTC
    Perhaps it would help if I just explained why it is so important.
    I am writing a filesystem, I am using perl to quickly prototype it and write something that works, I will then likely try to make a kernel moduel (though my c/c++ skills are not very good, and the kernel code is way over my head)
    The key is That the database that keeps track of where files are on the disk, and the journal that records operations and weather or not they finished has a critical need to be written in the order I specify. For instance if I am copying a file to the device the journal NEEDS to have it written that the operation was started, then the file is written and I do not care about caching, I will flush when it is done. Then I NEEd the journal to have an entree saying the operation finished. It is critical that the journal operations happen when I specify.
    Since flash drives have faster random access I am using them to store the database while I use regular disks to hold the actual files since they are larger and continuous.
    Before anyone tries to point out that it may have been done before or where I want to say I do not care, I am not doing this to be original or to get any kind of recognition, I am doing it to learn how to do it.