Messages in this thread | | | Subject | Re: O_DIRECT foolish question | From | Bruno Diniz de Paula <> | Date | 13 Feb 2003 17:45:17 -0500 |
| |
Hi Andrew,
it worked perfectly on my box. Now I am going to try in my experiments environment and I'll let you know if everything was ok.
Thanks a lot,
Bruno.
PS: BTW, is this patch going to be added to 2.4 kernel?
On Thu, 2003-02-13 at 12:31, Andrew Morton wrote: > Bruno Diniz de Paula <diniz@cs.rutgers.edu> wrote: > > > > Thanks, Andrew. So, no chances of getting this working correctly on 2.4 > > kernel for now (I mean, reading files with size != n*block_size), and > > I'd better give up on this... Is it the case, or you think there is > > still something to do to get this working on ext2 and 2.4 kernel? > > > > Oh I think we can probably fix this up. Can you test this diff? > > > diff -puN fs/buffer.c~o_direct-length-fix fs/buffer.c > --- 24/fs/buffer.c~o_direct-length-fix 2003-02-13 09:23:34.000000000 -0800 > +++ 24-akpm/fs/buffer.c 2003-02-13 09:24:39.000000000 -0800 > @@ -2107,7 +2107,7 @@ int generic_direct_IO(int rw, struct ino > int length; > > length = iobuf->length; > - nr_blocks = length / blocksize; > + nr_blocks = (length + blocksize - 1) / blocksize; > /* build the blocklist */ > for (i = 0; i < nr_blocks; i++, blocknr++) { > struct buffer_head bh; > @@ -2148,6 +2148,10 @@ int generic_direct_IO(int rw, struct ino > retval = brw_kiovec(rw, 1, &iobuf, inode->i_dev, iobuf->blocks, blocksize); > /* restore orig length */ > iobuf->length = length; > + > + /* Return correct value for reads at eof */ > + if (retval > 0 && retval > length) > + retval = length; > out: > > return retval; > > _ > > - > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- Bruno Diniz de Paula <diniz@cs.rutgers.edu> Rutgers University [unhandled content-type:application/pgp-signature] | |