Re: O_DIRECT support for Windows - Mailing list pgsql-patches

From Magnus Hagander
Subject Re: O_DIRECT support for Windows
Date
Msg-id 20070115091630.GA27530@svr2.hagander.net
Whole thread Raw
In response to O_DIRECT support for Windows  (ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
Responses Re: O_DIRECT support for Windows  (ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
List pgsql-patches
On Mon, Jan 15, 2007 at 05:36:09PM +0900, ITAGAKI Takahiro wrote:
> The attached is a patch to define O_DIRECT by ourselves on Windows,
> and to map O_DIRECT to FILE_FLAG_NO_BUFFERING.
>
> There will be a consistency in our support between Windows and other OSes
> that have O_DIRECT. Also, there is the following comment that says, I read,
> we should do so.
> | handle other flags? (eg FILE_FLAG_NO_BUFFERING/FILE_FLAG_WRITE_THROUGH)
>
> Is this worth doing? Do we need more performance reports for the change?

IIRC we've discussed this before at some point, and I think we came to
the conclusion that we shouldn't do it. However, things may have
changed :-)

FILE_FLAG_NO_BUFFERING requires that *all* I/O follows:
* File access must begin at offsets that are integer multples of the
  volume sector size.
* File access must be for number of bytes that are integer multiples of
  the volume sector size.
* Buffer addresses for read and write operations must be sector aligned.

I was under the impression that our code can in no way guarantee this.
Especially given that a typical NTFS drive can have anything from 512 to
4096 bytes if you use the GUI to format it, and larger sizes than that
when you use some SAN tools to do it.

(btw, we already map O_DSYNC to FILE_FLAG_WRITE_THROUGH)

//Magnus

pgsql-patches by date:

Previous
From: Dave Page
Date:
Subject: Re: Allow dumping of roles or tablespaces
Next
From: ITAGAKI Takahiro
Date:
Subject: Re: O_DIRECT support for Windows