diff -urN o-direct-ref/fs/reiserfs/inode.c o-direct/fs/reiserfs/inode.c --- o-direct-ref/fs/reiserfs/inode.c Wed Feb 20 20:49:23 2002 +++ o-direct/fs/reiserfs/inode.c Wed Feb 20 20:50:25 2002 @@ -445,6 +445,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 @@ -2072,11 +2090,21 @@ return ret ; } +static int reiserfs_direct_io(int rw, struct file *file, + struct kiobuf *iobuf, unsigned long blocknr, + int blocksize) +{ + struct inode * inode = filp->f_dentry->d_inode->i_mapping->host; + 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, } ;