linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Bruce Allen <ballen@gravity.phys.uwm.edu>
Cc: adi@hexapodia.org, bug-coreutils@gnu.org, linux-kernel@vger.kernel.org
Subject: Re: dd PATCH: add conv=direct
Date: Wed, 7 Apr 2004 09:42:22 -0700	[thread overview]
Message-ID: <20040407094222.3362e5c8.akpm@osdl.org> (raw)
In-Reply-To: <Pine.GSO.4.21.0404071119120.903-100000@dirac.phys.uwm.edu>

Bruce Allen <ballen@gravity.phys.uwm.edu> wrote:
>
> > > On modern Linux, apparently the correct way to bypass the buffer cache
> > > when writing to a block device is to open the block device with
> > > O_DIRECT.  This enables, for example, the user to more easily force a
> > > reallocation of a single sector of an IDE disk with a media error
> > > (without overwriting anything but the 1k "sector pair" containing the
> > > error).  dd(1) is convenient for this purpose, but is lacking a method
> > > to force O_DIRECT.  The enclosed patch adds a "conv=direct" flag to
> > > enable this usage.
> > 
> > This would be rather nice to have.  You'll need to ensure that the data
> > is page-aligned in memory.
> > 
> > While you're there, please add an fsync-before-closing option.
> 
> Andrew, am I right that this is NOT needed for the proposed O_DIRECT
> option, since open(2) says: 
>   "The I/O is synchronous, i.e., at the completion of the read(2) or
>    write(2) system call, data is guaranteed to have been transferred."
> so the write will block until data is physically on the disk.

A conv=fsync option is an irrelevant wishlist item.  If you were to provide
conv=fsync then dd should still fsync the file after performing the
direct-io read or write.

You're correct that an fsync after a direct-io read or write should not
need to perform any file data I/O.  But it will often need to perform file
metadata I/O - file allocation tables, inode, etc.  direct-io only syncs
the file data, not the file metadata.

  reply	other threads:[~2004-04-07 16:40 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-06 22:03 dd PATCH: add conv=direct Andy Isaacson
2004-04-07  0:33 ` Andrew Morton
2004-04-07 16:21   ` Bruce Allen
2004-04-07 16:42     ` Andrew Morton [this message]
2004-04-07 17:31   ` Andy Isaacson
2004-04-07 18:18     ` Andrew Morton
2004-04-07 19:24       ` Andy Isaacson
2004-04-07 19:34         ` Andrew Morton
2004-04-07 19:47           ` Andy Isaacson
2004-04-07 20:03             ` Andrew Morton
2004-04-07 20:43               ` Andy Isaacson
2004-04-07 21:00                 ` Valdis.Kletnieks
2004-04-07 21:35                 ` Bruce Allen
2004-04-08  6:56                   ` Paul Eggert
2004-04-08 11:07                     ` Jim Meyering
2004-04-08 19:32                       ` Paul Eggert
2004-04-08 19:51                         ` Paul Jarc
2004-04-08 21:34                         ` Jim Meyering
2004-04-08 16:23                     ` Philippe Troin
2004-04-08 20:20                       ` dd patch to remove noctty Paul Eggert
2004-04-08 21:40                         ` Jim Meyering
2004-04-09  0:37             ` dd PATCH: add conv=direct Anton Blanchard
2004-04-09  1:42               ` Wim Coekaerts
2004-04-10 21:28                 ` Jim Meyering
2004-04-07 20:46       ` Paul Eggert
2004-04-07 21:06         ` Andrew Morton
2004-04-07 21:09         ` Andy Isaacson
2004-04-07 19:12     ` Miquel van Smoorenburg
2004-04-07 20:14       ` Andy Isaacson
2004-04-07 22:02 ` Nathan Straz
2004-04-07 22:09   ` Andy Isaacson
2004-04-08 11:44     ` Miquel van Smoorenburg

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=20040407094222.3362e5c8.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=adi@hexapodia.org \
    --cc=ballen@gravity.phys.uwm.edu \
    --cc=bug-coreutils@gnu.org \
    --cc=linux-kernel@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).