linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Boldi <a1426z@gawab.com>
To: linux-c-programming@vger.kernel.org
Subject: Re: FILE_FLAG_WRITE_THROUGH
Date: Wed, 5 Apr 2006 16:43:06 +0300	[thread overview]
Message-ID: <200604051643.06825.a1426z@gawab.com> (raw)
In-Reply-To: <6a00c8d50604050031w3b30032bm73cefeab84119024@mail.gmail.com>

Steve Graegert wrote:
> On 4/5/06, Glynn Clements <glynn@gclements.plus.com> 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


      reply	other threads:[~2006-04-05 13:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-04 17:53 FILE_FLAG_WRITE_THROUGH Rebelde
2006-04-04 19:13 ` FILE_FLAG_WRITE_THROUGH Steve Graegert
2006-04-05  4:02 ` FILE_FLAG_WRITE_THROUGH Glynn Clements
2006-04-05  6:50   ` FILE_FLAG_WRITE_THROUGH Progga
2006-04-05  7:36     ` FILE_FLAG_WRITE_THROUGH Steve Graegert
2006-04-05 18:47       ` FILE_FLAG_WRITE_THROUGH Glynn Clements
2006-04-06  7:02         ` FILE_FLAG_WRITE_THROUGH Steve Graegert
2006-04-05  7:31   ` FILE_FLAG_WRITE_THROUGH Steve Graegert
2006-04-05 13:43     ` Al Boldi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200604051643.06825.a1426z@gawab.com \
    --to=a1426z@gawab.com \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).