From: Chris Mason <mason@suse.com>
To: Chris Wedgwood <cw@f00f.org>, Steve Lord <lord@sgi.com>
Cc: Andrew Morton <akpm@zip.com.au>, Ricardo Galli <gallir@uib.es>,
Linux Kernel <linux-kernel@vger.kernel.org>,
andrea@suse.de
Subject: Re: O_DIRECT fails in some kernel and FS
Date: Sat, 02 Feb 2002 13:20:08 -0500 [thread overview]
Message-ID: <234710000.1012674008@tiny> (raw)
In-Reply-To: <20020202093554.GA7207@tapu.f00f.org>
In-Reply-To: <E16WkQj-0005By-00@antoli.uib.es> <3C5AFE2D.95A3C02E@zip.com.au> <1012597538.26363.443.camel@jen.americas.sgi.com> <20020202093554.GA7207@tapu.f00f.org>
Ok, the tricky part of direct io on reiserfs is the tails. But,
since direct io isn't allowed on non-page aligned file sizes, we'll
never have direct io onto a normal file tail.
< 2.4.18 reiserfs versions allowed expanding truncates to set i_size
without creating the corresponding metadata, so we still have to deal
with that. It means we could have a packed tail on any file size,
including those bigger than the 16k limit after which we don't create
tails any more.
Chris and I had initially decided to unpack the tails on file open
if O_DIRECT is used, but it seems cleaner to add a
reiserfs_get_block_direct_io, and have it return -EINVAL if a read
went to a tail. writes that happen to a tail will trigger tail
conversion.
Anyway, this patch is very lightly tested, I'll try all the corner
cases on sunday.
-chris
# against 2.4.18-pe7
#
--- temp.1/fs/reiserfs/inode.c Mon, 28 Jan 2002 09:51:50 -0500
+++ temp.1(w)/fs/reiserfs/inode.c Sat, 02 Feb 2002 12:26:50 -0500
@@ -445,6 +445,20 @@
return reiserfs_get_block(inode, block, bh_result, GET_BLOCK_NO_HOLE) ;
}
+static int reiserfs_get_block_direct_io (struct inode * inode, long block,
+ struct buffer_head * bh_result, int create) {
+ int ret ;
+
+ ret = reiserfs_get_block(inode, block, bh_result, create) ;
+
+ /* don't allow direct io onto tail pages */
+ if (ret == 0 && buffer_mapped(bh_result) && bh_result->b_blocknr == 0) {
+ ret = -EINVAL ;
+ }
+ return ret ;
+}
+
+
/*
** helper function for when reiserfs_get_block is called for a hole
** but the file tail is still in a direct item
@@ -2050,11 +2064,20 @@
return ret ;
}
+static int reiserfs_direct_io(int rw, struct inode *inode,
+ struct kiobuf *iobuf, unsigned long blocknr,
+ int blocksize)
+{
+ return generic_direct_IO(rw, inode, iobuf, blocknr, blocksize,
+ reiserfs_get_block_direct_io) ;
+}
+
struct address_space_operations reiserfs_address_space_operations = {
writepage: reiserfs_writepage,
readpage: reiserfs_readpage,
sync_page: block_sync_page,
prepare_write: reiserfs_prepare_write,
commit_write: reiserfs_commit_write,
- bmap: reiserfs_aop_bmap
+ bmap: reiserfs_aop_bmap,
+ direct_IO: reiserfs_direct_io,
} ;
next prev parent reply other threads:[~2002-02-02 18:21 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-01 20:37 O_DIRECT fails in some kernel and FS 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 [this message]
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
[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 ` Andi Kleen
2002-02-04 15:13 ` Jeff Garzik
2002-02-04 15:31 ` Chris Mason
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=234710000.1012674008@tiny \
--to=mason@suse.com \
--cc=akpm@zip.com.au \
--cc=andrea@suse.de \
--cc=cw@f00f.org \
--cc=gallir@uib.es \
--cc=linux-kernel@vger.kernel.org \
--cc=lord@sgi.com \
/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