diff -Nru mm/filemap.c.orig mm/filemap.c --- mm/filemap.c.orig Wed Apr 30 17:19:56 2003 +++ mm/filemap.c Fri May 30 14:01:12 2003 @@ -1574,6 +1574,42 @@ UPDATE_ATIME(inode); } +#include +static int wrong_flag; +void check_value(struct kiobuf * iobuf, size_t iosize, loff_t offset, size_t count, size_t retval) +{ + int i,val; + db_assert(iosize == count); + db_assert(retval == count); + + /* + printk("iobuf->nr_pages=%d, offset=%lld, iosize=%d, pages=%d(%d)\n", + iobuf->nr_pages, + offset, + iosize, + iosize/1024/4, + iosize % (1024*4)); + return; + */ + + val = offset / 4; + for (i=0; i< iobuf->nr_pages; i++) { + int *p=page_address(iobuf->maplist[i]); + int j; + for(j=0; j<1024; j++,p++,val++) { + if (val != *p) + if (!wrong_flag) { + wrong_flag=1; + printk("wrong at %d: got %d, expect %d\n", + (int)(offset + i*1024*4 + j*4), + *p, + val); + } + } + } +} + +#include static ssize_t generic_file_direct_IO(int rw, struct file * filp, char * buf, size_t count, loff_t offset) { ssize_t retval; @@ -1583,6 +1619,7 @@ struct inode * inode = mapping->host; loff_t size = inode->i_size; + new_iobuf = 0; iobuf = filp->f_iobuf; if (test_and_set_bit(0, &filp->f_iobuf_lock)) { @@ -1601,6 +1638,14 @@ blocksize_mask = blocksize - 1; chunk_size = KIO_MAX_ATOMIC_IO << 10; + /* + printk("JSUN: generic_file_direct_IO - count = %d, offset = %d\n", + count, offset); + */ + /* + printk("JSUN : chunk_size = %d (%x)\n", chunk_size, chunk_size); + */ + retval = -EINVAL; if ((offset & blocksize_mask) || (count & blocksize_mask)) goto out_free; @@ -1634,6 +1679,8 @@ retval = mapping->a_ops->direct_IO(rw, inode, iobuf, (offset+progress) >> blocksize_bits, blocksize); + check_value(iobuf, iosize, offset, count, retval); + if (rw == READ && retval > 0) mark_dirty_kiobuf(iobuf, retval);