[PATCH 0 of 1 ] Wrong distance calculation in revlog causes huge manifests

Noel Grandin noel at peralex.com
Thu Jul 12 09:34:01 CDT 2012


On 2012-07-12 16:13, Matt Mackall wrote:
> Could be done, if we weren't using Python and there was a nice 
> portable AIO interface. 
Yeah, it's not dead simple.

I've had a look around for another project I'm working on and I came to 
the conclusion that it would be better to roll your own.
Most of the existing libraries are focussed on the networking side of 
things, and are complete overkill for disk stuff.
It is actually really easy to do the kind of async disk IO from C/C++ 
that we need.

We could implement a method that looked like this in python
    readMany(array of blocks)
       for each block
           read block
as a default.

and then override that for each operating system.

In MS-Windows that would look something like:
     void readMany(vector<block> blocks) {
         // initiate the IO
         OVERLAPPED[] overlaps = new OVERLAPPED[blocks.size()];
         for (int i=0; i < overlaps.size(); i++)
             ReadFileEx(block[i], overlaps[i]);

         // wait for IO to complete
         HANDLE[] ports = new HANDLE[overlaps.size()];
         for (int i=0; i < overlaps.size(); i++)
             CreateIoCompletionPort(ports[i], overlaps[i].hEvent);
         WaitForMultipleObjectsEx(ports);
     }

The linux side is probably pretty similar.


Disclaimer: http://www.peralex.com/disclaimer.html




More information about the Mercurial-devel mailing list