--- linux.prj.suse.2/fs/reiserfs/inode.c        Tue Feb 19 08:55:47 2002
+++ linux.prj/fs/reiserfs/inode.c       Tue Feb 19 20:45:35 2002
@@ -452,6 +452,24 @@
    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) {
+       /* make sure future calls to the direct io funcs for this offset
+       ** in the file fail by unmapping the buffer
+       */
+       reiserfs_unmap_buffer(bh_result);
+        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
@@ -2159,11 +2177,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,
} ;