public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <mason@suse.com>
To: Jeff Garzik <jgarzik@mandrakesoft.com>, Andi Kleen <ak@suse.de>
Cc: Andrea Arcangeli <andrea@suse.de>, linux-kernel@vger.kernel.org
Subject: Re: O_DIRECT fails in some kernel and FS
Date: Mon, 04 Feb 2002 10:31:06 -0500	[thread overview]
Message-ID: <404960000.1012836666@tiny> (raw)
In-Reply-To: <3C5EA521.B7D2F8C2@mandrakesoft.com>
In-Reply-To: <E16WkQj-0005By-00@antoli.uib.es.suse.lists.linux.kernel> <3C5AFE2D.95A3C02E@zip.com.au.suse.lists.linux.kernel> <1012597538.26363.443.camel@jen.americas.sgi.com.suse.lists.linux.kernel> <20020202093554.GA7207@tapu.f00f.org.suse.lists.linux.kernel> <234710000.1012674008@tiny.suse.lists.linux.kernel> <20020202205438.D3807@athlon.random.suse.lists.linux.kernel> <242700000.1012680610@tiny.suse.lists.linux.kernel> <3C5C4929.5080403@sgi.com.suse.lists.linux.kernel> <20020202155028.B26147@havoc.gtf.org.suse.lists.linux.kernel> <p737kpvauvv.fsf@oldwotan.suse.de> <3C5EA521.B7D2F8C2@mandrakesoft.com>



On Monday, February 04, 2002 10:13:37 AM -0500 Jeff Garzik <jgarzik@mandrakesoft.com> wrote:

> Andi Kleen wrote:
>> 
>> Jeff Garzik <garzik@havoc.gtf.org> writes:
>> 
>> > On Sat, Feb 02, 2002 at 02:16:41PM -0600, Stephen Lord wrote:
>> > > Can't you fall back to buffered I/O for the tail? OK it complicates the
>> > > code, probably a lot, but it keeps things sane from the user's point of
>> > > view.
>> > 
>> > For O_DIRECT, IMHO you should fail not fallback.  You're simply lying
>> > to the underlying program otherwise.
>> 
>> It's just impossible to write a tail which is smaller than a disk block
>> without another buffer.
> 
> I argue, for reiserfs:
> 
> For O_DIRECT writes, the preferred behavior is to write disk blocks
> obtained through the normal methods (get_block, etc.), and fully support
> inodes for which file tails do not exist.

Done ;-)

> 
> For O_DIRECT reads, if the data is determined to be in a file tail,
> ->direct_IO should either (a) fail or (b) dump the file tail to a normal
> disk block before performing ->direct_IO.

The current patch does A.  Another option is to change the reiserfs open
code to detect the tail and do an -EINVAL for o_direct.  This gives the
application a better way to fall back to normal open methods than returning
an error during the read.

Just to restate, the current O_DIRECT code can never hit a reiserfs tail in 
the normal case.  By definition, reiserfs tails are not block aligned, and 
O_DIRECT writes are.  The only time it is a concern is with a screwy 
interaction between expanding truncates and tails on kernels < 2.4.17.  
Since most O_DIRECT users are databases, and tails are never created on
files > 16k in size, I don't expect anyone to ever see the reiserfs 
triggered -EINVAL from the current patch (famous last words).

-chris


  reply	other threads:[~2002-02-04 15:32 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E16WkQj-0005By-00@antoli.uib.es.suse.lists.linux.kernel>
     [not found] ` <3C5AFE2D.95A3C02E@zip.com.au.suse.lists.linux.kernel>
     [not found]   ` <1012597538.26363.443.camel@jen.americas.sgi.com.suse.lists.linux.kernel>
     [not found]     ` <20020202093554.GA7207@tapu.f00f.org.suse.lists.linux.kernel>
     [not found]       ` <234710000.1012674008@tiny.suse.lists.linux.kernel>
     [not found]         ` <20020202205438.D3807@athlon.random.suse.lists.linux.kernel>
     [not found]           ` <242700000.1012680610@tiny.suse.lists.linux.kernel>
     [not found]             ` <3C5C4929.5080403@sgi.com.suse.lists.linux.kernel>
     [not found]               ` <20020202155028.B26147@havoc.gtf.org.suse.lists.linux.kernel>
2002-02-03  7:26                 ` O_DIRECT fails in some kernel and FS Andi Kleen
2002-02-04 15:13                   ` Jeff Garzik
2002-02-04 15:31                     ` Chris Mason [this message]
2002-02-01 20:37 Ricardo Galli
2002-02-01 20:44 ` Andrew Morton
2002-02-01 20:49   ` Ricardo Galli
2002-02-01 20:57     ` Andrew Morton
2002-02-01 21:05   ` Steve Lord
2002-02-02  9:35     ` Chris Wedgwood
2002-02-02 10:25       ` Hans Reiser
2002-02-02 15:24       ` Chris Mason
2002-02-02 18:20       ` Chris Mason
2002-02-02 19:54         ` Andrea Arcangeli
2002-02-02 20:10           ` Chris Mason
2002-02-02 20:16             ` Stephen Lord
2002-02-02 20:50               ` Jeff Garzik
2002-02-03 13:40                 ` Stephen Lord
2002-02-03 14:09                   ` Chris Wedgwood
2002-02-03 15:05                     ` Stephen Lord
2002-02-03 22:44                       ` Chris Wedgwood
2002-02-04 15:04                         ` Jeff Garzik
2002-02-04 15:21                           ` Chris Mason
2002-02-04 15:15                         ` Steve Lord
2002-02-04 15:46                           ` Alan Cox
2002-02-04 16:02                             ` Steve Lord
2002-02-04 18:22                               ` Daniel Phillips
2002-02-04 19:11                                 ` Steve Lord
2002-02-04 18:29                             ` Joel Becker
2002-02-04 18:49                               ` Jeff Garzik
2002-02-04 18:55                                 ` Joel Becker
2002-02-04 19:16                                   ` Jeff Garzik
2002-02-02 17:14   ` Christoph Hellwig

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=404960000.1012836666@tiny \
    --to=mason@suse.com \
    --cc=ak@suse.de \
    --cc=andrea@suse.de \
    --cc=jgarzik@mandrakesoft.com \
    --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