Re: 2.6.9-mm1: LVM stopped working (dio-handle-eof.patch)

From: Jens Axboe
Date: Tue Nov 02 2004 - 09:46:17 EST


On Wed, Oct 27 2004, Mathieu Segaud wrote:
> Jens Axboe <axboe@xxxxxxx> disait dernièrement que :
>
>
> > This feels pretty icky, but should suffice for testing. Does it make a
> > difference?
> >
> > --- /opt/kernel/linux-2.6.10-rc1-mm1/fs/direct-io.c 2004-10-27 08:29:51.866931262 +0200
> > +++ linux-2.6.10-rc1-mm1/fs/direct-io.c 2004-10-27 08:41:20.292172299 +0200
> > @@ -987,8 +987,8 @@
> > isize = i_size_read(inode);
> > if (bytes_todo > (isize - offset))
> > bytes_todo = isize - offset;
> > - if (!bytes_todo)
> > - return 0;
> > + if (bytes_todo < PAGE_SIZE)
> > + bytes_todo = PAGE_SIZE;
> >
> > for (seg = 0; seg < nr_segs && bytes_todo; seg++) {
> > user_addr = (unsigned long)iov[seg].iov_base;
>
> As 2.6.10-rc1-mm1 failed (as expected), I tried tour fix applied upon
> 2.6.10-rc1-mm1. This did not make any difference.
> The only workaround for now is backing out dio-handle-eof-fix.patch and
> dio-handle-eof.patch
> I am willing to test anything you could send :)

Does this work, on top of 2.6.0-rc1-mm1?

--- /opt/kernel/linux-2.6.10-rc1-mm1/fs/direct-io.c 2004-10-27 08:29:51.000000000 +0200
+++ linux-2.6.10-rc1-mm1/fs/direct-io.c 2004-11-02 15:36:51.864411244 +0100
@@ -985,10 +985,12 @@
}

isize = i_size_read(inode);
- if (bytes_todo > (isize - offset))
- bytes_todo = isize - offset;
- if (!bytes_todo)
- return 0;
+ if (bytes_todo > (isize - offset)) {
+ if ((isize - offset))
+ bytes_todo = isize - offset;
+ if (bytes_todo > PAGE_SIZE)
+ bytes_todo = PAGE_SIZE;
+ }

for (seg = 0; seg < nr_segs && bytes_todo; seg++) {
user_addr = (unsigned long)iov[seg].iov_base;
@@ -1008,10 +1010,9 @@
dio->curr_page = 0;

dio->total_pages = 0;
- if (user_addr & (PAGE_SIZE-1)) {
+ if (user_addr & (PAGE_SIZE-1))
dio->total_pages++;
- bytes -= PAGE_SIZE - (user_addr & (PAGE_SIZE - 1));
- }
+
dio->total_pages += (bytes + PAGE_SIZE - 1) / PAGE_SIZE;
dio->curr_user_address = user_addr;


--
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/