Re: FILE_FLAG_WRITE_THROUGH

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Steve Graegert wrote:
> On 4/5/06, Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx> wrote:
> > Rebelde wrote:
> > > On Windows XP I can write directly to disk whitout cache write using
> > > the CreateFile function with FILE_FLAG_WRITE_THROUGH. Could someone
> > > tell me how to make this on Linux?
> >
> > Pass the O_SYNC flag to open(). This will cause write() calls to block
> > until the data has been sent to the drive.
> >
> > The O_DIRECT flag suggested by Steve is probably overkill. It requires
> > that the buffer start address, buffer size and file offset are all
> > multiples of the filesystem's block size, and only works on some
> > filesystems.
>
> Well, the O_SYNC flag causes, i.e. write(2), to block until the data
> has been physically written to disk, but it does not prevent the C
> library/kernel from caching the bytes.  O_DIRECT, on the other hand,
> circumvents the caching mechanisms and allows for raw access, although
> it may degrade performance.

Or increase performance because dcache costs dear cpu-cycles?

Thanks!

--
Al

-
: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux